zhangfeng
2023-07-27 cc3ddfda6bfb9a2aa0cd55073e8864320daf1f20
src/main/java/com/gk/hotwork/Mapper/mybatis/InspectionHiddenDangerMapper.xml
@@ -16,34 +16,56 @@
    </update>
    <select id="selectPages" resultType="com.gk.hotwork.Domain.SafetySelfInspection">
    <select id="selectPages" resultType="com.gk.hotwork.Domain.SafetySelfInspectionDO">
        SELECT
            s.*
        l.*
        FROM
            safety_self_inspection s
            LEFT JOIN inspection_hidden_danger h ON s.id = h.self_inspection_id
            left join company as co on s.checked_company_id = co.id
        (
        SELECT
        t.*,
        ( CASE WHEN t.unrectifyCount = 0 THEN -1 WHEN t.unrectifyCount = t.hdTocalCount THEN 2 ELSE 1 END ) rectificationStatus
        FROM
        (
        SELECT
        s.*,
        count( h.`status` = -1 OR NULL ) unRectifyCount,
        count( h.`status` = 1 OR NULL ) rectifyCount,
        count( h.`status` ) hdTocalCount,
        count( h.LEVEL = 1 OR NULL ) sameAsCount,
        count( h.LEVEL = 2 OR NULL ) majorCount
        FROM
        safety_self_inspection s
        LEFT JOIN inspection_hidden_danger h ON s.id = h.self_inspection_id
        WHERE
            s.valid_flag = 1
          AND h.valid_flag = 1
          AND h.id IS NOT NULL
        s.valid_flag = 1
        AND h.valid_flag = 1
        AND h.id IS NOT NULL
        GROUP BY
        s.id
        ) t
        ) l
        LEFT JOIN company AS co ON l.checked_company_id = co.id
        where 1=1
        <if test="params.inspectionName != null  and params.inspectionName != ''">
            and s.inspection_name like concat("%",#{params.inspectionName},"%")
            and l.inspection_name like concat("%",#{params.inspectionName},"%")
        </if>
        <if test="params.checkedCompanyId != null and params.checkedCompanyId != ''">
            and s.checked_company_id like concat("%",#{params.checkedCompanyId},"%")
            and l.checked_company_id = #{params.checkedCompanyId}
        </if>
        <if test="params.checkedCompanyName != null and params.checkedCompanyName != ''">
            and s.checked_company_name like concat("%",#{params.checkedCompanyName},"%")
            and l.checked_company_name like concat("%",#{params.checkedCompanyName},"%")
        </if>
        <if test="params.flag != null  and params.flag != '' ">
            and s.flag = #{params.flag}
            and l.flag = #{params.flag}
        </if>
        <if test="params.rectificationStatus != null  and params.rectificationStatus != '' ">
            and l.rectificationStatus = #{params.rectificationStatus}
        </if>
        <if test="params.inspectionStartTime != null and params.inspectionStartTime != ''" >
            and s.inspection_time <![CDATA[ >= ]]> #{params.inspectionStartTime}
            and l.inspection_time <![CDATA[ >= ]]> #{params.inspectionStartTime}
        </if>
        <if test="params.inspectionEndTime != null and params.inspectionEndTime != ''" >
            and s.inspection_time <![CDATA[ <= ]]> #{params.inspectionEndTime}
            and l.inspection_time <![CDATA[ <= ]]> #{params.inspectionEndTime}
        </if>
        <if test="params.province != null and params.province != ''" >
            and co.province = #{params.province}
@@ -54,9 +76,7 @@
        <if test="params.area != null and params.area != ''" >
            and co.area = #{params.area}
        </if>
        GROUP BY
            s.id
        ORDER BY s.create_time
        ORDER BY l.create_time
    </select>
    <select id="inspectionHdangerlist" resultType="com.gk.hotwork.Domain.InspectionHiddenDanger">
        SELECT