From 679dfe8a68fe56100e708f112c1060d661d7b136 Mon Sep 17 00:00:00 2001
From: huangzhen <867127663@qq.com>
Date: 星期五, 30 九月 2022 16:41:03 +0800
Subject: [PATCH] 完成SPI数据提供接口

---
 src/main/resources/mybatis/doublePrevention/PreventRiskDangerInfoMapper.xml |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/src/main/resources/mybatis/doublePrevention/PreventRiskDangerInfoMapper.xml b/src/main/resources/mybatis/doublePrevention/PreventRiskDangerInfoMapper.xml
index 880f172..44f0894 100644
--- a/src/main/resources/mybatis/doublePrevention/PreventRiskDangerInfoMapper.xml
+++ b/src/main/resources/mybatis/doublePrevention/PreventRiskDangerInfoMapper.xml
@@ -48,5 +48,32 @@
         delete from prevent_risk_danger_info where danger_check_point_id = #{id}
     </delete>
 
+    <resultMap id="listDangerResultCountByTimeResultMap" type="com.ruoyi.doublePrevention.entity.dto.DataCountDangerResultRespDO">
+        <result property="riskCount" column="risk_count" />
+        <result property="deathCount" column="death_count" />
+        <result property="heavyInjureCount" column="heavy_injure_count" />
+        <result property="lightInjureCount" column="light_injure_count" />
+    </resultMap>
+
+    <select id="listDangerResultCountByTime"  resultMap="listDangerResultCountByTimeResultMap">
+        select
+            count(id) risk_count,
+            IFNULL(sum(CASE WHEN danger_result='2' then 1 else 0 END),0) light_injure_count,
+            IFNULL(sum(CASE WHEN danger_result='3' then 1 else 0 END),0) heavy_injure_count,
+            IFNULL(sum(CASE WHEN danger_result='4' then 1 else 0 END),0) death_count
+        from (SELECT p.id,p.rectify_dept_id,p.examine_create_time,p.whether_danger,p.examine_status,i.danger_check_point_id,i.danger_result
+              from tr_hidden_danger_check_point as p , prevent_risk_danger_info i WHERE p.id = i.danger_check_point_id) as t
+        WHERE whether_danger = 1
+          and examine_status = 1
+          and examine_create_time >= #{startTime}
+          and examine_create_time &lt;= #{endTime}
+        <if test="depIds != null and depIds.size() > 0">
+            and rectify_dept_id in (
+            <foreach collection="depIds"  item="depId" index="index" separator=",">
+                #{depId}
+            </foreach> )
+        </if>
+    </select>
+
 </mapper>
 

--
Gitblit v1.9.2