郑永安
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?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.PreventDangerCheckWorkRepository">
 
    <resultMap id="BaseResultMap" type="com.gkhy.safePlatform.doublePrevention.entity.PreventDangerCheckWork">
        <id property="id" column="id"/>
        <result property="uuid" column="uuid"/>
        <result property="deleteStatus" column="delete_status"/>
        <result property="checkWorkType" column="check_work_type"/>
        <result property="checkWorkStatus" column="check_work_status"/>
        <result property="checkCycle" column="check_cycle"/>
        <result property="noticeTime" column="notice_time"/>
        <result property="validTime" column="valid_time"/>
        <result property="checkCycleUnit" column="check_cycle_unit"/>
        <result property="validTimeUnit" column="valid_time_unit"/>
        <result property="noticeTimeUnit" column="notice_time_unit"/>
        <result property="gmtCreate" column="gmt_create"/>
        <result property="gmtModitify" column="gmt_moditify"/>
        <result property="firstStartTime" column="first_start_time"/>
        <result property="lastCheckTime" column="last_check_time"/>
        <result property="nextCheckTime" column="next_check_time"/>
        <result property="execDepId" column="exec_dep_id"/>
        <result property="enterpriseId" column="enterprise_id"/>
        <result property="execDepUuid" column="exec_dep_uuid"/>
        <result property="enterpriseUuid" column="enterprise_uuid"/>
        <result property="checkWorkName" column="check_work_name"/>
        <result property="execDep" column="exec_dep"/>
        <result property="createByUserName" column="create_by_user_name"/>
        <result property="lastEditUserName" column="last_edit_user_name"/>
        <result property="taskUnitId" column="task_unit_id"/>
        <result property="taskUnitUuid" column="task_unit_uuid"/>
        <result property="reportStatus" column="report_status"/>
        <result property="reportTime" column="report_time"/>
        <result property="updateReportDataTime" column="update_report_data_time"/>
        <result property="reportSwitch" column="report_switch"/>
    </resultMap>
 
    <!--    IPage<PreventDangerCheckWork> getCheckWorkPage(page,workQueryReqDTO);-->
    <select id="getCheckWorkPage" resultMap="BaseResultMap">
        select *
        from prevent_danger_check_work
        <where>
            delete_status = 0
            <if test="workQueryReqDTO.checkWorkType != null">
                and check_work_type = #{workQueryReqDTO.checkWorkType}
            </if>
            <if test="workQueryReqDTO.checkWorkStatus != null">
                and check_work_status = #{workQueryReqDTO.checkWorkStatus}
            </if>
            <if test="workQueryReqDTO.checkWorkId != null">
                and id = #{workQueryReqDTO.checkWorkId}
            </if>
            <if test="workQueryReqDTO.checkWorkName != null">
                and check_work_name = #{workQueryReqDTO.checkWorkName}
            </if>
        </where>
        order by gmt_create desc
    </select>
 
    <!--PreventDangerCheckWork getWorkByName(String checkWorkName);-->
    <select id="getWorkByName" resultType="com.gkhy.safePlatform.doublePrevention.entity.PreventDangerCheckWork">
        select id ,uuid
        from prevent_danger_check_work
        where check_work_name = #{checkWorkName}
    </select>
 
    <!--List<PreventDangerCheckWork> listCheckWork();-->
    <select id="listCheckWork" resultMap="BaseResultMap">
        select *
        from prevent_danger_check_work
        where delete_status = 0 and check_work_status = 1
    </select>
 
    <!--PreventDangerCheckWork getWorkByTaskUnitId(Long taskUnitId);-->
    <select id="getWorkByTaskUnitId" resultType="com.gkhy.safePlatform.doublePrevention.entity.PreventDangerCheckWork">
        select
            id,
            uuid,
            check_work_name
        from prevent_danger_check_work
        where delete_status = 0 and task_unit_id = #{taskUnitId}
    </select>
 
