<?xml version="1.0" encoding="UTF-8" ?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
<mapper namespace="com.ruoyi.doublePrevention.repository.TrHiddenDangerCheckPointRepository">
|
<resultMap id="BaseFields" type="com.ruoyi.doublePrevention.entity.TrHiddenDangerCheckPoint">
|
<result property="id" column="id"/>
|
<result property="checkPointId" column="check_point_id"/>
|
<result property="checkId" column="check_id"/>
|
<result property="createBy" column="create_by"/>
|
<result property="createTime" column="create_time"/>
|
<result property="updateBy" column="update_by"/>
|
<result property="updateTime" column="update_time"/>
|
<result property="remark" column="remark"/>
|
<result property="whetherDanger" column="whether_danger"/>
|
<result property="dangerName" column="danger_name"/>
|
<result property="dangerDescription" column="danger_description"/>
|
<result property="dangerLevel" column="danger_level"/>
|
<result property="troubleTypeId" column="trouble_type_id"/>
|
<result property="troubleTypeName" column="trouble_type_name"/>
|
<result property="checkTime" column="check_time"/>
|
<result property="preRectifyPhoto" column="pre_rectify_photo"/>
|
<result property="registerUserId" column="register_user_id"/>
|
<result property="registerUserName" column="register_user_name"/>
|
<result property="registerCreateTime" column="register_create_time"/>
|
<result property="registerSubmitTime" column="register_submit_time"/>
|
<result property="judgeUserId" column="judge_user_id"/>
|
<result property="judgeUserName" column="judge_user_name"/>
|
<result property="judgeCreateTime" column="judge_create_time"/>
|
<result property="judgeCreateUserId" column="judge_create_user_id"/>
|
<result property="dangerSources" column="danger_sources"/>
|
<result property="reportStatus" column="report_status"/>
|
<result property="examineUserId" column="examine_user_id"/>
|
<result property="examineUserName" column="examine_user_name"/>
|
<result property="examineStatus" column="examine_status"/>
|
<result property="examineOpinion" column="examine_opinion"/>
|
<result property="examineResult" column="examine_result"/>
|
<result property="examineCreateTime" column="examine_create_time"/>
|
<result property="treatMeasure" column="treat_measure"/>
|
<result property="rectifyUserId" column="rectify_user_id"/>
|
<result property="rectifyUserName" column="rectify_user_name"/>
|
<result property="rectifyDeptId" column="rectify_dept_id"/>
|
<result property="rectifyDeptName" column="rectify_dept_name"/>
|
<result property="rectifyDeadlineTime" column="rectify_deadline_time"/>
|
<result property="rectifyType" column="rectify_type"/>
|
<result property="rectifyAttachment" column="rectify_attachment"/>
|
<result property="rectifyMeasure" column="rectify_measure"/>
|
<result property="rectifyCondition" column="rectify_condition"/>
|
<result property="rectifyFund" column="rectify_fund"/>
|
<result property="rectifyCompleteTime" column="rectify_complete_time"/>
|
<result property="rectifyStatus" column="rectify_status"/>
|
<result property="rectifyCreateTime" column="rectify_create_time"/>
|
<result property="acceptUserId" column="accept_user_id"/>
|
<result property="acceptUserName" column="accept_user_name"/>
|
<result property="postRectifyPhoto" column="post_rectify_photo"/>
|
<result property="acceptResult" column="accept_result"/>
|
<result property="acceptOpinion" column="accept_opinion"/>
|
<result property="acceptFile" column="accept_file"/>
|
<result property="acceptCreateTime" column="accept_create_time"/>
|
<result property="acceptStatus" column="accept_status"/>
|
<result property="stage" column="stage"/>
|
<result property="scheduleCheckStatus" column="schedule_check_status"/>
|
<result property="checkType" column="check_type"/>
|
<result property="companyId" column="company_id"/>
|
</resultMap>
|
|
|
|
<resultMap id="ListDangerLevelCountByTime" type="com.ruoyi.doublePrevention.entity.dto.DataCountDangerLevelRespDO">
|
<result property="heavyRiskCount" column="heavy_risk_count" />
|
<result property="lightRiskCount" column="light_risk_count" />
|
</resultMap>
|
<select id="listDangerLevelCountByTime" resultMap="ListDangerLevelCountByTime">
|
select
|
IFNULL(sum(CASE WHEN danger_level='0' then 1 else 0 END),0) light_risk_count,
|
IFNULL(sum(CASE WHEN danger_level='1' then 1 else 0 END),0) heavy_risk_count
|
from tr_hidden_danger_check_point
|
WHERE whether_danger = '1'
|
and examine_status = '1'
|
and examine_create_time >= #{startTime}
|
and examine_create_time <= #{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>
|
|
|
<resultMap id="ListDangerLevelRectifiedCountByTime" type="com.ruoyi.doublePrevention.entity.dto.DataCountDangerLevelRectifiedRespDO">
|
<result property="heavyRiskRectifyCount" column="heavy_risk_rectify_count" />
|
<result property="lightRiskRectifyCount" column="light_risk_rectify_count" />
|
</resultMap>
|
<select id="listDangerLevelRectifiedCountByTime" resultMap="ListDangerLevelRectifiedCountByTime">
|
select
|
IFNULL(sum(CASE WHEN danger_level='0' then 1 else 0 END),0) light_risk_rectify_count,
|
IFNULL(sum(CASE WHEN danger_level='1' then 1 else 0 END),0) heavy_risk_rectify_count
|
from tr_hidden_danger_check_point
|
WHERE whether_danger = '1'
|
and examine_status = '1'
|
and accept_status = '1'
|
and accept_create_time >= #{startTime}
|
and accept_create_time <= #{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>
|
|
|
<!-- List<TroubleDataRespDTO> getSPIData(SPIDataReqBO spiDataReqBO);-->
|
<select id="getSPIData" resultType="com.ruoyi.doublePrevention.entity.SPI.TroubleData">
|
SELECT
|
DATE_FORMAT(register_create_time, '%Y-%m') time, sum(1) count,
|
sum(case when rectify_status = '1' then 1 else 0 end) rectifyFinish,
|
sum(case when rectify_status = '0' then 1 else 0 end) rectifyNotFinish,
|
sum(case when accept_result = '1' then 1 else 0 end) accept,
|
sum(case when danger_level = '0' then 1 else 0 end) generalDanger,
|
sum(case when danger_level = '1' then 1 else 0 end) majorDanger
|
FROM tr_hidden_danger_check_point
|
WHERE whether_danger =1 and examine_status =1 and register_create_time >= #{spiDataReqBO.startTime} and #{spiDataReqBO.endTime} >= register_create_time and whether_danger = 1
|
GROUP BY time
|
ORDER BY time ASC
|
</select>
|
|
<!-- TroubleLevel getTroubleLevel(SPIDataReqBO spiDataReqBO);-->
|
<select id="getTroubleLevel" resultType="com.ruoyi.doublePrevention.entity.SPI.TroubleLevel">
|
select
|
sum(case when trouble_type_name = 'A级隐患' then 1 else 0 end) A,
|
sum(case when trouble_type_name = 'B级隐患' then 1 else 0 end) B,
|
sum(case when trouble_type_name = 'C级隐患' then 1 else 0 end) C,
|
sum(case when rectify_status = '1' then 1 else 0 end) rectifyFinish,
|
sum(case when rectify_status = '0' then 1 else 0 end) rectifyNotFinish
|
from tr_hidden_danger_check_point
|
WHERE whether_danger =1 and examine_status =1 and YEAR(register_create_time) = #{spiDataReqBO.year}
|
<if test="spiDataReqBO.month != null and spiDataReqBO.month != ''">
|
AND MONTH(register_create_time) = #{spiDataReqBO.month}
|
</if>
|
</select>
|
</mapper>
|