From 88ea54cb6460f1ff3c762c9f477f89329f5c5986 Mon Sep 17 00:00:00 2001
From: zhouxiantao <1026371446@qq.com>
Date: Fri, 25 Oct 2024 16:12:46 +0800
Subject: [PATCH] fix:解纷态势-根据最新原型设计重新计算本级数量

---
 dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml |   71 +++++++++++++++++++++++++++++------
 1 files changed, 58 insertions(+), 13 deletions(-)

diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml
index 97be16f..2cd8bc4 100644
--- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml
+++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml
@@ -358,16 +358,59 @@
                     and (DATE_FORMAT(b.file_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{terms.fileStart}
                     and DATE_FORMAT(b.file_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{terms.fileEnd})
                 </if>
-                <if test="terms.queCity != null and terms.queCity !='' and terms.statistics != null">
-                    and ((b.mediate_unit_id is not null and c.city = #{terms.queCity})
-                    or (b.mediate_unit_id is null and a.que_city = #{terms.queCity}))
+                <if test='terms.queCity != null and terms.queCity !="" and terms.statistics != null and terms.areaType == "1"'>
+                    and (b.mediate_unit_id is not null and c.city = #{terms.queCity}
+                    <if test="terms.unitGrades != null and terms.unitGrades.size > 0">
+                        and c.unit_grade in
+                        <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")">
+                            #{unitGrade}
+                        </foreach>
+                    </if>
+                    )
                 </if>
-                <if test="terms.queArea != null and terms.queArea !='' and terms.statistics != null">
-                    and ((b.mediate_unit_id is not null and c.area = #{terms.queArea})
-                    or (b.mediate_unit_id is null and a.que_area = #{terms.queArea}))
+                <if test='terms.queCity != null and terms.queCity !="" and terms.statistics != null and terms.areaType != "1"'>
+                    and ((b.mediate_unit_id is not null and c.city = #{terms.queCity}
+                    <if test="terms.unitGrades != null and terms.unitGrades.size > 0">
+                        and c.unit_grade in
+                        <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator=","
+                                 close=")">
+                            #{unitGrade}
+                        </foreach>
+                    </if>)
+                    or (b.mediate_unit_id is null and a.que_city = #{terms.queCity})
+                    )
+                </if>
+                <if test='terms.queArea != null and terms.queArea !="" and terms.statistics != null and terms.areaType == "2"'>
+                    and (b.mediate_unit_id is not null and c.area = #{terms.queArea}
+                    <if test="terms.unitGrades != null and terms.unitGrades.size > 0">
+                        and c.unit_grade in
+                        <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")">
+                            #{unitGrade}
+                        </foreach>
+                    </if>
+                    )
+                </if>
+                <if test='terms.queArea != null and terms.queArea !="" and terms.statistics != null and terms.areaType != "2"'>
+                    and ((b.mediate_unit_id is not null and c.area = #{terms.queArea}
+                    <if test="terms.unitGrades != null and terms.unitGrades.size > 0">
+                        and c.unit_grade in
+                        <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")">
+                            #{unitGrade}
+                        </foreach>
+                    </if>
+                    )
+                    or (b.mediate_unit_id is null and a.que_area = #{terms.queArea})
+                    )
                 </if>
                 <if test="terms.queRoad != null and terms.queRoad !='' and terms.statistics != null">
-                    and ((b.mediate_unit_id is not null and c.road = #{terms.queRoad})
+                    and ((b.mediate_unit_id is not null and c.road = #{terms.queRoad}
+                    <if test="terms.unitGrades != null and terms.unitGrades.size > 0">
+                        and c.unit_grade in
+                        <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")">
+                            #{unitGrade}
+                        </foreach>
+                    </if>
+                    )
                     or (b.mediate_unit_id is null and a.que_road = #{terms.queRoad}))
                 </if>
                 <if test="terms.isArea != null and terms.isArea !=''">
@@ -850,13 +893,16 @@
     <!--  统计分析(区域)  -->
     <select id="statisticsArea" resultType="cn.huge.module.cases.domain.dto.CaseStatisticsAreaDTO">
         SELECT
-        <if test="terms.areaType == null or terms.areaType ==''">
-            IF(c.area is null,a.que_area,c.area) as areaCode,IF(c.area_name is null,a.que_area_name,c.area_name) as areaName,
-        </if>
-        <if test='terms.areaType != null and terms.areaType =="1"'>
-            IF(c.area is null,a.que_area,c.area) as areaCode,IF(c.area_name is null,a.que_area_name,c.area_name) as areaName,
+        <if test='terms.areaType == null or terms.areaType =="1"'>
+            IF(c.area is null,a.que_city,c.city) as areaCode,IF(c.city_name is null,a.que_city_name,c.city_name) as areaName,
         </if>
         <if test='terms.areaType != null and terms.areaType =="2"'>
+            IF(c.area is null,a.que_area,c.area) as areaCode,IF(c.area_name is null,a.que_area_name,c.area_name) as areaName,
+        </if>
+        <if test='terms.areaType != null and terms.areaType =="3"'>
+            IF(c.road is null,a.que_road,c.road) as areaCode,IF(c.road_name is null,a.que_road_name,c.road_name) as areaName,
+        </if>
+        <if test='terms.areaType != null and terms.areaType =="4"'>
             IF(c.road is null,a.que_road,c.road) as areaCode,IF(c.road_name is null,a.que_road_name,c.road_name) as areaName,
         </if>
         c.unit_grade as unitGrade,
@@ -871,7 +917,6 @@
         LEFT JOIN dyh_ct_unit c ON b.mediate_unit_id = c.id
         <include refid="where-part-all"/>
         group by areaCode
-
     </select>
     <!--  统计分析(基础)  -->
     <select id="statisticsBase" resultType="cn.huge.module.cases.domain.dto.CaseStatisticsBaseDTO">

--
Gitblit v1.8.0