<!--    PreventDangerCheckWork getWorkById(Long workId);-->
    <select id="getWorkById" resultType="com.gkhy.safePlatform.doublePrevention.entity.PreventDangerCheckWork">
        select *
        from prevent_danger_check_work
        where delete_status = 0 and id = #{workId}
    </select>
 
    <!--List<PreventDangerCheckWork> listScheduleCheckWork();-->
    <select id="listScheduleCheckWork" resultMap="BaseResultMap">
        select *
        from prevent_danger_check_work
        where delete_status = 0 and check_work_status = 1 and task_unit_id is not null
    </select>
 
    <!--int updateCheckWorkReport(PreventHandReportConfigReqDTO preventHandReportConfigReqDTO);-->
    <update id="updateCheckWorkReport">
        update prevent_danger_check_work set
            report_switch = #{reportSwitch}
        where id = #{id}
    </update>
 
    <!--int updateCheckWorkLastTimeAndNextTime(CheckWorkAutoUpdateParams updateParams)-->
    <update id="updateCheckWorkLastTimeAndNextTime">
        update prevent_danger_check_work set
            last_check_time = #{lastCheckTime},
            next_check_time = #{nextCheckTime},
            check_work_status = #{checkWorkStatus}
        where  delete_status = 0 and id = #{id}
    </update>
 
    <!--void updateCheckWorkStatus(CheckWorkAutoUpdateParams updateParams);-->
    <update id="updateCheckWorkStatus">
        update prevent_danger_check_work set
            check_work_status = #{checkWorkStatus}
        where  delete_status = 0 and id = #{id}
    </update>
 
    <!--int resetWorkStatus(Long workId);-->
    <update id="resetWorkStatus">
        update prevent_danger_check_work set
            check_work_status = 1
        where  delete_status = 0 and id = #{workId}
    </update>
 
 
 
    <!--int updateCheckWork(PreventDangerCheckWorkUpdateParams updateParams);-->
    <update id="updateCheckWork">
        update prevent_danger_check_work set
            check_work_type = #{checkWorkType},
            check_work_status = #{checkWorkStatus},
            check_cycle_unit = #{checkCycleUnit},
            valid_time_unit = #{checkCycleUnit},
            notice_time_unit = #{noticeTimeUnit},
            notice_time = #{noticeTime},
            valid_time = #{validTime},
            check_cycle = #{checkCycle},
            check_work_name = #{checkWorkName},
            exec_dep_id = #{execDepId},
            exec_dep = #{execDep},
            gmt_moditify = #{gmtModitify},
            last_edit_user_name = #{lastEditUserName},
            first_start_time = #{firstStartTime},
            next_check_time = #{nextCheckTime},
            task_unit_id = #{taskUnitId},
            task_unit_uuid = #{taskUnitUuid},
            update_report_data_time = #{updateReportDataTime},
            report_status = #{reportStatus},
            report_switch = #{reportSwitch}
        where delete_status = 0 and id = #{id}
    </update>
 
<!--    int deleteCheckWork(PreventDangerCheckWorkDeleteParams deleteParams);-->
    <update id="deleteCheckWork">
        update prevent_danger_check_work set
            delete_status = 1,
            gmt_moditify = #{gmtModitify},
            update_report_data_time = #{updateReportDataTime},
            last_edit_user_name = #{lastEditUserName}
        where delete_status = 0 and id = #{id}
    </update>
 
    <!--int updateWorkReportStatus(Long id, byte code);-->
    <update id="updateWorkReportStatus">
        update prevent_danger_check_work set
            report_status =  #{reportStatus},
            report_time = #{reportTime}
        where id = #{id}
    </update>
 
    <!--List<PreventDangerCheckWork> listReportWork();-->
    <select id="listReportWork" resultMap="BaseResultMap">
        select * from prevent_danger_check_work
        where report_switch = 1 and (update_report_data_time > report_time or report_time is null)
    </select>
</mapper>