From bee1fe3c6f0bf1fe56672f71a001741bc8e9517d Mon Sep 17 00:00:00 2001
From: baizonghao <1719256278@qq.com>
Date: 星期五, 24 二月 2023 21:34:40 +0800
Subject: [PATCH] 统计报警时间,查询空指针
---
ycl-platform/src/main/resources/mapper/unlawful/UnlawfulMapper.xml | 136 ++++++++++++++++++--------------------------
1 files changed, 56 insertions(+), 80 deletions(-)
diff --git a/ycl-platform/src/main/resources/mapper/unlawful/UnlawfulMapper.xml b/ycl-platform/src/main/resources/mapper/unlawful/UnlawfulMapper.xml
index 6f2d819..a5e5ea6 100644
--- a/ycl-platform/src/main/resources/mapper/unlawful/UnlawfulMapper.xml
+++ b/ycl-platform/src/main/resources/mapper/unlawful/UnlawfulMapper.xml
@@ -263,91 +263,67 @@
<!-- 鍒嗛〉鏁伴噺-->
<select id="getTotalByType" resultType="java.lang.Integer">
- select
- SUM( CASE WHEN num is null THEN 0 ELSE num END )
- from(
- SELECT
- count(*) num
- 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.create_time between #{startTime} and #{endTime}
- </if>
- group by
- t4.id
- ) a
+ SELECT
+ count(*) num
+ 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.create_time between #{startTime} and #{endTime}
+ </if>
</select>
<select id="getTotalByStreet" resultType="java.lang.Integer">
- select
- SUM( CASE WHEN num is null THEN 1 ELSE num END )
- from(
- SELECT
- count(*) num
- 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.create_time between #{startTime} and #{endTime}
- </if>
- GROUP BY
- ubc.community_id
- ) a
+ SELECT
+ count(*) num
+ 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.create_time between #{startTime} and #{endTime}
+ </if>
</select>
<select id="getTotalBySite" resultType="java.lang.Integer">
- select
- SUM(num)
- from(
- SELECT
- count(*) num
- 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.create_time between #{startTime} and #{endTime}
- </if>
- GROUP BY
- ubc.site
- ) a
+ SELECT
+ count(*) num
+ 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.create_time between #{startTime} and #{endTime}
+ </if>
</select>
<select id="getTotalByTime" resultType="java.lang.Integer">
- select
- SUM( CASE WHEN num is null THEN 1 ELSE num END )
- from(
- SELECT
- count(*) num
- 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
- ) a
+ SELECT
+ count(*) num
+ 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>
</select>
</mapper>
\ No newline at end of file
--
Gitblit v1.8.0