From 7815a3d87a3f38e22b1cb3b62d20f43b43e6664c Mon Sep 17 00:00:00 2001
From: 101captain <237651143@qq.com>
Date: 星期三, 24 十一月 2021 10:03:53 +0800
Subject: [PATCH] 1124死亡管理相关功能提交

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComSwSafetyWorkRecordMapper.xml |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComSwSafetyWorkRecordMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComSwSafetyWorkRecordMapper.xml
index 3a4b4be..f831edf 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComSwSafetyWorkRecordMapper.xml
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComSwSafetyWorkRecordMapper.xml
@@ -62,22 +62,22 @@
 
     <select id="patrolRecordStatistics" resultType="com.panzhihua.common.model.vos.community.ComSwPatrolRecordStatisticsVO">
         select count(id) as patrolRecordTotal
-             ,(select count(id) from com_sw_patrol_record where community_id = #{communityId} and patrol_type LIKE concat('%','1','%')) as huoTotal
-             ,(select count(id) from com_sw_patrol_record where community_id = #{communityId} and patrol_type LIKE concat('%','2','%')) as xunTotal
-             ,(select count(id) from com_sw_patrol_record where community_id = #{communityId} and patrol_type LIKE concat('%','3','%')) as yiTotal
-             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_safety_work_record t2 on t1.report_id = t2.id where t.community_id = #{communityId}) as safetyWorkTotal
-             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where t.community_id = #{communityId}) as dangerTotal
-             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where t.community_id = #{communityId} and status = '3') as handledDangerTotal
-             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where t.community_id = #{communityId} and danger_type like CONCAT('%','1','%')) as huoDangerTotal
-             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where t.community_id = #{communityId} and danger_type like CONCAT('%','2','%')) as xunDangerTotal
-             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where t.community_id = #{communityId} and danger_type like CONCAT('%','3','%')) as yiDangerTotal
-             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where t.community_id = #{communityId} and danger_type like CONCAT('%','1','%') and status = '3' ) as huoHandledDangerTotal
-             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where t.community_id = #{communityId} and danger_type like CONCAT('%','1','%') and status in ('1','2')) as huoHandlingDangerTotal
-             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where t.community_id = #{communityId} and danger_type like CONCAT('%','2','%') and status = '3' ) as xunHandledDangerTotal
-             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where t.community_id = #{communityId} and danger_type like CONCAT('%','2','%') and status in ('1','2')) as xunHandlingDangerTotal
-             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where t.community_id = #{communityId} and danger_type like CONCAT('%','3','%') and status = '3' ) as yiHandledDangerTotal
-             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where t.community_id = #{communityId} and danger_type like CONCAT('%','3','%') and status in ('1','2')) as yiHandlingDangerTotal
-        from com_sw_patrol_record as cmp where community_id = #{communityId}
+             ,(select count(id) from com_sw_patrol_record where 1=1 <if test="communityId !=null and communityId !=0"> and  community_id = #{communityId} </if> and patrol_type LIKE concat('%','1','%')) as huoTotal
+             ,(select count(id) from com_sw_patrol_record where 1=1 <if test="communityId !=null and communityId !=0"> and  community_id = #{communityId} </if> and patrol_type LIKE concat('%','2','%')) as xunTotal
+             ,(select count(id) from com_sw_patrol_record where 1=1 <if test="communityId !=null and communityId !=0"> and  community_id = #{communityId} </if> and patrol_type LIKE concat('%','3','%')) as yiTotal
+             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_safety_work_record t2 on t1.report_id = t2.id where 1=1 <if test="communityId !=null and communityId !=0"> and  t.community_id = #{communityId} </if>) as safetyWorkTotal
+             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where 1=1 <if test="communityId !=null and communityId !=0"> and  t.community_id = #{communityId} </if>) as dangerTotal
+             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where 1=1 <if test="communityId !=null and communityId !=0"> and  t.community_id = #{communityId} </if> and status = '3') as handledDangerTotal
+             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where 1=1 <if test="communityId !=null and communityId !=0"> and  t.community_id = #{communityId} </if> and danger_type like CONCAT('%','1','%')) as huoDangerTotal
+             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where 1=1 <if test="communityId !=null and communityId !=0"> and  t.community_id = #{communityId} </if> and danger_type like CONCAT('%','2','%')) as xunDangerTotal
+             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where 1=1 <if test="communityId !=null and communityId !=0"> and  t.community_id = #{communityId} </if> and danger_type like CONCAT('%','3','%')) as yiDangerTotal
+             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where 1=1 <if test="communityId !=null and communityId !=0"> and  t.community_id = #{communityId} </if> and danger_type like CONCAT('%','1','%') and status = '3' ) as huoHandledDangerTotal
+             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where 1=1 <if test="communityId !=null and communityId !=0"> and  t.community_id = #{communityId} </if> and danger_type like CONCAT('%','1','%') and status in ('1','2')) as huoHandlingDangerTotal
+             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where 1=1 <if test="communityId !=null and communityId !=0"> and  t.community_id = #{communityId} </if> and danger_type like CONCAT('%','2','%') and status = '3' ) as xunHandledDangerTotal
+             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where 1=1 <if test="communityId !=null and communityId !=0"> and  t.community_id = #{communityId} </if> and danger_type like CONCAT('%','2','%') and status in ('1','2')) as xunHandlingDangerTotal
+             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where 1=1 <if test="communityId !=null and communityId !=0"> and  t.community_id = #{communityId} </if> and danger_type like CONCAT('%','3','%') and status = '3' ) as yiHandledDangerTotal
+             ,(select count(t2.id) from com_sw_patrol_record t INNER JOIN com_sw_patrol_record_report t1  on t.id = t1.patrol_record_id INNER JOIN com_sw_danger_report t2 on t1.report_id = t2.id where 1=1 <if test="communityId !=null and communityId !=0"> and  t.community_id = #{communityId} </if> and danger_type like CONCAT('%','3','%') and status in ('1','2')) as yiHandlingDangerTotal
+        from com_sw_patrol_record as cmp where 1=1 <if test="communityId !=null and communityId !=0"> and  community_id = #{communityId} </if>
     </select>
 
 </mapper>
\ No newline at end of file

--
Gitblit v1.7.1