101captain
2021-11-24 30eced4922fd71e126f7aa3ba9c0dc58ee346471
Merge branch 'zhaozhengjie1104' into test
1个文件已修改
32 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComSwSafetyWorkRecordMapper.xml 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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>