From e79d8c8f9679839bf983341fe2cf3212e1bb3001 Mon Sep 17 00:00:00 2001
From: wangwh <2397901735@qq.com>
Date: Mon, 28 Oct 2024 14:44:33 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/gzdyh_test' into gzdyh_test

---
 dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml |  186 +++++++++++++++++++++++++++++++++++----------
 1 files changed, 143 insertions(+), 43 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 7edc11c..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
@@ -48,6 +48,7 @@
         <result property="canalName" column="canal_name"/>
         <result property="visitWay" column="visit_way"/>
         <result property="visitWayName" column="visit_way_name"/>
+        <result property="zxslStatus" column="zxsl_status"/>
         <result property="caseDes" column="case_des"/>
         <result property="caseClaim" column="case_claim"/>
         <result property="majorStatus" column="major_status"/>
@@ -72,6 +73,7 @@
         <result property="processName" column="process_name"/>
         <result property="infoProcess" column="info_process"/>
         <result property="infoProcessName" column="info_process_name"/>
+        <result property="partyShow" column="party_show"/>
         <result property="wantUnitId" column="want_unit_id"/>
         <result property="wantUnitName" column="want_unit_name"/>
         <result property="wantUserId" column="want_user_id"/>
@@ -185,6 +187,7 @@
         canal_name,
         visit_way,
         visit_way_name,
+        zxsl_status,
         case_des,
         case_claim,
         major_status,
@@ -213,6 +216,7 @@
         want_unit_name,
         want_user_id,
         want_user_name,
+        party_show,
         delete_status,
         cust_id,
         create_time,
@@ -256,6 +260,7 @@
         <if test="entity.canalName != null">canal_name = #{entity.canalName},</if>
         <if test="entity.visitWay != null">visit_way = #{entity.visitWay},</if>
         <if test="entity.visitWayName != null">visit_way_name = #{entity.visitWayName},</if>
+        <if test="entity.zxslStatus != null">zxsl_status = #{entity.zxslStatus},</if>
         <if test="entity.caseDes != null">case_des = #{entity.caseDes},</if>
         <if test="entity.caseClaim != null">case_claim = #{entity.caseClaim},</if>
         <if test="entity.majorStatus != null">major_status = #{entity.majorStatus},</if>
@@ -280,6 +285,7 @@
         <if test="entity.processName != null">process_name = #{entity.processName},</if>
         <if test="entity.infoProcess != null">info_process = #{entity.infoProcess},</if>
         <if test="entity.infoProcessName != null">info_process_name = #{entity.infoProcessName},</if>
+        <if test="entity.partyShow != null">party_show = #{entity.partyShow},</if>
         <if test="entity.wantUnitId != null">want_unit_id = #{entity.wantUnitId},</if>
         <if test="entity.wantUnitName != null">want_unit_name = #{entity.wantUnitName},</if>
         <if test="entity.wantUserId != null">want_user_id = #{entity.wantUserId},</if>
@@ -293,7 +299,13 @@
     <sql id="where-part-all">
         <if test="terms != null">
             <where>
-                and delete_status = 0
+                and a.delete_status = 0
+                <if test="terms.ids != null and terms.ids.size > 0">
+                    and a.id in
+                    <foreach collection="terms.ids" item="id" index="index" open="(" separator="," close=")">
+                        #{id}
+                    </foreach>
+                </if>
                 <if test="terms.status != null and terms.status !=''">
                     and a.status = #{terms.status}
                 </if>
@@ -312,6 +324,15 @@
                 <if test="terms.caseType != null and terms.caseType !=''">
                     and a.case_type = #{terms.caseType}
                 </if>
+                <if test="terms.caseTypeFirst != null and terms.caseTypeFirst !=''">
+                    and a.case_type_first = #{terms.caseTypeFirst}
+                </if>
+                <if test="terms.caseTypeFirstList != null and terms.caseTypeFirstList.size > 0">
+                    and a.case_type_first in
+                    <foreach collection="terms.caseTypeFirstList" item="caseTypeFirst" index="index" open="(" separator="," close=")">
+                        #{caseTypeFirst}
+                    </foreach>
+                </if>
                 <if test="terms.caseTypeName != null and terms.caseTypeName !=''">
                     and a.case_type_name = #{terms.caseTypeName}
                 </if>
@@ -319,7 +340,7 @@
                     and a.input_unit_id = #{terms.inputUnitId}
                 </if>
                 <if test="terms.inputUnitName != null and terms.inputUnitName !=''">
