kongzy
2024-09-23 d015cc0b48ca51a2b93b6c60c91dc352a104b1e7
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
<?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.emergency.repository.EmergencyDrillPlanInfoRepository">
 
    <resultMap type="com.gkhy.safePlatform.emergency.entity.EmergencyDrillPlanInfoPageDO"
               id="emergencyDrillPlanInfoPageDOResult">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="drill_name" property="drillName"/>
        <result column="drill_address" property="drillAddress"/>
        <result column="drill_way" property="drillWay"/>
        <result column="drill_level" property="drillLevel"/>
        <result column="drill_plan_date" property="drillPlanDate"/>
        <result column="gmt_moditify" property="gmtModitify"/>
    </resultMap>
 
    <select id="selectEmergencyDrillPlanList" resultMap="emergencyDrillPlanInfoPageDOResult">
        select id,`drill_name`,`drill_address`,`drill_way`,`drill_level`,drill_plan_date ,gmt_moditify
        from emergency_drill_plan where del_flag = 0
        <if test="query.drillName != null  and query.drillName != ''">and `drill_name` like concat('%', #{query.drillName}, '%')</if>
    </select>
 
    <insert id="addEmergencyDrillPlan" parameterType="com.gkhy.safePlatform.emergency.entity.EmergencyDrillPlanInfo"
            keyProperty="id" useGeneratedKeys="true">
        insert into emergency_drill_plan
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null ">id,</if>
            <if test="delFlag != null ">del_flag,</if>
            <if test="gmtCreate != null ">gmt_create,</if>
            <if test="gmtModitify != null ">gmt_moditify,</if>
            <if test="createUid != null ">create_uid,</if>
            <if test="updateUid != null ">update_uid,</if>
            <if test="status != null ">status,</if>
            <if test="makingPlanDate != null ">making_plan_date,</if>
            <if test="drillPlanDate != null ">drill_plan_date,</if>
            <if test="makingUserUid != null ">making_user_uid,</if>
            <if test="makingUserName != null and makingUserName != ''">`making_user_name`,</if>
            <if test="makingDepartmentId != null ">making_department_id,</if>
            <if test="planId != null ">plan_id,</if>
            <if test="departmentId != null ">department_id,</if>
            <if test="drillExpense != null ">drill_expense,</if>
            <if test="drillLevel != null and drillLevel != ''">`drill_level`,</if>
            <if test="drillAddress != null and drillAddress != ''">`drill_address`,</if>
            <if test="drillName != null and drillName != ''">`drill_name`,</if>
            <if test="drillWay != null and drillWay != ''">`drill_way`,</if>
            <if test="insuranceMeasures != null and insuranceMeasures != ''">`insurance_measures`,</if>
            <if test="remark != null and remark != ''">`remark`,</if>
            <if test="purpose != null and purpose != ''">`purpose`,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null ">#{id},</if>
            <if test="delFlag != null ">#{delFlag},</if>
            <if test="gmtCreate != null ">#{gmtCreate},</if>
            <if test="gmtModitify != null ">#{gmtModitify},</if>
            <if test="createUid != null ">#{createUid},</if>
            <if test="updateUid != null ">#{updateUid},</if>
            <if test="status != null ">#{status},</if>
            <if test="makingPlanDate != null ">#{makingPlanDate},</if>
            <if test="drillPlanDate != null ">#{drillPlanDate},</if>
            <if test="makingUserUid != null ">#{makingUserUid},</if>
            <if test="makingUserName != null and makingUserName != ''">#{makingUserName},</if>
            <if test="makingDepartmentId != null ">#{makingDepartmentId},</if>
            <if test="planId != null ">#{planId},</if>
            <if test="departmentId != null ">#{departmentId},</if>
            <if test="drillExpense != null ">#{drillExpense},</if>
            <if test="drillLevel != null and drillLevel != ''">#{drillLevel},</if>
            <if test="drillAddress != null and drillAddress != ''">#{drillAddress},</if>
            <if test="drillName != null and drillName != ''">#{drillName},</if>
            <if test="drillWay != null and drillWay != ''">#{drillWay},</if>
            <if test="insuranceMeasures != null and insuranceMeasures != ''">#{insuranceMeasures},</if>
            <if test="remark != null and remark != ''">#{remark},</if>
            <if test="purpose != null and purpose != ''">#{purpose},</if>
        </trim>
    </insert>
 
 
    <resultMap type="com.gkhy.safePlatform.emergency.entity.EmergencyDrillPlanInfoDetailDO"
               id="emergencyDrillPlanInfoDetailDOResult">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="status" property="status"/>
        <result column="gmt_moditify" property="gmtModitify"/>
        <result column="making_plan_date" property="makingPlanDate"/>
        <result column="drill_plan_date" property="drillPlanDate"/>
        <result column="making_user_uid" property="makingUserUid"/>
        <result column="making_user_name" property="makingUserName"/>
        <result column="making_department_id" property="makingDepartmentId"/>
        <result column="plan_id" property="planId"/>
        <result column="department_id" property="departmentId"/>
        <result column="drill_expense" property="drillExpense"/>
        <result column="drill_name" property="drillName"/>
        <result column="drill_address" property="drillAddress"/>
        <result column="drill_way" property="drillWay"/>
        <result column="drill_level" property="drillLevel"/>
        <result column="insurance_measures" property="insuranceMeasures"/>
        <result column="remark" property="remark"/>
        <result column="purpose" property="purpose"/>
    </resultMap>
 
    <select id="selectEmergencyDrillPlanById" resultMap="emergencyDrillPlanInfoDetailDOResult">
    SELECT
        a.id,
        a.`status`,
        a.`gmt_moditify`,
        a.`making_plan_date`,
        a.`drill_plan_date`,
        a.making_user_uid,
        a.making_user_name,
        a.making_department_id,
        a.plan_id,
        a.department_id,
        a.drill_expense,
        a.drill_name,
        a.drill_address,
        a.drill_way,
        a.drill_level,
        a.insurance_measures,
        a.remark,
        a.purpose,
        b.`name` AS planName
    FROM
        emergency_drill_plan a
        LEFT JOIN emergency_plan b ON a.plan_id = b.id
    WHERE
        a.del_flag = 0
        AND a.id = #{id}
    </select>
 
    <update id="updateEmergencyDrillPlan" parameterType="com.gkhy.safePlatform.emergency.entity.EmergencyDrillPlanInfo">
        update emergency_drill_plan
        <trim prefix="SET" suffixOverrides=",">
            <if test="gmtModitify != null ">gmt_moditify = #{gmtModitify},</if>
            <if test="updateUid != null ">update_uid = #{updateUid},</if>
            <if test="status != null ">status = #{status},</if>
            <if test="makingPlanDate != null ">making_plan_date=#{makingPlanDate},</if>
            <if test="drillPlanDate != null ">drill_plan_date=#{drillPlanDate},</if>
            <if test="makingUserUid != null ">making_user_uid=#{makingUserUid},</if>
            <if test="makingUserName != null and makingUserName != ''">making_user_name=#{makingUserName},</if>
            <if test="makingDepartmentId != null ">making_department_id=#{makingDepartmentId},</if>
            <if test="planId != null ">plan_id=#{planId},</if>
            <if test="departmentId != null ">department_id=#{departmentId},</if>
            <if test="drillExpense != null ">drill_expense=#{drillExpense},</if>
            <if test="drillLevel != null and drillLevel != ''">drill_level=#{drillLevel},</if>
            <if test="drillAddress != null and drillAddress != ''">drill_address=#{drillAddress},</if>
            <if test="drillName != null and drillName != ''">drill_name=#{drillName},</if>
            <if test="drillWay != null and drillWay != ''">drill_way=#{drillWay},</if>
            <if test="insuranceMeasures != null and insuranceMeasures != ''">insurance_measures=#{insuranceMeasures},</if>
            <if test="remark != null and remark != ''">remark=#{remark},</if>
            <if test="purpose != null and purpose != ''">purpose=#{purpose},</if>
        </trim>
        where id = #{id}
    </update>
 
    <update id="deleteEmergencyDrillPlan">
        update emergency_drill_plan set del_flag = 1 where id = #{id}
    </update>
</mapper>