From 0e3fcd49ee1c73bf3bf6fc0cbdb64763d8e61b89 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期一, 27 二月 2023 10:13:59 +0800
Subject: [PATCH] 部门查询bug
---
ycl-platform/src/main/resources/mapper/unlawful/UnlawfulMapper.xml | 280 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 267 insertions(+), 13 deletions(-)
diff --git a/ycl-platform/src/main/resources/mapper/unlawful/UnlawfulMapper.xml b/ycl-platform/src/main/resources/mapper/unlawful/UnlawfulMapper.xml
index 55a42be..a5e5ea6 100644
--- a/ycl-platform/src/main/resources/mapper/unlawful/UnlawfulMapper.xml
+++ b/ycl-platform/src/main/resources/mapper/unlawful/UnlawfulMapper.xml
@@ -1,6 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycl.mapper.unlawful.UnlawfulMapper">
+<!-- 鑾峰彇鎬绘暟-->
+ <select id="getTotal" resultType="java.lang.Integer">
+ SELECT
+ count(*)
+ 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
+ </select>
+
+<!-- 鎸夌収杩濊绫诲瀷缁熻-->
<select id="getDataByType" resultType="com.ycl.dto.statistics.CategoryDto">
SELECT
t4.id id,
@@ -38,24 +54,12 @@
WHERE
ubc.category =1
and t4.`id` = #{dictionaryId}
+ 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="getTotal" resultType="java.lang.Integer">
- SELECT
- count(*)
- 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
- </select>
<select id="getDataByTypeExp" resultType="com.ycl.dto.statistics.CategoryDto">
SELECT
t4.id id,
@@ -72,4 +76,254 @@
group by
t4.id
</select>
+
+
+
+
+<!-- 鎸夌収鍖哄煙缁熻-->
+ <select id="getDataByStreet" resultType="com.ycl.dto.statistics.CategoryDto">
+ SELECT
+ ubc.community_id id,
+ t5.region_name name
+ 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
+ limit #{currentPage}, #{pageSize}
+ </select>
+ <select id="getStatusDataByStreet" 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 ubc.`community_id` = #{streetId}
+ 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="getDataByStreetExp" resultType="com.ycl.dto.statistics.CategoryDto">
+ SELECT
+ ubc.community_id id,
+ t5.region_name NAME
+ 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.community_id
+ </select>
+
+
+
+
+<!-- 鎸夌偣浣嶇粺璁�-->
+ <select id="getDataBySite" resultType="java.lang.String">
+ SELECT
+ ubc.site
+ 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
+ limit #{currentPage}, #{pageSize}
+ </select>
+ <select id="getStatusDataBySite" 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.site = #{site}
+ </select>
+ <select id="getDataBySiteExp" resultType="java.lang.String">
+ SELECT
+ ubc.site
+ 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.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>
+
+
+
+
+<!-- 鍒嗛〉鏁伴噺-->
+ <select id="getTotalByType" resultType="java.lang.Integer">
+ 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
+ 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
+ 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
+ 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