-                    and a.input_unit_name = #{terms.inputUnitName}
+                    and a.input_unit_name like CONCAT('%', #{terms.inputUnitName}, '%')
                 </if>
                 <if test="terms.visitTimeStart != null and terms.visitTimeStart !='' and terms.visitTimeEnd != null and terms.visitTimeEnd !=''">
                     and (DATE_FORMAT(a.visit_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{terms.visitTimeStart}
@@ -337,29 +358,78 @@
                     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.queProv != null and terms.queProv !=''">
-                    and a.que_prov = #{terms.queProv}
+                <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.queCity != null and terms.queCity !=''">
-                    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>)
+                    or (b.mediate_unit_id is null and a.que_city = #{terms.queCity})
+                    )
                 </if>
-                <if test="terms.queArea != null and terms.queArea !=''">
-                    and a.que_area = #{terms.queArea}
+                <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.queRoad != null and terms.queRoad !=''">
-                    and a.que_road = #{terms.queRoad}
+                <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}
+                    <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 !=''">
                     and a.que_city is not null and a.que_area is not null and a.que_road is not null
+                </if>
+                <if test="terms.queArea != null and terms.queArea !='' and terms.statistics == null">
+                    and a.que_area = #{terms.queArea}
+                </if>
+                <if test="terms.queRoad != null and terms.queRoad !='' and terms.statistics == null">
+                    and a.que_road = #{terms.queRoad}
                 </if>
                 <if test="terms.caseRef != null and terms.caseRef !=''">
                     and a.case_ref = #{terms.caseRef}
                 </if>
                 <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
-                    and a.plaintiffs = #{terms.plaintiffs}
+                    and a.plaintiffs like CONCAT('%', #{terms.plaintiffs}, '%')
                 </if>
                 <if test="terms.defendants != null and terms.defendants !=''">
-                    and a.defendants = #{terms.defendants}
+                    and a.defendants like CONCAT('%', #{terms.defendants}, '%')
                 </if>
                 <if test="terms.peopleNumStart != null and terms.peopleNumStart !=''">
                     and a.people_num  <![CDATA[ >= ]]> #{terms.peopleNumStart}
@@ -381,6 +451,15 @@
                 </if>
                 <if test="terms.assistUnitId != null and terms.assistUnitId !=''">
                     and b.assist_unit_id = #{terms.assistUnitId}
+                </if>
+                <if test="terms.mediateUnitName != null and terms.mediateUnitName !=''">
+                    and b.mediate_unit_name like CONCAT('%', #{terms.mediateUnitName}, '%')
+                </if>
+                <if test="terms.assistUnitName != null and terms.assistUnitName !=''">
+                    and b.assist_unit_name like CONCAT('%', #{terms.assistUnitName}, '%')
+                </if>
+                <if test="terms.mediResult != null and terms.mediResult !=''">
+                    and b.medi_result = #{terms.mediResult}
                 </if>
             </where>
         </if>
@@ -508,6 +587,9 @@
                 </if>
                 <if test="terms.visitWayName != null and terms.visitWayName !=''">
                     and visit_way_name = #{terms.visitWayName}
+                </if>
+                <if test="terms.zxslStatus != null and terms.zxslStatus !=''">
+                    and zxsl_status = #{terms.zxslStatus}
                 </if>
                 <if test="terms.caseDes != null and terms.caseDes !=''">
                     and case_des = #{terms.caseDes}
@@ -729,16 +811,19 @@
                     and t1.canal_name = #{terms.canalName}
                 </if>
                 <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
-                    and t1.plaintiffs = #{terms.plaintiffs}
+                    and t1.plaintiffs like CONCAT('%', #{terms.plaintiffs}, '%')
                 </if>
                 <if test="terms.defendants != null and terms.defendants !=''">
-                    and t1.defendants = #{terms.defendants}
+                    and t1.defendants like CONCAT('%', #{terms.defendants}, '%')
                 </if>
                 <if test="terms.statusName != null and terms.statusName !=''">
                     and t1.status_name = #{terms.statusName}
                 </if>
                 <if test="terms.mediResultName != null and terms.mediResultName !=''">
                     and t2.medi_result_name = #{terms.mediResultName}
+                </if>
+                <if test="terms.mediResult != null and terms.mediResult !=''">
+                    and t2.medi_result = #{terms.mediResult}
                 </if>
             </where>
         </if>
@@ -808,41 +893,38 @@
     <!--  统计分析(区域)  -->
     <select id="statisticsArea" resultType="cn.huge.module.cases.domain.dto.CaseStatisticsAreaDTO">
         SELECT
-        <if test="terms.areaType == null or terms.areaType ==''">
-            a.que_area as areaCode,a.que_area_name as areaName,
-        </if>
-        <if test='terms.areaType != null and terms.areaType =="1"'>
-            a.que_area as areaCode,a.que_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"'>
-            a.que_road as areaCode,a.que_road_name as areaName,
+            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,
         count(1) as caseNum,
-        sum(case when b.medi_result = '22_00025-1' then 1 else 0 end) as resolveNum,
-        sum(case when b.medi_result is null and a.info_process <![CDATA[ < ]]> 4 then 1 else 0 end) as resolveingNum,
-        sum(case when b.medi_result = '22_00025-2' then 1 else 0 end) as unResolveNum,
+        sum(case when b.medi_result = '22_00025-1' and a.info_process = 3 then 1 else 0 end) as resolveNum,
+        sum(case when a.info_process <![CDATA[ < ]]> 3 then 1 else 0 end) as resolveingNum,
+        sum(case when b.medi_result = '22_00025-2' and a.info_process = 3 then 1 else 0 end) as unResolveNum,
         sum(case when a.info_process = 4 then 1 else 0 end) as rejectNum
         FROM
-        dyh_case_info a LEFT JOIN dyh_case_info_unfold b on a.id = b.id
+        dyh_case_info a
+        inner JOIN dyh_case_info_unfold b on a.id = b.id
+        LEFT JOIN dyh_ct_unit c ON b.mediate_unit_id = c.id
         <include refid="where-part-all"/>
-        <if test="terms.areaType == null or terms.areaType ==''">
-            group by a.que_area
-        </if>
-        <if test='terms.areaType != null and terms.areaType =="1"'>
-            group by a.que_area
-        </if>
-        <if test='terms.areaType != null and terms.areaType =="2"'>
-            group by a.que_road
-        </if>
-
+        group by areaCode
     </select>
     <!--  统计分析(基础)  -->
     <select id="statisticsBase" resultType="cn.huge.module.cases.domain.dto.CaseStatisticsBaseDTO">
         SELECT
         count(1) as totalNum,
-        sum(case when b.medi_result = '22_00025-1' then 1 else 0 end) as resolveNum,
-        sum(case when b.medi_result is null and a.info_process <![CDATA[ < ]]> 4 then 1 else 0 end) as resolveingNum,
-        sum(case when b.medi_result = '22_00025-2' then 1 else 0 end) as unResolveNum,
+        sum(case when b.medi_result = '22_00025-1' and a.info_process = 3 then 1 else 0 end) as resolveNum,
+        sum(case when a.info_process <![CDATA[ < ]]> 3 then 1 else 0 end) as resolveingNum,
+        sum(case when b.medi_result = '22_00025-2' and a.info_process = 3 then 1 else 0 end) as unResolveNum,
         sum(case when a.case_level = 1 then 1 else 0 end) as oneLevelNum,
         sum(case when a.case_level = 2 then 1 else 0 end) as twoLevelNum,
         sum(case when a.case_level = 3 then 1 else 0 end) as threeLevelNum,
@@ -850,15 +932,31 @@
         sum(case when a.info_process = 3 then 1 else 0 end) as finishNum,
         sum(case when a.info_process = 4 then 1 else 0 end) as rejectNum
         FROM
-        dyh_case_info a LEFT JOIN dyh_case_info_unfold b on a.id = b.id
+        dyh_case_info a
+        inner JOIN dyh_case_info_unfold b on a.id = b.id
+        LEFT JOIN dyh_ct_unit c ON b.mediate_unit_id = c.id
         <include refid="where-part-all"/>
     </select>
+    <!--  统计分析(类型)  -->
+    <select id="statisticsTypeFirst" resultType="cn.huge.module.cases.domain.dto.CaseStatisticsTypeDTO">
+        SELECT
+        a.case_type_first as caseType,a.case_type_first_name as caseTypeName,count(1) as caseNum
+        FROM
+        dyh_case_info a
+        inner JOIN dyh_case_info_unfold b on a.id = b.id
+        LEFT JOIN dyh_ct_unit c ON b.mediate_unit_id = c.id
+        <include refid="where-part-all"/>
+        group by a.case_type_first
+    </select>
+
     <!--  统计分析(类型)  -->
     <select id="statisticsType" resultType="cn.huge.module.cases.domain.dto.CaseStatisticsTypeDTO">
         SELECT
         a.case_type as caseType,a.case_type_name as caseTypeName,count(1) as caseNum
         FROM
-        dyh_case_info a LEFT JOIN dyh_case_info_unfold b on a.id = b.id
+        dyh_case_info a
+        inner JOIN dyh_case_info_unfold b on a.id = b.id
+        LEFT JOIN dyh_ct_unit c ON b.mediate_unit_id = c.id
         <include refid="where-part-all"/>
         group by a.case_type
     </select>
@@ -867,12 +965,14 @@
     <select id="statisticsSource" resultType="cn.huge.module.cases.domain.dto.CaseStatisticsSourceDTO">
         SELECT
         a.canal,a.canal_name as canalName,count(1) as caseNum,
-        sum(case when b.medi_result = '22_00025-1' then 1 else 0 end) as resolveNum,
-        sum(case when b.medi_result is null and a.info_process <![CDATA[ < ]]> 4 then 1 else 0 end) as resolveingNum,
-        sum(case when b.medi_result = '22_00025-2' then 1 else 0 end) as unResolveNum,
+        sum(case when b.medi_result = '22_00025-1' and a.info_process = 3 then 1 else 0 end) as resolveNum,
+        sum(case when a.info_process <![CDATA[ < ]]> 3 then 1 else 0 end) as resolveingNum,
+        sum(case when b.medi_result = '22_00025-2' and a.info_process = 3 then 1 else 0 end) as unResolveNum,
         sum(case when a.info_process = 4 then 1 else 0 end) as rejectNum
         FROM
-        dyh_case_info a LEFT JOIN dyh_case_info_unfold b on a.id = b.id
+        dyh_case_info a
+        inner JOIN dyh_case_info_unfold b on a.id = b.id
+        LEFT JOIN dyh_ct_unit c ON b.mediate_unit_id = c.id
         <include refid="where-part-all"/>
         group by a.canal
     </select>

--
Gitblit v1.8.0