郑永安
2023-09-19 69185134fcfaf913ea45f1255677225a2cc311a4
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
<?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.PreventDangerCheckTaskUnitRepository">
 
    <resultMap id="BaseResultMap" type="com.gk.hotwork.doublePrevention.entity.PreventDangerCheckTaskUnit">
        <id property="id" column="id"/>
        <result property="uuid" column="uuid"/>
        <result property="deleteStatus" column="delete_status"/>
        <result property="gmtCreate" column="gmt_create"/>
        <result property="gmtModitify" column="gmt_moditify"/>
        <result property="enterpriseUuid" column="enterprise_uuid"/>
        <result property="enterpriseUuid" column="enterprise_uuid"/>
        <result property="taskUnitName" column="task_unit_name"/>
        <result property="createByUserName" column="create_by_user_name"/>
        <result property="lastEditUserName" column="last_edit_user_name"/>
        <result property="note" column="note"/>
    </resultMap>
 
<!--    IPage<PreventDangerCheckTaskUnit> getTaskUnitPage-->
    <select id="getTaskUnitPage" resultMap="BaseResultMap">
        select
            id,
            task_unit_name,
            gmt_create,
            gmt_moditify,
            create_by_user_name,
            last_edit_user_name,
            note
        from  prevent_danger_check_task_unit
        <where>
            delete_status = 0
            <if test="taskUnitQueryReqDTO.taskUnitId != null">
                and task_unit_id = #{taskUnitQueryReqDTO.taskUnitId}
            </if>
            <if test="taskUnitQueryReqDTO.taskUnitName != null">
                and task_unit_name like '%' #{taskUnitQueryReqDTO.taskUnitName} '%'
            </if>
        </where>
        order by gmt_create desc
    </select>
 
    <!--PreventDangerCheckTaskUnit getTaskUnitByName(String taskUnitName);-->
    <select id="getTaskUnitByName" resultType="com.gk.hotwork.doublePrevention.entity.PreventDangerCheckTaskUnit">
        select
            id,
            uuid,
            task_unit_name
        from  prevent_danger_check_task_unit
        where delete_status = 0 and task_unit_name = #{taskUnitName}
    </select>
 
    <!--Long getTaskUnitByWorkId(Long workId);-->
    <select id="getTaskUnitByWorkId" resultType="com.gk.hotwork.doublePrevention.entity.PreventDangerCheckTaskUnit">
        select
            id,
            task_unit_name
        from  prevent_danger_check_task_unit
        where delete_status = 0 and check_work_id = #{workId}
    </select>
 
<!--    PreventDangerCheckTaskUnit getTaskUnitById(Long id)-->
    <select id="getTaskUnitById" resultType="com.gk.hotwork.doublePrevention.entity.PreventDangerCheckTaskUnit">
        select
            id,
            uuid,
            task_unit_name
        from  prevent_danger_check_task_unit
        where delete_status = 0 and id = #{id}
    </select>
 
    <!--List<PreventDangerCheckTaskUnit> listTaskUnit();-->
    <select id="listTaskUnit" resultMap="BaseResultMap">
        select
            id,
            uuid,
            task_unit_name
        from  prevent_danger_check_task_unit
        where delete_status = 0
    </select>
 
    <!--int deleteWorkIdByUnitName(String taskUnitName);-->
    <update id="deleteWorkIdByUnitName">
        update prevent_danger_check_task_unit set
            check_work_id = null
        where delete_status = 0 and task_unit_name = #{taskUnitName}
    </update>
 
    <!--int updateTaskUnit(PreventDangerCheckTaskUnitUpdateParams updateParams);-->
    <update id="updateTaskUnit">
        update prevent_danger_check_task_unit set
            task_unit_name = #{taskUnitName},
            note = #{note},
            gmt_moditify = #{gmtModitify},
            last_edit_user_name = #{lastEditUserName}
        where delete_status = 0 and id = #{id}
    </update>
 
    <!--int updateWorkIdByUnitId(String taskUnitId, long checkWorkId);-->
    <update id="updateWorkIdByUnitId">
        update prevent_danger_check_task_unit set
            check_work_id = #{checkWorkId},
            check_work_uuid = #{checkWorkUuid}
        where delete_status = 0 and id = #{taskUnitId}
    </update>
 
    <!--int deleteByWorkId(Long workId);-->
    <update id="deleteByWorkId">
        update prevent_danger_check_task_unit set
            check_work_id = null,
            check_work_uuid = null
        where delete_status = 0 and check_work_id = #{workId}
    </update>
 
    <!--PreventDangerCheckTaskUnit updateWorkIdByUnitName(String taskUnitName, Long checkWorkId);-->
    <update id="updateWorkIdByUnitName">
        update prevent_danger_check_task_unit set
            check_work_id = #{checkWorkId}
        where delete_status = 0 and task_unit_name = #{taskUnitName}
    </update>
 
    <!--int updateTaskIdByUnitName(String taskUnitName, long taskId);-->
    <update id="updateTaskIdByUnitName">
        update prevent_danger_check_task_unit set
            check_task_id = #{taskId}
        where delete_status = 0 and task_unit_name = #{taskUnitName}
    </update>
 
<!--    int deleteTaskUnit(PreventDangerCheckTaskUnitDeleteParams deleteParams);-->
    <update id="deleteTaskUnit" >
        update prevent_danger_check_task_unit set
            delete_status = 1,
            gmt_moditify = #{gmtModitify},
            last_edit_user_name = #{lastEditUserName}
        where delete_status = 0 and id = #{id}
    </update>
 
</mapper>