2025-01-16 16:16:53 +08:00
|
|
|
<?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.bonus.project.mapper.SecurityCheckMapper">
|
|
|
|
|
<insert id="addHiddenDangerTypeForm">
|
|
|
|
|
INSERT INTO yh_type_config
|
|
|
|
|
(name, type, create_user_name, create_time, create_user_id, is_active)
|
|
|
|
|
VALUES
|
|
|
|
|
(#{name}, #{type}, #{createUserName}, now(), #{createUserId}, 1)
|
|
|
|
|
</insert>
|
|
|
|
|
<insert id="addFileUpload">
|
|
|
|
|
INSERT INTO yh_file
|
|
|
|
|
(file_name, file_path, file_size, big_type, file_type, file_from, suffix , create_time, is_active)
|
|
|
|
|
VALUES
|
|
|
|
|
(#{fileName}, #{filePath}, #{fileSize}, #{bigType}, #{fileType}, #{id}, #{suffix}, now(), 1)
|
|
|
|
|
</insert>
|
|
|
|
|
<insert id="addSecurityCheckRecordForm" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
INSERT INTO yh_safety_record
|
|
|
|
|
(title, record_code, inspect_level, check_type, check_time, create_time, is_active)
|
|
|
|
|
VALUES
|
|
|
|
|
(#{title}, #{recordCode}, #{inspectLevel}, #{checkType}, #{checkTime}, now(), 1)
|
|
|
|
|
</insert>
|
|
|
|
|
<insert id="addPitfallDetaills" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
INSERT INTO yh_pitfall_detaills
|
|
|
|
|
(check_user_id, check_user_name, find_time, pro_id, pro_name, sub_id, sub_name, pitfall_type_id, pitfall_type_name,
|
|
|
|
|
pitfall_level_id, pitfall_level_name, correction_time, sub_person_id, sub_person_name, pitfall_description,
|
|
|
|
|
suggestion, dept_id, dept_name, user_id, user_name, sup_uuid)
|
|
|
|
|
VALUES
|
|
|
|
|
(#{checkUserId}, #{checkUserName}, #{findTime}, #{proId}, #{proName}, #{subId}, #{subName}, #{pitfallTypeId},
|
|
|
|
|
#{pitfallTypeName}, #{pitfallLevelId}, #{pitfallLevelName}, #{correctionTime}, #{subPersonId}, #{subPersonName},
|
|
|
|
|
#{pitfallDescription}, #{suggestion}, #{deptId}, #{deptName}, #{userId}, #{userName}, #{supUuid})
|
|
|
|
|
</insert>
|
|
|
|
|
<insert id="addHiddenDanger">
|
|
|
|
|
INSERT INTO yh_pitfall_info
|
|
|
|
|
(pitfall_id, pitfall_code, record_id, check_level_id, check_level_name, check_type, check_type_name, create_user_id,
|
|
|
|
|
create_user_name, create_time, accept_time, feedback_time, finsh_time, check_status, is_check, check_state,
|
|
|
|
|
is_delay, is_process, is_from, is_active, delay_check_state)
|
|
|
|
|
VALUES
|
|
|
|
|
(#{id}, #{pitfallCode}, #{recordCode}, #{checkLevel}, #{checkLevelName}, #{checkType}, #{checkTypeName}, #{createUserId},
|
|
|
|
|
#{createUserName}, now(), #{acceptTime}, #{feedbackTime}, #{finshTime}, 1, 0 , 0,
|
|
|
|
|
0, #{isProcess}, #{isFrom}, 1, 0)
|
|
|
|
|
</insert>
|
|
|
|
|
<update id="updateHiddenDangerTypeForm">
|
|
|
|
|
UPDATE yh_type_config
|
|
|
|
|
SET name = #{name},
|
|
|
|
|
update_time = NOW()
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateSecurityCheckRecordForm">
|
|
|
|
|
UPDATE yh_safety_record
|
|
|
|
|
SET title = #{title},
|
|
|
|
|
record_code = #{recordCode},
|
|
|
|
|
inspect_level = #{inspectLevel},
|
|
|
|
|
check_type = #{checkType},
|
|
|
|
|
check_time = #{checkTime},
|
|
|
|
|
update_time = NOW()
|
|
|
|
|
WHERE record_id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updatePitfallDetaills">
|
|
|
|
|
UPDATE yh_pitfall_detaills
|
|
|
|
|
SET duty_user_id = #{dutyUserId},
|
|
|
|
|
duty_user_name = #{dutyUserName},
|
|
|
|
|
generate_reason = #{generateReason},
|
|
|
|
|
correction_status = #{correctionStatus},
|
|
|
|
|
opinion = '',
|
|
|
|
|
remarks = ''
|
|
|
|
|
WHERE pitfall_id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateHiddenDangerRectification">
|
|
|
|
|
UPDATE yh_pitfall_info
|
|
|
|
|
SET is_check = #{isCheck},
|
|
|
|
|
check_state = '0',
|
|
|
|
|
feedback_time = #{rectificationFeedbackTime}
|
|
|
|
|
WHERE pitfall_id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateHiddenDangerRectifications">
|
|
|
|
|
<if test="isProcess == 1 or isProcess == '1'">
|
|
|
|
|
UPDATE yh_pitfall_info
|
|
|
|
|
SET check_state = #{checkState},
|
|
|
|
|
is_check = 2
|
|
|
|
|
WHERE pitfall_id = #{id}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isProcess == 0 or isProcess == '0'">
|
|
|
|
|
UPDATE yh_pitfall_info
|
|
|
|
|
SET check_status = #{checkStatus},
|
|
|
|
|
is_check = 2
|
|
|
|
|
WHERE pitfall_id = #{id}
|
|
|
|
|
</if>
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateSuggestionsForRectification">
|
|
|
|
|
UPDATE yh_pitfall_detaills
|
|
|
|
|
SET opinion = #{opinion},
|
|
|
|
|
remarks = #{remarks}
|
|
|
|
|
WHERE pitfall_id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="revocationHiddenDanger">
|
|
|
|
|
UPDATE yh_pitfall_info
|
|
|
|
|
SET is_check = 0,
|
|
|
|
|
check_state = 0
|
|
|
|
|
WHERE pitfall_id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateApplicationForExtension">
|
|
|
|
|
UPDATE yh_pitfall_info
|
|
|
|
|
SET delay_time = #{delayTime},
|
|
|
|
|
is_delay = '1',
|
|
|
|
|
delay_check_state = '0'
|
|
|
|
|
WHERE pitfall_id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateReasonForDelay">
|
|
|
|
|
UPDATE yh_pitfall_detaills
|
|
|
|
|
SET delay_reason = #{delayReason}
|
|
|
|
|
WHERE pitfall_id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateHiddenDangerStatus">
|
|
|
|
|
UPDATE yh_pitfall_info
|
|
|
|
|
SET check_status = #{checkStatus}
|
|
|
|
|
WHERE pitfall_id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateHiddenDangerDelay">
|
|
|
|
|
UPDATE yh_pitfall_info
|
|
|
|
|
SET is_check = '1'
|
|
|
|
|
WHERE pitfall_id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateDelayedAcceptance">
|
|
|
|
|
UPDATE yh_pitfall_info
|
|
|
|
|
SET is_delay = '0',
|
|
|
|
|
rejection_delay = #{rejectionDelay},
|
|
|
|
|
delay_time = null
|
|
|
|
|
WHERE pitfall_id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateDeferredAcceptancePassed">
|
|
|
|
|
UPDATE yh_pitfall_info
|
|
|
|
|
SET is_delay = '2',
|
|
|
|
|
rejection_delay = ''
|
|
|
|
|
WHERE pitfall_id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateDelayReason">
|
|
|
|
|
UPDATE yh_pitfall_detaills
|
|
|
|
|
SET delay_reason = ''
|
|
|
|
|
WHERE pitfall_id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="withdrawalOfExtension">
|
|
|
|
|
UPDATE yh_pitfall_info
|
|
|
|
|
SET is_delay = 0,
|
|
|
|
|
delay_time = null,
|
|
|
|
|
delay_check_state = 0
|
|
|
|
|
WHERE pitfall_id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<delete id="deleteHiddenDangerTypeForm">
|
|
|
|
|
UPDATE yh_type_config
|
|
|
|
|
SET is_active = 0
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
|
|
|
|
|
</delete>
|
|
|
|
|
<delete id="deleteFiles">
|
|
|
|
|
UPDATE yh_file
|
|
|
|
|
SET is_active = 0
|
|
|
|
|
WHERE file_id
|
|
|
|
|
IN
|
|
|
|
|
<foreach item="fileId" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{fileId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<select id="getHiddenDangerTypeList" resultType="com.bonus.common.safetycheck.SecurityCheckVo">
|
|
|
|
|
SELECT id AS id,
|
|
|
|
|
name AS name,
|
|
|
|
|
create_user_name AS createUserName,
|
|
|
|
|
create_time AS createTime
|
|
|
|
|
FROM yh_type_config
|
|
|
|
|
WHERE is_active = 1
|
|
|
|
|
<if test="name != null and name != ''">
|
|
|
|
|
AND name LIKE CONCAT('%', #{name}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createUserName != null and createUserName != ''">
|
|
|
|
|
AND create_user_name LIKE CONCAT('%', #{createUserName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createStartTime != null and createStartTime != '' and createEndTime != null and createEndTime != ''">
|
|
|
|
|
AND STR_TO_DATE(create_time, '%Y-%m-%d') BETWEEN STR_TO_DATE(#{createStartTime}, '%Y-%m-%d') AND STR_TO_DATE(#{createEndTime}, '%Y-%m-%d')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="type != null and type != ''">
|
|
|
|
|
AND type = #{type}
|
|
|
|
|
</if>
|
|
|
|
|
ORDER BY create_time DESC
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getHiddenDangerTypeForm" resultType="com.bonus.common.safetycheck.SecurityCheckVo">
|
|
|
|
|
SELECT id AS id,
|
|
|
|
|
name AS name
|
|
|
|
|
FROM yh_type_config
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getSecurityCheckRecordList" resultType="com.bonus.common.safetycheck.CheckRecordVo">
|
|
|
|
|
SELECT ysr.record_id AS id,
|
|
|
|
|
ysr.title AS title,
|
|
|
|
|
ysr.record_code AS recordCode,
|
|
|
|
|
sdd.dict_label AS inspectLevelName,
|
|
|
|
|
ysr.inspect_level AS inspectLevel,
|
|
|
|
|
sdd1.dict_label AS checkTypeName,
|
|
|
|
|
ysr.check_type AS checkType,
|
|
|
|
|
ysr.check_time AS checkTime
|
|
|
|
|
FROM yh_safety_record ysr
|
|
|
|
|
LEFT JOIN sys_dict_data sdd
|
|
|
|
|
ON ysr.inspect_level = sdd.dict_value AND sdd.dict_type = 'yh_inspect_level' AND
|
|
|
|
|
sdd.status = 0
|
|
|
|
|
LEFT JOIN sys_dict_data sdd1
|
|
|
|
|
ON ysr.check_type = sdd1.dict_value AND sdd1.dict_type = 'yh_check_type' AND sdd1.status = 0
|
|
|
|
|
WHERE ysr.is_active = 1
|
|
|
|
|
<if test="title != null and title != ''">
|
|
|
|
|
AND ysr.title LIKE CONCAT('%', #{title}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="recordCode != null and recordCode != ''">
|
|
|
|
|
AND ysr.record_code LIKE CONCAT('%', #{recordCode}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="inspectLevel != null and inspectLevel != ''">
|
|
|
|
|
AND ysr.inspect_level = #{inspectLevel}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="checkType != null and checkType != ''">
|
|
|
|
|
AND ysr.check_type = #{checkType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
|
|
AND STR_TO_DATE(ysr.check_time, '%Y-%m-%d') BETWEEN STR_TO_DATE(#{startTime}, '%Y-%m-%d') AND STR_TO_DATE(#{endTime}, '%Y-%m-%d')
|
|
|
|
|
</if>
|
|
|
|
|
ORDER BY ysr.create_time DESC
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectScenePhoto" resultType="com.bonus.common.safetycheck.FileVo">
|
|
|
|
|
SELECT
|
|
|
|
|
file_id AS fileId,
|
|
|
|
|
file_name AS fileName,
|
|
|
|
|
file_path AS filePath,
|
|
|
|
|
file_size AS fileSize
|
|
|
|
|
FROM yh_file
|
|
|
|
|
WHERE is_active = 1
|
|
|
|
|
AND big_type = 1
|
|
|
|
|
AND file_type = 1
|
|
|
|
|
AND file_from = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectAttachment" resultType="com.bonus.common.safetycheck.FileVo">
|
|
|
|
|
SELECT
|
|
|
|
|
file_id AS fileId,
|
|
|
|
|
file_name AS fileName,
|
|
|
|
|
file_path AS filePath,
|
|
|
|
|
file_size AS fileSize
|
|
|
|
|
FROM yh_file
|
|
|
|
|
WHERE is_active = 1
|
|
|
|
|
AND big_type = 1
|
|
|
|
|
AND file_type = 2
|
|
|
|
|
AND file_from = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getSecurityCheckRecordForm" resultType="com.bonus.common.safetycheck.CheckRecordVo">
|
|
|
|
|
SELECT ysr.record_id AS id,
|
|
|
|
|
ysr.title AS title,
|
|
|
|
|
ysr.record_code AS recordCode,
|
|
|
|
|
ysr.inspect_level AS inspectLevel,
|
|
|
|
|
ysr.check_type AS checkType,
|
|
|
|
|
ysr.check_time AS checkTime
|
|
|
|
|
FROM yh_safety_record ysr
|
|
|
|
|
WHERE ysr.is_active = 1
|
|
|
|
|
AND ysr.record_id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getHiddenDangerRectificationList"
|
|
|
|
|
resultType="com.bonus.common.safetycheck.HiddenProblemsFixVo">
|
|
|
|
|
SELECT ypi.pitfall_id as id,
|
|
|
|
|
ypi.pitfall_code AS pitfallCode,
|
|
|
|
|
ypd.pitfall_type_name AS pitfallTypeName,
|
|
|
|
|
ypd.pitfall_level_name AS pitfallLevelName,
|
|
|
|
|
sdd.dict_label AS isFrom,
|
|
|
|
|
ypd.find_time AS findTime,
|
|
|
|
|
sdd2.dict_label AS checkStatus,
|
|
|
|
|
ypi.check_status AS checkStatusId,
|
|
|
|
|
ypi.create_time AS createTime,
|
|
|
|
|
ypi.delay_check_state AS delayCheckState,
|
|
|
|
|
ypi.create_user_name AS createUserName,
|
|
|
|
|
sdd1.dict_label AS checkState,
|
|
|
|
|
ypi.task_id AS taskId,
|
|
|
|
|
ypi.proc_inst_id AS procInsId,
|
|
|
|
|
ypi.delay_task_id AS delayTaskId,
|
|
|
|
|
ypi.delay_proc_inst_id AS delayProcInsId,
|
2025-02-19 11:20:21 +08:00
|
|
|
#{dataType} as status,
|
2025-01-16 16:16:53 +08:00
|
|
|
ypi.check_state as intoStatus,
|
|
|
|
|
ypi.accept_time AS rectificationReceiveTime,
|
|
|
|
|
ypi.reject_reason AS rejectReason,
|
|
|
|
|
ypi.is_delay AS isDelayCheck,
|
|
|
|
|
ypi.rejection_delay AS rejectionDelay,
|
|
|
|
|
ypi.is_check AS isCheck
|
|
|
|
|
FROM yh_pitfall_info ypi
|
2025-02-19 11:20:21 +08:00
|
|
|
LEFT JOIN yh_pitfall_detaills ypd ON ypi.pitfall_id = ypd.pitfall_id
|
|
|
|
|
LEFT JOIN sys_dict_data sdd ON ypi.is_from = sdd.dict_value AND sdd.dict_type = 'yn_collection_source' AND sdd.status = 0
|
|
|
|
|
LEFT JOIN sys_dict_data sdd1 ON ypi.check_state = sdd1.dict_value AND sdd1.dict_type = 'sys_approval_state' AND sdd1.status = 0
|
|
|
|
|
LEFT JOIN sys_dict_data sdd2 ON ypi.check_status = sdd2.dict_value AND sdd2.dict_type = 'yn_check_status' AND sdd2.status = 0
|
|
|
|
|
WHERE ypi.is_active = 1 AND ypd.pro_id = #{proId}
|
2025-01-16 16:16:53 +08:00
|
|
|
<if test="pitfallTypeId != null and pitfallTypeId != ''">
|
|
|
|
|
AND ypd.pitfall_type_id = #{pitfallTypeId}
|
|
|
|
|
</if>
|
2025-02-19 11:20:21 +08:00
|
|
|
<if test='dataType==1'>
|
|
|
|
|
AND ypi.proc_inst_id IN (
|
|
|
|
|
<foreach collection="proInsId" item="item" separator=",">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="status==2 or status=='2'">
|
|
|
|
|
and ypi.check_state = #{status}
|
|
|
|
|
</if>
|
2025-01-16 16:16:53 +08:00
|
|
|
<if test="pitfallLevelId != null and pitfallLevelId != ''">
|
|
|
|
|
AND ypd.pitfall_level_id = #{pitfallLevelId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pitfallCode != null and pitfallCode != ''">
|
|
|
|
|
AND ypi.pitfall_code LIKE CONCAT('%', #{pitfallCode}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
|
|
AND STR_TO_DATE(ypd.find_time, '%Y-%m-%d') BETWEEN STR_TO_DATE(#{startTime}, '%Y-%m-%d') AND STR_TO_DATE(#{endTime}, '%Y-%m-%d')
|
|
|
|
|
</if>
|
|
|
|
|
ORDER BY ypi.pitfall_id DESC
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectUploadingFiles" resultType="com.bonus.common.safetycheck.FileVo">
|
|
|
|
|
SELECT
|
|
|
|
|
file_id AS fileId,
|
|
|
|
|
file_name AS fileName,
|
|
|
|
|
file_path AS filePath,
|
|
|
|
|
file_size AS fileSize
|
|
|
|
|
FROM yh_file
|
|
|
|
|
WHERE is_active = 1
|
|
|
|
|
AND big_type = #{bigType}
|
|
|
|
|
AND file_type = #{fileType}
|
|
|
|
|
AND file_from = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getHiddenDangerRectificationForm" resultType="com.bonus.common.safetycheck.NewHiddenDangerDto">
|
|
|
|
|
SELECT ypi.pitfall_id AS id,
|
|
|
|
|
ypi.pitfall_code AS pitfallCode,
|
|
|
|
|
ypi.record_id AS recordCode,
|
|
|
|
|
ypi.check_level_id AS checkLevel,
|
|
|
|
|
ypi.check_level_name AS checkLevelName,
|
|
|
|
|
ypi.check_type AS checkType,
|
|
|
|
|
ypi.check_type_name AS checkTypeName,
|
|
|
|
|
ypi.create_user_id AS createUserId,
|
|
|
|
|
ypi.create_user_name AS createUserName,
|
|
|
|
|
ypi.create_time AS createTime,
|
|
|
|
|
ypi.accept_time AS rectificationReceiveTime,
|
|
|
|
|
ypi.feedback_time AS rectificationFeedbackTime,
|
|
|
|
|
ypi.finsh_time AS finshTime,
|
|
|
|
|
sdd2.dict_label AS checkStatus,
|
|
|
|
|
ypi.is_check AS isCheck,
|
|
|
|
|
ypi.is_delay AS isDelay,
|
|
|
|
|
ypi.is_process AS isProcess,
|
|
|
|
|
ypi.delay_check_state AS delayCheckState,
|
|
|
|
|
ypi.is_from AS isFrom,
|
|
|
|
|
ypi.delay_time AS delayTime,
|
|
|
|
|
ypd.check_user_id AS checkUserId,
|
|
|
|
|
ypd.check_user_name AS checkUserName,
|
|
|
|
|
ypd.find_time AS findTime,
|
|
|
|
|
ypd.pro_id AS proId,
|
|
|
|
|
ypd.pro_name AS proName,
|
|
|
|
|
ypd.sub_id AS subId,
|
|
|
|
|
ypd.sub_name AS subName,
|
|
|
|
|
ypd.pitfall_type_id AS pitfallTypeId,
|
|
|
|
|
ypd.pitfall_type_name AS pitfallTypeName,
|
|
|
|
|
ypd.pitfall_level_id AS pitfallLevelId,
|
|
|
|
|
ypd.pitfall_level_name AS pitfallLevelName,
|
|
|
|
|
ypd.correction_time AS correctionTime,
|
|
|
|
|
ypd.sub_person_id AS subPersonId,
|
|
|
|
|
ypd.sub_person_name AS subPersonName,
|
|
|
|
|
ypd.pitfall_description AS pitfallDescription,
|
|
|
|
|
ypd.suggestion AS suggestion,
|
|
|
|
|
ypd.dept_id AS deptId,
|
|
|
|
|
ypd.dept_name AS deptName,
|
|
|
|
|
ypd.user_id AS userId,
|
|
|
|
|
ypd.user_name AS userName,
|
|
|
|
|
ypd.opinion AS opinion,
|
|
|
|
|
ypd.remarks AS remarks,
|
|
|
|
|
ypd.duty_user_id AS dutyUserId,
|
|
|
|
|
ypd.duty_user_name AS dutyUserName,
|
|
|
|
|
ypd.generate_reason AS generateReason,
|
|
|
|
|
ypd.correction_status AS correctionStatus,
|
|
|
|
|
ypd.delay_reason AS delayReason
|
|
|
|
|
FROM yh_pitfall_info ypi
|
|
|
|
|
LEFT JOIN yh_pitfall_detaills ypd on ypi.pitfall_id = ypd.pitfall_id
|
|
|
|
|
LEFT JOIN sys_dict_data sdd2
|
|
|
|
|
ON ypi.check_status = sdd2.dict_value AND sdd2.dict_type = 'yn_check_status' AND sdd2.status = 0
|
|
|
|
|
WHERE ypi.is_active = 1
|
|
|
|
|
AND ypi.pitfall_id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getHiddenDangerRectificationApprovalList"
|
|
|
|
|
resultType="com.bonus.common.safetycheck.HiddenDangerRectificationVo">
|
|
|
|
|
SELECT ypi.pitfall_id AS id,
|
|
|
|
|
ypi.pitfall_code AS pitfallCode,
|
|
|
|
|
ypd.pro_id AS proId,
|
|
|
|
|
ypd.pro_name AS proName,
|
|
|
|
|
ypd.sub_name AS subName,
|
|
|
|
|
ypi.check_level_id AS checkLevelId,
|
|
|
|
|
ypd.pitfall_type_name AS pitfallTypeName,
|
|
|
|
|
ypd.pitfall_level_name AS pitfallLevelName,
|
|
|
|
|
sdd.dict_label AS isFrom,
|
|
|
|
|
ypd.find_time AS findTime,
|
|
|
|
|
sdd2.dict_label AS checkStatus,
|
2025-02-19 11:20:21 +08:00
|
|
|
#{dataType} AS status,
|
2025-01-16 16:16:53 +08:00
|
|
|
ypi.check_state as intoStatus,
|
|
|
|
|
ypi.delay_check_state as delayCheckState,
|
|
|
|
|
ypi.task_id as taskId,
|
|
|
|
|
ypi.proc_inst_id as procInsId,
|
|
|
|
|
ypi.create_time AS createTime,
|
|
|
|
|
ypi.create_user_name AS createUserName,
|
|
|
|
|
sdd1.dict_label AS checkState,
|
|
|
|
|
ypd.correction_time AS correctionTime,
|
|
|
|
|
ypi.is_check AS isCheck,
|
|
|
|
|
ypi.reject_reason AS rejectReason,
|
|
|
|
|
ypi.delay_time AS delayTime
|
|
|
|
|
FROM yh_pitfall_info ypi
|
2025-02-19 11:20:21 +08:00
|
|
|
LEFT JOIN yh_pitfall_detaills ypd ON ypi.pitfall_id = ypd.pitfall_id
|
|
|
|
|
LEFT JOIN sys_dict_data sdd ON ypi.is_from = sdd.dict_value AND sdd.dict_type = 'yn_collection_source' AND sdd.status = 0
|
|
|
|
|
LEFT JOIN sys_dict_data sdd1 ON ypi.check_state = sdd1.dict_value AND sdd1.dict_type = 'sys_approval_state' AND sdd1.status = 0
|
|
|
|
|
LEFT JOIN sys_dict_data sdd2 ON ypi.check_status = sdd2.dict_value AND sdd2.dict_type = 'yn_check_status' AND sdd2.status = 0
|
2025-01-16 16:16:53 +08:00
|
|
|
WHERE ypi.is_active = 1
|
|
|
|
|
<if test="typeId == 1 or typeId == '1'">
|
|
|
|
|
AND ypd.user_id = #{userId}
|
|
|
|
|
</if>
|
2025-02-19 11:20:21 +08:00
|
|
|
<if test='dataType==1'>
|
|
|
|
|
AND ypi.proc_inst_id IN (
|
|
|
|
|
<foreach collection="proInsId" item="item" separator=",">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="status==2 or status=='2'">
|
|
|
|
|
and ypi.check_state= #{status}
|
|
|
|
|
</if>
|
2025-01-16 16:16:53 +08:00
|
|
|
<if test="pitfallTypeId != null and pitfallTypeId != ''">
|
|
|
|
|
AND ypd.pitfall_type_id = #{pitfallTypeId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isFrom != null and isFrom != ''">
|
|
|
|
|
AND ypi.is_from = #{isFrom}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pitfallLevelId != null and pitfallLevelId != ''">
|
|
|
|
|
AND ypd.pitfall_level_id = #{pitfallLevelId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="checkStatus != null and checkStatus != ''">
|
|
|
|
|
AND ypi.check_status = #{checkStatus}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="checkState != null and checkState != ''">
|
|
|
|
|
AND ypi.check_state = #{checkState}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pitfallCode != null and pitfallCode != ''">
|
|
|
|
|
AND ypi.pitfall_code LIKE CONCAT('%', #{pitfallCode}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="proName != null and proName != ''">
|
|
|
|
|
AND ypd.pro_name LIKE CONCAT('%', #{proName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="subName != null and subName != ''">
|
|
|
|
|
AND ypd.sub_name LIKE CONCAT('%', #{subName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createUserName != null and createUserName != ''">
|
|
|
|
|
AND ypi.create_user_name LIKE CONCAT('%', #{createUserName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
|
|
AND ypd.find_time BETWEEN STR_TO_DATE(#{startTime}, '%Y-%m-%d') AND STR_TO_DATE(#{endTime}, '%Y-%m-%d')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createStartTime != null and createStartTime != '' and createEndTime != null and createEndTime != ''">
|
|
|
|
|
AND STR_TO_DATE(ypi.create_time, '%Y-%m-%d') BETWEEN STR_TO_DATE(#{createStartTime}, '%Y-%m-%d') AND STR_TO_DATE(#{createEndTime}, '%Y-%m-%d')
|
|
|
|
|
</if>
|
|
|
|
|
ORDER BY ypi.pitfall_id DESC
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectHiddenDangerType" resultType="java.lang.Integer">
|
|
|
|
|
SELECT COUNT(1)
|
|
|
|
|
FROM yh_type_config
|
|
|
|
|
WHERE is_active = 1
|
|
|
|
|
AND name = #{name}
|
|
|
|
|
<if test="id != null and id!= ''">
|
|
|
|
|
AND id != #{id}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="type != null and type != ''">
|
|
|
|
|
AND type = #{type}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectCheckRecordNo" resultType="java.lang.String">
|
|
|
|
|
SELECT CONCAT('JCSJ', DATE_FORMAT(NOW(), '%Y%m%d'), LPAD(RIGHT(IFNULL(MAX(record_code), 0), 3) + 1, 3, 0))
|
|
|
|
|
FROM yh_safety_record
|
|
|
|
|
WHERE record_code LIKE CONCAT('JCSJ', DATE_FORMAT(NOW(), '%Y%m%d'), '%')
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectHiddenDangerNo" resultType="java.lang.String">
|
|
|
|
|
SELECT CONCAT('YHZG', DATE_FORMAT(NOW(), '%Y%m%d'), LPAD(RIGHT(IFNULL(MAX(pitfall_code), 0), 3) + 1, 3, 0))
|
|
|
|
|
FROM yh_pitfall_info
|
|
|
|
|
WHERE pitfall_code LIKE CONCAT('YHZG', DATE_FORMAT(NOW(), '%Y%m%d'), '%')
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getOwnerSelect" resultType="com.bonus.common.entity.SysSelectCommon">
|
|
|
|
|
SELECT
|
|
|
|
|
user_id AS value,
|
|
|
|
|
nick_name AS label
|
|
|
|
|
FROM sys_user
|
|
|
|
|
WHERE user_type = 00
|
|
|
|
|
AND del_flag = 0
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getDeptUserSelect" resultType="com.bonus.common.entity.SysSelectCommon">
|
|
|
|
|
SELECT u.user_id AS value,
|
|
|
|
|
u.nick_name AS label
|
|
|
|
|
FROM sys_user u
|
|
|
|
|
LEFT JOIN sys_dept d ON u.dept_id = d.dept_id
|
|
|
|
|
LEFT JOIN sys_user_post up ON up.user_id = u.user_id
|
|
|
|
|
LEFT JOIN sys_post sp ON sp.post_id = up.post_id
|
|
|
|
|
WHERE u.del_flag = 0
|
|
|
|
|
AND u.user_type = 00
|
|
|
|
|
<if test="deptId != null and deptId != 0">
|
|
|
|
|
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId},
|
|
|
|
|
ancestors) ))
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getPersonByConsIdSelect" resultType="com.bonus.common.entity.SysSelectCommon">
|
|
|
|
|
SELECT lcp.cons_persion_id AS value,
|
|
|
|
|
pcp.cons_name AS label
|
|
|
|
|
FROM lk_cont_person lcp
|
|
|
|
|
LEFT JOIN pt_cons_person pcp ON lcp.cons_persion_id = pcp.cons_user_id AND pcp.is_active = 1
|
|
|
|
|
WHERE lcp.cont_uuid = #{supUuid} AND lcp.into_status = 3 AND lcp.out_status != 3 AND lcp.pro_id = #{proId}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getReviewOfDeferredApprovalList"
|
|
|
|
|
resultType="com.bonus.common.safetycheck.PitfallDelayApprovalVo">
|
|
|
|
|
SELECT ypi.pitfall_id AS id,
|
|
|
|
|
ypi.pitfall_code AS pitfallCode,
|
|
|
|
|
ypd.pro_id AS proId,
|
|
|
|
|
ypd.pro_name AS proName,
|
|
|
|
|
ypd.sub_name AS subName,
|
|
|
|
|
ypd.pitfall_type_name AS pitfallTypeName,
|
|
|
|
|
ypd.pitfall_level_name AS pitfallLevelName,
|
|
|
|
|
ypi.is_delay AS isDelay,
|
2025-02-19 11:20:21 +08:00
|
|
|
#{dataType} AS status,
|
2025-01-16 16:16:53 +08:00
|
|
|
ypi.delay_check_state AS intoStatus,
|
|
|
|
|
ypi.delay_task_id AS taskId,
|
|
|
|
|
ypi.delay_proc_inst_id AS procInsId,
|
|
|
|
|
ypd.correction_time AS correctionTime,
|
|
|
|
|
ypi.delay_time AS delayTime,
|
|
|
|
|
ypd.find_time AS findTime,
|
|
|
|
|
ypi.check_status AS checkStatus,
|
|
|
|
|
sdd.dict_label AS checkStatusName,
|
|
|
|
|
ypi.delay_check_state AS delayCheckState,
|
|
|
|
|
sdd1.dict_label AS delayCheckStateName,
|
|
|
|
|
ypi.delay_reject_reason AS delayRejectReason,
|
|
|
|
|
ypi.is_delay AS isDelayCheck,
|
|
|
|
|
ypi.rejection_delay AS rejectionDelay,
|
|
|
|
|
ypd.delay_reason AS delayReason
|
|
|
|
|
FROM yh_pitfall_info ypi
|
|
|
|
|
LEFT JOIN yh_pitfall_detaills ypd ON ypi.pitfall_id = ypd.pitfall_id
|
|
|
|
|
LEFT JOIN sys_dict_data sdd
|
|
|
|
|
ON ypi.check_status = sdd.dict_value AND sdd.dict_type = 'yn_check_status' AND sdd.status = 0
|
|
|
|
|
LEFT JOIN sys_dict_data sdd1
|
|
|
|
|
ON ypi.delay_check_state = sdd1.dict_value AND sdd1.dict_type = 'sys_approval_state' AND
|
|
|
|
|
sdd1.status = 0
|
|
|
|
|
WHERE ypi.is_active = 1
|
|
|
|
|
<if test="hazardIssueLevel != null and hazardIssueLevel != ''">
|
|
|
|
|
AND ypd.pitfall_level_id = #{hazardIssueLevel}
|
|
|
|
|
</if>
|
2025-02-19 11:20:21 +08:00
|
|
|
<if test='dataType==1'>
|
|
|
|
|
AND ypi.delay_proc_inst_id IN (
|
|
|
|
|
<foreach collection="proInsId" item="item" separator=",">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="status==2 or status=='2'">
|
|
|
|
|
and ypi.delay_check_state = #{status}
|
|
|
|
|
</if>
|
2025-01-16 16:16:53 +08:00
|
|
|
<if test="hazardIssueCategories != null and hazardIssueCategories != ''">
|
|
|
|
|
AND ypd.pitfall_type_id = #{hazardIssueCategories}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pitfallLevelId != null and pitfallLevelId != ''">
|
|
|
|
|
AND ypd.pitfall_type_id = #{pitfallLevelId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="status != null and status != ''">
|
|
|
|
|
AND ypi.delay_check_state = #{status}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="hazardQuestionCode != null and hazardQuestionCode != ''">
|
|
|
|
|
AND ypi.pitfall_code LIKE CONCAT('%', #{hazardQuestionCode}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
|
|
AND (
|
|
|
|
|
ypd.pro_name LIKE CONCAT('%', #{keyWord}, '%') or
|
|
|
|
|
ypd.sub_name LIKE CONCAT('%', #{keyWord}, '%') or
|
|
|
|
|
ypd.pitfall_type_name LIKE CONCAT('%', #{keyWord}, '%') or
|
|
|
|
|
ypd.pitfall_level_name LIKE CONCAT('%', #{keyWord}, '%') or
|
|
|
|
|
ypd.delay_reason LIKE CONCAT('%', #{keyWord}, '%')
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="proId != null and proId != ''">
|
|
|
|
|
AND ypd.pro_id = #{proId}
|
|
|
|
|
</if>
|
|
|
|
|
ORDER BY ypi.pitfall_id DESC
|
|
|
|
|
</select>
|
|
|
|
|
<select id="whetherThereIsACheckRecord" resultType="java.lang.Integer">
|
|
|
|
|
SELECT
|
|
|
|
|
COUNT(1)
|
|
|
|
|
FROM yh_safety_record
|
|
|
|
|
WHERE title = #{title} AND is_active = '1'
|
|
|
|
|
<if test="id != null and id != '' ">
|
|
|
|
|
AND record_id != #{id}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getHiddenDangersFormList" resultType="com.bonus.common.safetycheck.NewHiddenDangerDto">
|
|
|
|
|
SELECT ypi.is_process AS isProcess,
|
|
|
|
|
ypi.delay_check_state AS delayCheckState,
|
|
|
|
|
ypi.check_status AS checkStatus,
|
|
|
|
|
ypi.check_state AS checkState,
|
|
|
|
|
ypi.delay_time AS delayTime,
|
|
|
|
|
ypi.is_check AS isCheck,
|
|
|
|
|
ypi.pitfall_id AS id,
|
|
|
|
|
ypd.correction_time AS correctionTime
|
|
|
|
|
FROM yh_pitfall_info ypi
|
|
|
|
|
LEFT JOIN yh_pitfall_detaills ypd ON ypi.pitfall_id = ypd.pitfall_id
|
|
|
|
|
WHERE ypi.check_status NOT IN ('2', '4', '6', '8') AND ypi.is_active = 1
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getIsThereARecord" resultType="java.lang.Integer">
|
|
|
|
|
SELECT SUM(id_count) AS total_id_count
|
|
|
|
|
FROM (SELECT COUNT(pitfall_id) AS id_count
|
|
|
|
|
FROM yh_pitfall_detaills
|
|
|
|
|
WHERE pitfall_type_id = #{id}
|
|
|
|
|
UNION ALL
|
|
|
|
|
SELECT COUNT(violation_id) AS id_count
|
|
|
|
|
FROM wz_violation_info
|
|
|
|
|
WHERE violation_type = #{id}
|
|
|
|
|
AND is_active = 1) AS total_counts;
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|