郑永安
2023-06-19 7a6abd05683528032687c75e80e0bd2030a3e46c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<?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.gkhy.safePlatform.doublePrevention.repository.PreventDangerCheckTaskRepository">
 
    <resultMap id="BaseResultMap" type="com.gkhy.safePlatform.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="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>
 
    <!--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.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>
        </where>
        order by gmt_create desc
    </select>
 
    <!--PreventDangerCheckTask getTaskById(Long checkTaskId);-->
    <select id="getTaskById" resultType="com.gkhy.safePlatform.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.gkhy.safePlatform.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>
 
    <!--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>
 
    <!--boolean updateTaskStatus(Long taskId, Byte taskStatus);-->
    <update id="updateTaskStatus">
        update  prevent_danger_check_task set
            task_status = #{taskStatus}
        where delete_status = 0 and task_status = 1 and id = #{taskId}
    </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}
        where delete_status = 0 and id = #{id}
    </update>
 
 
 
    <!--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)
    </select>
</mapper>