From aa2051a2327c079105110f5424f3a44ffaa0c7bb Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期五, 25 八月 2023 10:11:08 +0800
Subject: [PATCH] 延期整改

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

diff --git a/src/main/resources/mybatis/doublePrevention/PreventRiskDangerInfoMapper.xml b/src/main/resources/mybatis/doublePrevention/PreventRiskDangerInfoMapper.xml
index bcdb4be..d1bfea4 100644
--- a/src/main/resources/mybatis/doublePrevention/PreventRiskDangerInfoMapper.xml
+++ b/src/main/resources/mybatis/doublePrevention/PreventRiskDangerInfoMapper.xml
@@ -37,7 +37,7 @@
             danger_reason = #{dangerReason},
             hazard_danger_type = #{hazardDangerType},
             danger_state = #{dangerState},
-            danger_result =#{dangerResult}
+            danger_result =#{dangerResult},
             timeout_flag = #{timeoutFlag},
             update_report_data_time = #{updateReportDataTime},
             report_status = #{reportStatus},
@@ -50,5 +50,65 @@
         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>
+
+<!--    int updateDangerInfoState(PreventRiskDangerInfo dangerInfo);-->
+    <update id="updateDangerInfoState">
+        update prevent_risk_danger_info set
+            danger_state = #{dangerState},
+            update_report_data_time = #{updateReportDataTime},
+            report_status = #{reportStatus},
+            report_switch = #{reportSwitch}
+        where danger_check_point_id = #{dangerCheckPointId}
+    </update>
+
+
+<!--    List<PreventRiskDangerInfo> listReportDanger();-->
+    <select id="listReportDanger" resultMap="BaseResultMap">
+<!--        select * from prevent_risk_danger_info-->
+<!--        where report_switch = 0 and (update_report_data_time > report_time or report_time is null) and (hazard_code !='' or hazard_code != null )-->
+        select * from prevent_risk_danger_info
+        where report_switch = 0 and (update_report_data_time > report_time or report_time is null) and (hazard_code !='' or hazard_code != null) and danger_state = 9
+    </select>
+
+<!--    PreventRiskDangerInfo updateDangerInfoReportStatus(HandlerReportParam handlerReportParam);-->
+    <select id="updateDangerInfoReportStatus">
+        update prevent_risk_danger_info set
+            report_status =  #{reportStatus},
+            report_time = #{reportTime}
+        where id = #{id}
+    </select>
+
+<!--    PreventRiskDangerInfo getByHiddenDangerId(Long id);resultType="com.ruoyi.doublePrevention.entity.PreventRiskDangerInfo"-->
+    <select id="getByHiddenDangerId" resultMap="BaseResultMap">
+        select * from prevent_risk_danger_info
+        where danger_check_point_id = #{id}
+    </select>
 </mapper>
 
+

--
Gitblit v1.9.2