songhuangfeng123
2022-09-05 208b6439eb8e63b6485240a8b466ebdcfd08c57a
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
<?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.EmergencyPlanInfoRepository">
 
    <resultMap type="com.gkhy.safePlatform.emergency.entity.EmergencyPlanInfoPageDO" id="emergencyPlanInfoPageDOResult">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="name" property="name"/>
        <result column="status" property="status"/>
        <result column="type" property="type"/>
        <result column="level" property="level"/>
        <result column="release_date" property="releaseDate"/>
        <result column="author_name" property="authorName"/>
    </resultMap>
 
    <select id="selectEmergencyPlanList" resultMap="emergencyPlanInfoPageDOResult">
        SELECT
        a.id,
        a.`name`,
        a.`status`,
        a.`type`,
        a.`level`,
        a.release_date,
        a.author_name
        FROM
        emergency_plan a
        WHERE
        a.del_flag = 0
        AND a.abolish_status = #{query.abolishStatus}
        <if test="query.name != null  and query.name != ''">and a.name like concat('%', #{query.name}, '%')</if>
        <if test="query.type != null  and query.type != ''">and a.type = #{query.type}</if>
    </select>
 
    <insert id="addEmergencyPlan" parameterType="com.gkhy.safePlatform.emergency.entity.EmergencyPlanInfo"
            keyProperty="id" useGeneratedKeys="true">
        insert into emergency_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="abolishStatus != null ">abolish_status,</if>
            <if test="releaseDate != null ">release_date,</if>
            <if test="authorUid != null ">author_uid,</if>
            <if test="authorName != null and authorName != ''">`author_name`,</if>
            <if test="authorDeptId != null ">author_dept_id,</if>
            <if test="associatedDanger != null ">associated_danger,</if>
            <if test="type != null and type != ''">`type`,</if>
            <if test="level != null and level != ''">`level`,</if>
            <if test="name != null and name != ''">`name`,</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="abolishStatus != null ">#{abolishStatus},</if>
            <if test="releaseDate != null ">#{releaseDate},</if>
            <if test="authorUid != null ">#{authorUid},</if>
            <if test="authorName != null and authorName != ''">#{authorName},</if>
            <if test="authorDeptId != null ">#{authorDeptId},</if>
            <if test="associatedDanger!= null ">#{associatedDanger},</if>
            <if test="type != null and type != ''">#{type},</if>
            <if test="level != null and level != ''">#{level},</if>
            <if test="name != null and name != ''">#{name},</if>
        </trim>
    </insert>
 
 
    <resultMap type="com.gkhy.safePlatform.emergency.entity.EmergencyPlanInfoDetailDO" id="emergencyPlanInfoDetailDOResult">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="name" property="name"/>
        <result column="status" property="status"/>
        <result column="type" property="type"/>
        <result column="level" property="level"/>
        <result column="release_date" property="releaseDate"/>
        <result column="author_uid" property="authorUid"/>
        <result column="author_name" property="authorName"/>
        <result column="author_dept_id" property="authorDeptId"/>
        <result column="associated_danger" property="associatedDanger"/>
    </resultMap>
 
    <select id="selectEmergencyPlanById" resultMap="emergencyPlanInfoDetailDOResult">
        select id ,`name`,`status`,`type`,`level`,release_date ,author_uid ,author_dept_id ,associated_danger,author_name from emergency_plan
        where del_flag = 0 and id = #{id}
    </select>
 
    <update id="updateEmergencyPlan" parameterType="com.gkhy.safePlatform.emergency.entity.EmergencyPlanInfo">
        update emergency_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="abolishStatus != null ">abolish_status = #{abolishStatus},</if>
            <if test="releaseDate != null ">release_date = #{releaseDate},</if>
            <if test="authorUid != null ">author_uid = #{authorUid},</if>
            <if test="authorName != null and authorName != ''">author_name =#{authorName},</if>
            <if test="authorDeptId != null ">author_dept_id = #{authorDeptId},</if>
            <if test="associatedDanger != null ">associated_danger = #{associatedDanger},</if>
            <if test="type != null and type != ''">type = #{type},</if>
            <if test="level != null and level != ''">level = #{level},</if>
            <if test="name != null and name != ''">name = #{name},</if>
        </trim>
        where id = #{id}
    </update>
 
    <update id="deleteEmergencyPlan">
        update emergency_plan set del_flag = 1 where id = #{id}
    </update>
    <update id="updateAbolish">
        update emergency_plan set abolish_status = #{abolishStatus} where id = #{id}
    </update>
</mapper>