zhangf
2024-05-08 0414ddb0b2b3a7199ae6181a770f97ac140dbd73
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
180
181
182
183
184
185
186
187
188
189
190
191
<?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.EmergencySuppliesInfoRepository">
 
    <resultMap type="com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInfoPageDO" id="emergencySuppliesInfoPageDOResult">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="name" property="name"/>
        <result column="number" property="number"/>
        <result column="department_id" property="departmentId"/>
        <result column="classification" property="classification"/>
        <result column="place" property="place"/>
        <result column="count" property="count"/>
    </resultMap>
 
    <select id="selectEmergencySuppliesList" resultMap="emergencySuppliesInfoPageDOResult">
        select id,`name`,`number`,`department_id`,`classification`,place ,`count` from emergency_supplies where del_flag = 0
        <if test="query.name != null  and query.name != ''">and `name` like concat('%', #{query.name}, '%')</if>
    </select>
 
    <insert id="addEmergencySupplies" parameterType="com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInfo"
            keyProperty="id" useGeneratedKeys="true">
        insert into emergency_supplies
        <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="productionDate != null ">production_date,</if>
            <if test="useDate != null ">use_date,</if>
            <if test="inspectDate != null ">inspect_date,</if>
            <if test="nextInspectDate != null ">next_inspect_date,</if>
            <if test="inspectPeriod != null ">inspect_period,</if>
            <if test="count != null ">`count`,</if>
            <if test="usePeriod != null ">use_period,</if>
            <if test="departmentId != null ">department_id,</if>
            <if test="principalUserUid != null ">`principal_user_uid`,</if>
            <if test="principalUserName != null and principalUserName != ''">`principal_user_name`,</if>
            <if test="status != null and status != ''">status,</if>
            <if test="classification != null and classification != ''">`classification`,</if>
            <if test="name != null and name != ''">`name`,</if>
            <if test="number != null and number != ''">`number`,</if>
            <if test="model != null and model != ''">`model`,</if>
            <if test="longitude != null and longitude != ''">`longitude`,</if>
            <if test="latitude != null and latitude != ''">`latitude`,</if>
            <if test="use != null and use != ''">`use`,</if>
            <if test="areaId != null ">`area_id`,</if>
            <if test="place != null and place != ''">`place`,</if>
            <if test="useExplain != null and useExplain != ''">`use_explain`,</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="productionDate != null ">#{productionDate},</if>
            <if test="useDate != null ">#{useDate},</if>
            <if test="inspectDate != null ">#{inspectDate},</if>
            <if test="nextInspectDate != null ">#{nextInspectDate},</if>
            <if test="inspectPeriod != null ">#{inspectPeriod},</if>
            <if test="count != null ">#{count},</if>
            <if test="usePeriod != null ">#{usePeriod},</if>
            <if test="departmentId != null ">#{departmentId},</if>
            <if test="principalUserUid != null ">#{principalUserUid},</if>
            <if test="principalUserName != null and principalUserName != ''">#{principalUserName},</if>
            <if test="status != null and status != ''">#{status},</if>
            <if test="classification != null and classification != ''">#{classification},</if>
            <if test="name != null and name != ''">#{name},</if>
            <if test="number != null and number != ''">#{number},</if>
            <if test="model != null and model != ''">#{model},</if>
            <if test="longitude != null and longitude != ''">#{longitude},</if>
            <if test="latitude != null and latitude != ''">#{latitude},</if>
            <if test="use != null and use != ''">#{use},</if>
            <if test="areaId != null ">#{areaId},</if>
            <if test="place != null and place != ''">#{place},</if>
            <if test="useExplain != null and useExplain != ''">#{useExplain},</if>
        </trim>
    </insert>
 
 
    <resultMap type="com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInfoDetailDO" id="emergencySuppliesInfoDetailDOResult">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="production_date" property="productionDate"/>
        <result column="use_date" property="useDate"/>
        <result column="inspect_date" property="inspectDate"/>
        <result column="next_inspect_date" property="nextInspectDate"/>
        <result column="inspect_period" property="inspectPeriod"/>
        <result column="count" property="count"/>
        <result column="use_period" property="usePeriod"/>
        <result column="department_id" property="departmentId"/>
        <result column="principal_user_uid" property="principalUserUid"/>
        <result column="principal_user_name" property="principalUserName"/>
        <result column="status" property="status"/>
        <result column="classification" property="classification"/>
        <result column="name" property="name"/>
        <result column="number" property="number"/>
        <result column="model" property="model"/>
        <result column="longitude" property="longitude"/>
        <result column="latitude" property="latitude"/>
        <result column="use" property="use"/>
        <result column="area_id" property="areaId"/>
        <result column="place" property="place"/>
        <result column="use_explain" property="useExplain"/>
    </resultMap>
 
    <select id="selectEmergencySuppliesById" resultMap="emergencySuppliesInfoDetailDOResult">
        select id ,`production_date`,`use_date`,`inspect_date`,`next_inspect_date`,inspect_period ,`count` ,use_period ,department_id ,principal_user_uid ,principal_user_name,
        status ,classification ,`name` ,`number` ,model ,longitude ,latitude ,`use` ,area_id ,place ,use_explain
        from emergency_supplies  where del_flag = 0 and id = #{id}
    </select>
 
    <select id="countEmergencySupplies" resultMap="emergencySuppliesInfoDetailDOResult">
        select id,`name`,`count`,`production_date`,`use_period`,classification from emergency_supplies where del_flag = 0
        <if test="query.classification != null  and query.classification != ''">and `classification` =  #{query.classification}</if>
    </select>
 
    <update id="updateEmergencySupplies" parameterType="com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInfo">
        update emergency_supplies
        <trim prefix="SET" suffixOverrides=",">
            <if test="gmtModitify != null ">gmt_moditify = #{gmtModitify},</if>
            <if test="updateUid != null ">update_uid = #{updateUid},</if>
            <if test="productionDate != null ">production_date = #{productionDate},</if>
            <if test="useDate != null ">use_date = #{useDate},</if>
            <if test="inspectDate != null ">inspect_date = #{inspectDate},</if>
            <if test="nextInspectDate != null ">next_inspect_date = #{nextInspectDate},</if>
            <if test="inspectPeriod != null ">inspect_period = #{inspectPeriod},</if>
            <if test="count != null ">`count` = #{count},</if>
            <if test="usePeriod != null ">use_period = #{usePeriod},</if>
            <if test="departmentId != null ">department_id = #{departmentId},</if>
            <if test="principalUserUid != null ">`principal_user_uid` = #{principalUserUid},</if>
            <if test="principalUserName != null and principalUserName != ''">principal_user_name = #{principalUserName},</if>
            <if test="status != null and status != ''">status = #{status},</if>
            <if test="classification != null and classification != ''">`classification` = #{classification},</if>
            <if test="name != null and name != ''">`name` = #{name},</if>
            <if test="number != null and number != ''">`number` = #{number},</if>
            <if test="model != null and model != ''">`model` = #{model},</if>
            <if test="longitude != null and longitude != ''">`longitude` = #{longitude},</if>
            <if test="latitude != null and latitude != ''">`latitude` = #{latitude},</if>
            <if test="use != null and use != ''">`use` = #{use},</if>
            <if test="areaId != null ">`area_id` = #{areaId},</if>
            <if test="place != null and place != ''">`place` = #{place},</if>
            <if test="useExplain != null and useExplain != ''">`use_explain` = #{useExplain},</if>
        </trim>
        where id = #{id}
    </update>
 
    <update id="deleteEmergencySupplies">
        update emergency_supplies set del_flag = 1 where id = #{id}
    </update>
    <select id="listByNoConditions" resultType="com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInfo">
        select id,
               name,
               number,
               model,
               count,
               classification,
               place,
               use_explain
        from emergency_supplies
        where del_flag = #{delFlag} and status = #{status}
   </select>
    <select id="listCountByIds" resultType="com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInfo">
        select id,
               count
        from emergency_supplies
        where del_flag = #{delFlag} and status = #{status} and id in
        <foreach collection="ids" item="id" open="(" close=")" separator=",">
            #{id}
        </foreach>
    </select>
    <select id="getAllEmergencySupplies" resultType="com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInfo">
        select id,
               name,
               number,
               model,
               count,
               classification,
               place,
               use_explain,
               department_id
        from emergency_supplies
        where del_flag = 0
    </select>
 
 
</mapper>