双重预防项目-国泰新华二开定制版
16639036659
2024-06-18 4fb65d8e3c5fc8ddb8882a355cd31ecb9d51f3d9
src/main/resources/mybatis/doublePrevention/TrHiddenDangerCheckPointMapper.xml
@@ -108,4 +108,34 @@
          </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>