<?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.gk.hotwork.doublePrevention.repository.PreventDangerCheckTaskRepository">
|
|
<resultMap id="BaseResultMap" type="com.gk.hotwork.doublePrevention.entity.PreventDangerCheckTask">
|
<id property="id" column="id"/>
|
<result property="uuid" column="uuid"/>
|
<result property="deleteStatus" column="delete_status"/>
|
<result property="result" column="result"/>
|
<result property="taskStatus" column="task_status"/>
|
<result property="taskBelong" column="task_belong"/>
|
<result property="belongTime" column="belong_time"/>
|
<result property="taskType" column="task_type"/>
|
<result property="startTime" column="start_time"/>
|
<result property="validTime" column="valid_time"/>
|
<result property="noticeTime" column="notice_time"/>
|
<result property="gmtCreate" column="gmt_create"/>
|
<result property="gmtModitify" column="gmt_moditify"/>
|
<result property="checkWorkId" column="check_work_id"/>
|
<result property="checkTaskUnitId" column="check_task_unit_id"/>
|
<result property="execUserId" column="exec_user_id"/>
|
<result property="enterpriseId" column="enterprise_id"/>
|
<result property="checkTaskUnitUuid" column="check_task_unit_uuid"/>
|
<result property="checkWorkUuid" column="check_work_uuid"/>
|
<result property="enterpriseUuid" column="enterprise_uuid"/>
|
<result property="taskCode" column="task_code"/>
|
<result property="execUserName" column="exec_user_name"/>
|
<result property="createUserName" column="create_user_name"/>
|
<result property="lastEditUserName" column="last_edit_user_name"/>
|
<result property="execDepId" column="exec_dep_id"/>
|
<result property="execDepUuid" column="exec_dep_uuid"/>
|
<result property="desc" column="desc"/>
|
<result column="report_status" property="reportStatus"/>
|
<result column="report_time" property="reportTime"/>
|
<result column="update_report_data_time" property="updateReportDataTime"/>
|
<result column="report_switch" property="reportSwitch"/>
|
</resultMap>
|
|
<resultMap id="PreventTaskRectifyDO" type="com.gk.hotwork.doublePrevention.entity.PreventDangerCheckTaskRectifyDO">
|
<result property="manageId" column="manage_id"/>
|
<result property="manageUuid" column="manage_uuid"/>
|
<result property="registerTime" column="register_time"/>
|
<result property="dangerLevel" column="danger_level"/>
|
<result property="dangerType" column="danger_type"/>
|
<result property="dangerSource" column="danger_source"/>
|
<result property="dangerStatus" column="danger_status"/>
|
<result property="registantId" column="registant_id"/>
|
<result property="produceDeviceId" column="produce_device_id"/>
|
<result property="dangerCode" column="danger_code"/>
|
<result property="registantName" column="registant_name"/>
|
<result property="dangerDesc" column="danger_desc"/>
|
<result property="dangerReason" column="danger_reason"/>
|
<result property="dangerResult" column="danger_result"/>
|
<result property="depId" column="dep_id"/>
|
<result property="riskUnitId" column="risk_unit_id"/>
|
<result property="dangerReview" column="danger_review"/>
|
<result property="dangerCloseReason" column="danger_close_reason"/>
|
<result property="rectifyId" column="rectify_id"/>
|
<result property="rectifyType" column="rectify_type"/>
|
<result property="rectifyTime" column="rectify_time"/>
|
<result property="liablePersonId" column="liable_person_id"/>
|
<result property="checkAcceptTime" column="check_accept_time"/>
|
<result property="checkAcceptPersonId" column="check_accept_person_id"/>
|
<result property="liablePerson" column="liable_person"/>
|
<result property="checkAcceptPerson" column="check_accept_person"/>
|
<result property="rectifyDepId" column="rectify_dep_id"/>
|
<result property="rectifyDesc" column="rectify_desc"/>
|
<result property="cost" column="cost"/>
|
<result property="rectifyApplyTime" column="rectify_apply_time"/>
|
<result property="timeOutDesc" column="time_out_desc"/>
|
<result property="rectifyInfo" column="rectify_info"/>
|
</resultMap>
|
|
<!--IPage<PreventDangerCheckTask> getTaskPage(Page<Object> page, PreventDangerCheckTaskQueryReqDTO taskQueryReqDTO);-->
|
<select id="getTaskPage" resultMap="BaseResultMap">
|
select * from prevent_danger_check_task
|
<where>
|
delete_status = 0
|
<if test="taskQueryReqDTO.taskStatus != 3 and taskQueryReqDTO.taskStatus != null">
|
and task_status = #{taskQueryReqDTO.taskStatus}
|
<if test="taskQueryReqDTO.result != null">
|
and result = #{taskQueryReqDTO.result}
|
</if>
|
<if test="taskQueryReqDTO.taskType != null">
|
and task_type = #{taskQueryReqDTO.taskType}
|
</if>
|
<if test="taskQueryReqDTO.execDepId != null">
|
and exec_dep_id = #{taskQueryReqDTO.execDepId}
|
</if>
|
</if>
|
|
<if test="taskQueryReqDTO.taskStatus == 3">
|
and task_status = #{taskQueryReqDTO.taskStatus} and task_belong =2
|
<if test="taskQueryReqDTO.result != null">
|
and result = #{taskQueryReqDTO.result}
|
</if>
|
<if test="taskQueryReqDTO.taskType != null">
|
and task_type = #{taskQueryReqDTO.taskType}
|
</if>
|
<if test="taskQueryReqDTO.execDepId != null">
|
and exec_dep_id = #{taskQueryReqDTO.execDepId}
|
</if>
|
</if>
|
|
<if test="taskQueryReqDTO.taskStatus == null">
|
and (task_status !=3
|
<if test="taskQueryReqDTO.result != null">
|
and result = #{taskQueryReqDTO.result}
|
</if>
|
<if test="taskQueryReqDTO.taskType != null">
|
and task_type = #{taskQueryReqDTO.taskType}
|
</if>
|
<if test="taskQueryReqDTO.execDepId != null">
|
and exec_dep_id = #{taskQueryReqDTO.execDepId}
|
</if>)
|
or (task_status =3 and task_belong = 2
|
<if test="taskQueryReqDTO.result != null">
|
and result = #{taskQueryReqDTO.result}
|
</if>
|
<if test="taskQueryReqDTO.taskType != null">
|
and task_type = #{taskQueryReqDTO.taskType}
|
</if>
|
<if test="taskQueryReqDTO.execDepId != null">
|
and exec_dep_id = #{taskQueryReqDTO.execDepId}
|
</if>)
|
</if>
|
</where>
|
order by gmt_create desc
|
|
<!-- select * from-->
|
<!-- (select * from prevent_danger_check_task where task_status !=3 or (task_status =3 and task_belong = 2))-->
|
<!-- as t-->
|
<!-- <where>-->
|
<!-- delete_status = 0-->
|
<!-- <if test="taskQueryReqDTO.result != null">-->
|
<!-- and result = #{taskQueryReqDTO.result}-->
|
<!-- </if>-->
|
<!-- <if test="taskQueryReqDTO.taskStatus != null">-->
|
<!-- and task_status = #{taskQueryReqDTO.taskStatus}-->
|
<!-- </if>-->
|
<!-- <if test="taskQueryReqDTO.taskType != null">-->
|
<!-- and task_type = #{taskQueryReqDTO.taskType}-->
|
<!-- </if>-->
|
<!-- <if test="taskQueryReqDTO.execDepId != null">-->
|
<!-- and exec_dep_id = #{taskQueryReqDTO.execDepId}-->
|
<!-- </if>-->
|
<!-- </where>-->
|
<!-- order by gmt_create desc-->
|
</select>
|
|
<!-- IPage<PreventDangerCheckTask> getTaskPageForMobile(Page<Object> page, PreventDangerCheckTaskQueryReqDTO taskQueryReqDTO);-->
|
<select id="getTaskPageForMobile" resultMap="BaseResultMap">
|
select * from prevent_danger_check_task
|
<where>
|
delete_status = 0
|
<if test="taskQueryReqDTO.taskStatus != 3">
|
and task_status = #{taskQueryReqDTO.taskStatus} and task_type = #{taskQueryReqDTO.taskType}
|
<if test="taskQueryReqDTO.execDepId != null">
|
and exec_dep_id = #{taskQueryReqDTO.execDepId}
|
</if>
|
</if>
|
<if test="taskQueryReqDTO.taskStatus == 3">
|
and task_status = #{taskQueryReqDTO.taskStatus} and task_type = #{taskQueryReqDTO.taskType} and task_belong = 2
|
<if test="taskQueryReqDTO.execDepId != null">
|
and exec_dep_id = #{taskQueryReqDTO.execDepId}
|
</if>
|
</if>
|
</where>
|
order by gmt_create desc
|
</select>
|
|
<!--PreventDangerCheckTask getTaskById(Long checkTaskId);-->
|
<select id="getTaskById" resultType="com.gk.hotwork.doublePrevention.entity.PreventDangerCheckTask">
|
select *
|
from prevent_danger_check_task
|
where delete_status = 0 and id = #{checkTaskId}
|
</select>
|
|
<!--PreventDangerCheckTask getTaskByCode(Long taskCode);-->
|
<select id="getTaskByCode" resultType="com.gk.hotwork.doublePrevention.entity.PreventDangerCheckTask">
|
select
|
id,
|
uuid
|
from prevent_danger_check_task
|
where delete_status = 0 and task_code = #{taskCode}
|
</select>
|
|
<!--int updateCheckTaskReport(PreventHandReportConfigReqDTO preventHandReportConfigReqDTO);-->
|
<update id="updateCheckTaskReport">
|
update prevent_danger_check_task set
|
report_switch = #{reportSwitch}
|
where id = #{id}
|
</update>
|
|
|
<!--PreventDangerCheckTask getTaskByCheckWorkId(Long checkWorkId)-->
|
<select id="getTaskByCheckWorkId" resultMap="BaseResultMap">
|
select id, uuid, check_work_id, task_status,valid_time
|
from prevent_danger_check_task where delete_status = 0 and (task_status = 1 or task_status = 4)
|
</select>
|
|
<!--boolean updateTaskStatus(Long taskId, Byte taskStatus);-->
|
<update id="updateTaskStatus">
|
update prevent_danger_check_task set
|
task_status = #{taskStatus}
|
where delete_status = 0 and id = #{taskId} and (task_status = 1 or task_status = 4)
|
</update>
|
|
<!--int resetTaskStatus(Long taskId);-->
|
<update id="resetTaskStatus">
|
update prevent_danger_check_task set
|
task_status = 3,
|
result = 3
|
where delete_status = 0 and task_status = 4 and id = #{taskId}
|
</update>
|
|
|
<!--int updateTaskUnitIdById(PreventDangerCheckTaskUpdateParams updateParams);-->
|
<update id="updateTask">
|
update prevent_danger_check_task set
|
result = #{result},
|
gmt_moditify = #{gmtModitify},
|
last_edit_user_name = #{lastEditUserName},
|
task_status = #{taskStatus}
|
where delete_status = 0 and id = #{id}
|
</update>
|
|
<!--int deleteTask(PreventDeleteParams deleteParams);-->
|
<update id="deleteTask">
|
update prevent_danger_check_task set
|
gmt_moditify = #{gmtModitify},
|
last_edit_user_name = #{lastEditUserName},
|
update_report_data_time = #{updateReportDataTime},
|
delete_status = 1
|
where delete_status = 0 and id = #{id}
|
</update>
|
|
<!--int taskToUser(PreventTaskToUserParams taskToUserParams);-->
|
<update id="taskToUser">
|
update prevent_danger_check_task set
|
gmt_moditify = #{gmtModitify},
|
last_edit_user_name = #{lastEditUserName},
|
exec_user_id= #{execUserId},
|
exec_user_name= #{execUserName},
|
task_belong = #{taskBelong},
|
belong_time = #{belongTime}
|
where delete_status = 0 and id = #{id}
|
</update>
|
|
|
|
<!--PreventDangerCheckTask getTaskByCheckWorkIdAndStartTime(Long workId, Date checkTime);-->
|
<select id="getTaskByCheckWorkIdAndStartTime" resultMap="BaseResultMap">
|
select id,start_time
|
from prevent_danger_check_task
|
where delete_status = 0 and check_work_id = #{workId} and start_time = #{checkTime}
|
</select>
|
|
<!--int updateTaskReportStatus(Long id, byte code);-->
|
<update id="updateTaskReportStatus">
|
update prevent_danger_check_task set
|
report_status = #{reportStatus},
|
report_time = #{reportTime}
|
where id = #{id}
|
</update>
|
|
<!--List<PreventDangerCheckTask> listReportTask();-->
|
<select id="listReportTask" resultMap="BaseResultMap">
|
select * from prevent_danger_check_task
|
where report_switch = 1 and task_belong = 2 and (update_report_data_time > report_time or report_time is null)
|
order by gmt_create
|
</select>
|
<select id="selectInspectorsStatistics" resultType="java.util.Map">
|
|
select
|
a.taskDate,
|
ifnull(b.num,0) num
|
from (
|
<foreach collection="list" item="item" separator="union all" index="index">
|
select #{item}
|
<if test="index == 0">
|
as taskDate
|
</if>
|
</foreach>
|
) as a left join (
|
select
|
date_format(start_time,'%Y-%m-%d') taskDate,
|
count(0) num
|
from prevent_danger_check_task
|
where start_time >= #{startTime}
|
and start_time < #{endTime}
|
and task_belong is not null
|
and exec_dep_id = #{depId}
|
group by date_format(start_time,'%Y-%m-%d')
|
) as b on a.taskDate = b.taskDate
|
|
|
</select>
|
<select id="selectInspectionCompleted" resultType="java.util.Map">
|
|
select
|
a.taskDate,
|
ifnull(b.num,0) num
|
from (
|
<foreach collection="list" item="item" separator="union all" index="index">
|
select #{item}
|
<if test="index == 0">
|
as taskDate
|
</if>
|
</foreach>
|
) as a left join (
|
select
|
date_format(start_time,'%Y-%m-%d') taskDate,
|
count(0) num
|
from prevent_danger_check_task
|
where start_time >= #{startTime}
|
and start_time < #{endTime}
|
<if test="status != null">
|
and task_type = #{status}
|
</if>
|
<if test="depId != null">
|
and exec_dep_id = #{depId}
|
</if>
|
|
group by date_format(start_time,'%Y-%m-%d')
|
) as b on a.taskDate = b.taskDate
|
order by a.taskDate
|
</select>
|
|
<!-- List<PreventDangerCheckTask> listOverTask(Date startTime, Date endTime);-->
|
<select id="listOverTask" resultMap="BaseResultMap">
|
select * from prevent_danger_check_task
|
where delete_status = 0 and valid_time > #{startTime} and #{endTime} > valid_time and task_status = 4
|
</select>
|
|
<!-- List<PreventDangerCheckTask> listWaitExecTask(Date endTime);-->
|
<select id="listWaitExecTask" resultMap="BaseResultMap">
|
select * from prevent_danger_check_task
|
where delete_status = 0 and valid_time > #{endTime} and #{endTime} > start_time and task_status = 1
|
</select>
|
|
|
<!-- List<PreventDangerCheckTask> listTimeOutTask(Date endTime);-->
|
<select id="listTimeOutTask" resultMap="BaseResultMap">
|
select * from prevent_danger_check_task
|
where delete_status = 0 and #{endTime} > valid_time and (task_status = 1 or task_status = 4)
|
</select>
|
|
|
|
|
|
<select id="selectInspectionTask" resultType="java.util.Map">
|
|
|
</select>
|
<select id="selectInspectionClaimedTask" resultType="java.util.Map">
|
select
|
a.taskDate,
|
ifnull(b.num,0) num
|
from (
|
<foreach collection="list" item="item" separator="union all" index="index">
|
select #{item}
|
<if test="index == 0">
|
as taskDate
|
</if>
|
</foreach>
|
) as a left join (
|
select
|
date_format(belong_time,'%Y-%m-%d') taskDate,
|
count(0) num
|
from prevent_danger_check_task
|
where belong_time >= #{startTime}
|
and belong_time < #{endTime}
|
and task_belong = 2
|
and belong_time is not null
|
and exec_dep_id = #{depId}
|
group by date_format(belong_time,'%Y-%m-%d')
|
) as b on a.taskDate = b.taskDate
|
order by a.taskDate
|
|
|
</select>
|
<select id="selectInspectionCompletedTask" resultType="java.util.Map">
|
select
|
a.taskDate,
|
ifnull(b.num,0) num
|
from (
|
<foreach collection="list" item="item" separator="union all" index="index">
|
select #{item}
|
<if test="index == 0">
|
as taskDate
|
</if>
|
</foreach>
|
) as a left join (
|
select
|
date_format(gmt_moditify,'%Y-%m-%d') taskDate,
|
count(0) num
|
from prevent_danger_check_task
|
where gmt_moditify >= #{startTime}
|
and gmt_moditify < #{endTime}
|
and task_status = 2
|
and exec_dep_id = #{depId}
|
group by date_format(gmt_moditify,'%Y-%m-%d')
|
) as b on a.taskDate = b.taskDate
|
order by a.taskDate
|
</select>
|
<select id="selectInspectionUnCompletedTask" resultType="java.util.Map">
|
select
|
a.taskDate,
|
ifnull(b.num,0) num
|
from (
|
<foreach collection="list" item="item" separator="union all" index="index">
|
select #{item}
|
<if test="index == 0">
|
as taskDate
|
</if>
|
</foreach>
|
) as a left join (
|
select
|
date_format(gmt_moditify,'%Y-%m-%d') taskDate,
|
count(0) num
|
from prevent_danger_check_task
|
where gmt_moditify >= #{startTime}
|
and gmt_moditify < #{endTime}
|
and task_status != 2
|
and belong_time is not null
|
and exec_dep_id = #{depId}
|
group by date_format(gmt_moditify,'%Y-%m-%d')
|
) as b on a.taskDate = b.taskDate
|
order by a.taskDate
|
|
</select>
|
<select id="selectPreventDangerPage"
|
resultMap="PreventTaskRectifyDO">
|
select
|
dangerManage.id manage_id,
|
dangerManage.uuid manage_uuid,
|
dangerManage.register_time register_time,
|
dangerManage.danger_level danger_level,
|
dangerManage.danger_type danger_type,
|
dangerManage.danger_source danger_source,
|
dangerManage.danger_status danger_status,
|
dangerManage.registant_id registant_id,
|
dangerManage.produce_device_id produce_device_id,
|
dangerManage.danger_code danger_code,
|
dangerManage.registant_name registant_name,
|
dangerManage.danger_desc danger_desc,
|
dangerManage.danger_reason danger_reason,
|
dangerManage.danger_result danger_result,
|
dangerManage.dep_id dep_id,
|
dangerManage.risk_unit_id risk_unit_id,
|
dangerManage.danger_review danger_review,
|
dangerManage.danger_close_reason danger_close_reason,
|
rectify.id rectify_id,
|
rectify.rectify_type rectify_type,
|
rectify.rectify_time rectify_time,
|
rectify.liable_person_id liable_person_id,
|
rectify.check_accept_time check_accept_time,
|
rectify.check_accept_person_id check_accept_person_id,
|
rectify.liable_person liable_person,
|
rectify.check_accept_person check_accept_person,
|
rectify.rectify_dep_id rectify_dep_id,
|
rectify.rectify_desc rectify_desc,
|
rectify.cost cost,
|
rectify.apply_time rectify_apply_time,
|
rectify.time_out_desc time_out_desc,
|
rectify.rectify_info rectify_info
|
from prevent_danger_manage as dangerManage
|
left join prevent_danger_rectify as rectify on rectify.danger_manager_id = dangerManage.id
|
where dangerManage.delete_status = 0
|
<if test="query.serialCode != null and query.serialCode != ''">
|
and dangerManage.serial_code like concat("%",#{query.serialCode},"%")
|
</if>
|
<if test="query.dangerLevel != null and query.dangerLevel != ''">
|
and dangerManage.danger_level = #{query.dangerLevel}
|
</if>
|
<if test="query.dangerType != null and query.dangerType != ''">
|
and dangerManage.danger_type = #{query.dangerType}
|
</if>
|
<if test="query.dangerSource != null and query.dangerSource != ''">
|
and dangerManage.danger_source = #{query.dangerSource}
|
</if>
|
<if test="query.dangerStatus != null">
|
and dangerManage.danger_status = #{query.dangerStatus}
|
</if>
|
<if test="query.registantName != null and query.registantName != ''">
|
and dangerManage.registant_name like concat("%",#{query.registantName},"%")
|
</if>
|
<if test="query.liablePersonName != null and query.liablePersonName != ''">
|
and rectify.liable_person like concat("%",#{query.liablePersonName},"%")
|
</if>
|
<if test="query.acceptPersonName != null and query.acceptPersonName != ''">
|
and rectify.accept_person_name like concat("%",#{query.acceptPersonName},"%")
|
</if>
|
order by dangerManage.gmt_create desc
|
</select>
|
<select id="selectRectifyNum" resultType="java.util.Map">
|
select
|
sum(dangerManage.danger_status = 0) rectifying,
|
sum(dangerManage.danger_status = 1) toAccept,
|
sum(dangerManage.danger_status = 2) postpone,
|
sum(dangerManage.danger_status = 3) overTime,
|
sum(dangerManage.danger_status = 9) accepted
|
from prevent_danger_manage as dangerManage
|
left join prevent_danger_rectify as rectify on rectify.danger_manager_id = dangerManage.id
|
where dangerManage.delete_status = 0
|
|
</select>
|
</mapper>
|