From bcc6047ef19e2bd7a83c7f6e6abcb2cd1d8107cc Mon Sep 17 00:00:00 2001
From: baizonghao <1719256278@qq.com>
Date: 星期五, 24 二月 2023 17:51:36 +0800
Subject: [PATCH] 按照报警时间统计

---
 ycl-platform/src/main/resources/mapper/unlawful/UnlawfulMapper.xml |   61 ++++++++++++++++++++++++++++++
 1 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/ycl-platform/src/main/resources/mapper/unlawful/UnlawfulMapper.xml b/ycl-platform/src/main/resources/mapper/unlawful/UnlawfulMapper.xml
index c729847..1cfa75b 100644
--- a/ycl-platform/src/main/resources/mapper/unlawful/UnlawfulMapper.xml
+++ b/ycl-platform/src/main/resources/mapper/unlawful/UnlawfulMapper.xml
@@ -142,6 +142,7 @@
 
 
 
+
 <!--    鎸夌偣浣嶇粺璁�-->
     <select id="getDataBySite" resultType="java.lang.String">
         SELECT
@@ -196,4 +197,64 @@
         GROUP BY
             ubc.site
     </select>
+
+
+
+
+<!--    鎸夌収鎶ヨ鏃堕棿-->
+    <select id="getDataByTime" resultType="com.ycl.dto.statistics.TimeDto">
+        SELECT
+            ubc.id id,
+            ubc.alarm_time time
+        FROM
+            `ums_base_case` AS ubc
+                JOIN ums_violations AS uv ON ubc.id = uv.id
+                LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id
+                LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id
+                LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id
+        WHERE
+            ubc.category = 1
+          AND t4.`name` IS NOT NULL
+        <if test="startTime !='' and endTime !='' and startTime!=null and endTime !=null">
+            and ubc.alarm_time between #{startTime} and #{endTime}
+        </if>
+        GROUP BY
+            ubc.alarm_time
+        limit #{currentPage}, #{pageSize}
+    </select>
+    <select id="getStatusDataByTime" resultType="com.ycl.dto.statistics.StatusDto">
+        SELECT
+            count( 1 ) total,
+            sum( CASE WHEN ubc.state = 5 THEN 1 ELSE 0 END ) register,
+            sum( CASE WHEN ubc.state = 4 THEN 1 ELSE 0 END ) notRegister,
+            sum( CASE WHEN ubc.state = 9 THEN 1 ELSE 0 END ) closing,
+            sum( CASE WHEN ubc.state = 3 THEN 1 ELSE 0 END ) relearn,
+            sum( CASE WHEN ubc.state = 8 THEN 1 ELSE 0 END ) checked
+        FROM
+            `ums_base_case` AS ubc
+                JOIN ums_violations AS uv ON ubc.id = uv.id
+                LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id
+                LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id
+                LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id
+        WHERE
+            ubc.category = 1
+          AND t4.`name` IS NOT NULL
+          AND ubc.id = #{id}
+    </select>
+    <select id="getDataByTimeExp" resultType="com.ycl.dto.statistics.TimeDto">
+        SELECT
+            ubc.id id,
+            ubc.alarm_time time,
+        FROM
+            `ums_base_case` AS ubc
+                JOIN ums_violations AS uv ON ubc.id = uv.id
+                LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id
+                LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id
+                LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id
+        WHERE
+            ubc.category =1
+          and t4.`name` is NOT NULL
+        group by
+            ubc.alarm_time
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0