From e3daa347df3ce7f65444f2b357b229e42c0e912d Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期一, 19 八月 2024 13:42:04 +0800
Subject: [PATCH] 车辆点位和视图库稳定性测试

---
 ycl-server/src/main/resources/mapper/zgyw/ReportMapper.xml |   51 +++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 37 insertions(+), 14 deletions(-)

diff --git a/ycl-server/src/main/resources/mapper/zgyw/ReportMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/ReportMapper.xml
index 17b7c91..cc7b9e9 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/ReportMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/ReportMapper.xml
@@ -21,24 +21,47 @@
         r.*, u.unit_name, p.yw_person_name as peopleName, pt.point_name
         FROM
         t_report r
-        LEFT JOIN t_yw_unit u ON r.unit_id = u.id and u.deleted = '0'
-        LEFT JOIN t_yw_people p ON r.people_id = p.id and p.deleted = '0'
-        LEFT JOIN t_yw_point pt ON r.point_id = pt.id and pt.deleted = '0'
-        where
-        r.deleted = '0'
-        <if test="reportType != null and reportType != ''">
-            AND r.report_type = #{reportType}
+        LEFT JOIN t_yw_unit u ON r.unit_id = u.id and u.deleted = 0
+        LEFT JOIN t_yw_people p ON r.people_id = p.id and p.deleted = 0
+        LEFT JOIN t_yw_point pt ON r.point_id = pt.id and pt.deleted = 0
+        INNER JOIN (
+            SELECT identify,MAX(create_time) AS create_time
+            FROM t_report
+            WHERE deleted = 0
+            GROUP BY identify
+        ) as rr ON r.create_time = rr.create_time
+        WHERE
+        r.deleted = 0
+        <if test="query.reportType != null and query.reportType != ''">
+            AND r.report_type = #{query.reportType}
         </if>
-        <if test="beginCreateTime != null">
-            AND r.create_time between #{beginCreateTime} and #{endCreateTime}
+        <if test="query.status != null">
+            AND r.status = #{query.status}
         </if>
-        <if test="pointId != null and pointId != ''">
-            AND pt.point_name like concat('%', #{pointId}, '%')
+        <if test="query.pointId != null and query.pointId != ''">
+            AND pt.point_name like concat('%', #{query.pointId}, '%')
         </if>
-        <if test="peopleId != null and peopleId != ''">
-            AND p.yw_person_name like concat('%', #{peopleId}, '%')
+        <if test="query.peopleId != null and query.peopleId != ''">
+            AND p.yw_person_name like concat('%', #{query.peopleId}, '%')
         </if>
-        ORDER BY r.create_time DESC
+        ORDER BY r.update_time DESC
+    </select>
+
+    <select id="examineRecord" resultMap="BaseResultMap">
+        SELECT
+            r.*, u.unit_name, p.yw_person_name as peopleName, pt.point_name
+        FROM
+            t_report r
+                LEFT JOIN t_yw_unit u ON r.unit_id = u.id and u.deleted = 0
+                LEFT JOIN t_yw_people p ON r.people_id = p.id and p.deleted = 0
+                LEFT JOIN t_yw_point pt ON r.point_id = pt.id and pt.deleted = 0
+                INNER JOIN (
+                    SELECT identify, create_time
+                    FROM t_report
+                    WHERE id = #{id} AND deleted = 0
+            ) as rr ON r.identify = rr.identify AND r.create_time &lt;= rr.create_time
+        ORDER BY
+            r.create_time DESC
     </select>
 
 </mapper>

--
Gitblit v1.8.0