SupervisionThreestepMapper.xml
19.9 KB
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
<?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.trash.business.mapper.SupervisionThreestepMapper">
<resultMap type="SupervisionThreestep" id="SupervisionThreestepResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="type" column="type" />
<result property="place" column="place" />
<result property="selfCheckTime" column="self_check_time" />
<result property="objectId" column="object_id" />
<result property="earthsitesId" column="earthsites_id" />
<result property="createTime" column="create_time" />
<result property="checkTime" column="check_time" />
<result property="checkEndTime" column="check_end_time" />
<result property="earthsitesName" column="earthsites_name" />
<result property="contract" column="contract" />
<result property="contractId" column="contract_id" />
<result property="companys" column="companys" />
<result property="companyTrucks" column="company_trucks" />
<result property="img0" column="img0" />
<result property="img1" column="img1" />
<result property="img2" column="img2" />
<result property="img3" column="img3" />
<result property="img4" column="img4" />
<result property="img5" column="img5" />
<result property="img6" column="img6" />
<result property="img7" column="img7" />
<result property="img8" column="img8" />
<result property="img9" column="img9" />
<result property="img10" column="img10" />
<result property="img11" column="img11" />
<result property="img12" column="img12" />
<result property="sub_img0" column="sub_img0" />
<result property="sub_img1" column="sub_img1" />
<result property="sub_img2" column="sub_img2" />
<result property="sub_img3" column="sub_img3" />
<result property="sub_img4" column="sub_img4" />
<result property="sub_img5" column="sub_img5" />
<result property="sub_img6" column="sub_img6" />
<result property="sub_img7" column="sub_img7" />
<result property="sub_img8" column="sub_img8" />
<result property="sub_img9" column="sub_img9" />
<result property="sub_img10" column="sub_img10" />
<result property="sub_img11" column="sub_img11" />
<result property="sub_img12" column="sub_img12" />
<result property="subReason" column="sub_reason" />
<result property="earthPipPerson" column="earth_pip_person" />
<result property="enforcePerson" column="enforce_person" />
<result property="subSubReason" column="sub_sub_reason" />
<result property="attchItem1" column="attch_item1" />
<result property="attchItem2" column="attch_item2" />
<result property="attchItem3" column="attch_item3" />
<result property="person" column="person" />
<result property="phone" column="phone" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
</resultMap>
<sql id="selectSupervisionThreestepVo">
select id, name, type, place, self_check_time, object_id, earthsites_id,
create_time, check_time, earthsites_name,check_end_time,
contract,contract_id,
companys, company_trucks, img0, img1, img2, img3, img4, img5, img6, img7, img8,
img9, img10, img11, img12, sub_img0, sub_img1,
sub_img2, sub_img3, sub_img4, sub_img5, sub_img6, sub_img7, sub_img8, sub_img9,
sub_img10, sub_img11, sub_img12,
person,
phone,status,create_by,sub_reason,earth_pip_person,enforce_person,sub_sub_reason,attch_item1,attch_item2,attch_item3
from supervision_threestep
</sql>
<select id="getSupervisionThreestepInfo" parameterType="SupervisionThreestep" resultMap="SupervisionThreestepResult">
<include refid="selectSupervisionThreestepVo" />
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="type != null "> and type = #{type}</if>
<if test="place != null and place != ''"> and place = #{place}</if>
<if test="objectId != null and objectId != ''"> and object_id = #{objectId}</if>
<if test="earthsitesId != null and earthsitesId != ''"> and earthsites_id = #{earthsitesId}</if>
<if test="selfCheckTime != null "> and self_check_time = #{selfCheckTime}</if>
<if test="earthsitesName != null and earthsitesName != ''"> and earthsites_name like concat('%', #{earthsitesName},
'%')</if>
<if test="contract != null and contract != ''"> and contract = #{contract}</if>
<if test="companys != null and companys != ''"> and companys = #{companys}</if>
<if test="companyTrucks != null and companyTrucks != ''"> and company_trucks = #{companyTrucks}</if>
<if test="person != null and person != ''"> and person = #{person}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
</where>
ORDER BY create_time desc
</select>
<select id="selectSupervisionThreestepList" parameterType="SupervisionThreestep"
resultMap="SupervisionThreestepResult">
<include refid="selectSupervisionThreestepVo" />
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="type != null "> and type = #{type}</if>
<if test="place != null and place != ''"> and place = #{place}</if>
<if test="objectId != null and objectId != ''"> and object_id = #{objectId}</if>
<if test="earthsitesId != null and earthsitesId != ''"> and earthsites_id = #{earthsitesId}</if>
<if test="checkTime != null "> and check_time = #{checkTime}</if>
<if test="earthsitesName != null and earthsitesName != ''"> and earthsites_name like concat('%', #{earthsitesName},
'%')</if>
<if test="contract != null and contract != ''"> and contract = #{contract}</if>
<if test="companys != null and companys != ''"> and companys = #{companys}</if>
<if test="companyTrucks != null and companyTrucks != ''"> and company_trucks = #{companyTrucks}</if>
<if test="img0 != null and img0 != ''"> and img0 = #{img0}</if>
<if test="img1 != null and img1 != ''"> and img1 = #{img1}</if>
<if test="img2 != null and img2 != ''"> and img2 = #{img2}</if>
<if test="img3 != null and img3 != ''"> and img3 = #{img3}</if>
<if test="img4 != null and img4 != ''"> and img4 = #{img4}</if>
<if test="img5 != null and img5 != ''"> and img5 = #{img5}</if>
<if test="img6 != null and img6 != ''"> and img6 = #{img6}</if>
<if test="img7 != null and img7 != ''"> and img7 = #{img7}</if>
<if test="img8 != null and img8 != ''"> and img8 = #{img8}</if>
<if test="img9 != null and img9 != ''"> and img9 = #{img9}</if>
<if test="img10 != null and img10 != ''"> and img10 = #{img10}</if>
<if test="img11 != null and img11 != ''"> and img11 = #{img11}</if>
<if test="img12 != null and img12 != ''"> and img12 = #{img12}</if>
<if test="person != null and person != ''"> and person = #{person}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="status != null"> and status = #{status}</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
<if test="checkStatus != null and checkStatus==1 "> and check_end_time is not null</if>
<if test="checkStatus != null and checkStatus==0 "> and check_end_time is null</if>
<if test="workStartTime != null"> and self_check_time BETWEEN #{workStartTime} and
#{workEndTime}</if>
<if test="places != null and places.length > 0">
and place in
<foreach item="place" collection="places" open="(" separator=","
close=")">
#{place}
</foreach>
</if>
<if test="ids != null">
and object_id in
<foreach item="id" collection="ids" open="(" separator=","
close=")">
#{id}
</foreach>
</if>
</where>
ORDER BY create_time desc
</select>
<select id="getNames" parameterType="TruckCredit" resultType="String">
select DISTINCT name from supervision_threestep
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="type != null "> and type = #{type}</if>
<if test="place != null and place != ''"> and place = #{place}</if>
<if test="objectId != null and objectId != ''"> and object_id = #{objectId}</if>
<if test="earthsitesId != null and earthsitesId != ''"> and earthsites_id = #{earthsitesId}</if>
<if test="checkTime != null "> and check_time = #{checkTime}</if>
<if test="earthsitesName != null and earthsitesName != ''"> and earthsites_name like concat('%', #{earthsitesName},
'%')</if>
<if test="contract != null and contract != ''"> and contract = #{contract}</if>
<if test="companys != null and companys != ''"> and companys = #{companys}</if>
<if test="companyTrucks != null and companyTrucks != ''"> and company_trucks = #{companyTrucks}</if>
<if test="img0 != null and img0 != ''"> and img0 = #{img0}</if>
<if test="img1 != null and img1 != ''"> and img1 = #{img1}</if>
<if test="img2 != null and img2 != ''"> and img2 = #{img2}</if>
<if test="img3 != null and img3 != ''"> and img3 = #{img3}</if>
<if test="img4 != null and img4 != ''"> and img4 = #{img4}</if>
<if test="img5 != null and img5 != ''"> and img5 = #{img5}</if>
<if test="img6 != null and img6 != ''"> and img6 = #{img6}</if>
<if test="img7 != null and img7 != ''"> and img7 = #{img7}</if>
<if test="img8 != null and img8 != ''"> and img8 = #{img8}</if>
<if test="img9 != null and img9 != ''"> and img9 = #{img9}</if>
<if test="img10 != null and img10 != ''"> and img10 = #{img10}</if>
<if test="img11 != null and img11 != ''"> and img11 = #{img11}</if>
<if test="img12 != null and img12 != ''"> and img12 = #{img12}</if>
<if test="person != null and person != ''"> and person = #{person}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
<if test="workStartTime != null"> and self_check_time BETWEEN #{workStartTime} and
#{workEndTime}</if>
</where>
ORDER BY create_time desc
</select>
<!-- <select id="selectDayWorkList" parameterType="SupervisionThreestep" resultMap="SupervisionThreestepResult">
select a.*,b.* from( select x.* from (select * from supervision_threestep a
<where>
type = 0
and self_check_time BETWEEN #{workStartTime} and #{workEndTime}
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="place != null and place != ''"> and place = #{place}</if>
<if test="earthsitesName != null and earthsitesName != ''"> and earthsites_name like concat('%', #{earthsitesName},'%')</if>
</where>
ORDER BY self_check_time DESC) x GROUP BY object_id) a
LEFT JOIN
(select name ename,object_id eobject_id,sub_reason esub_reason,place
eplace,status estatus,self_check_time eself_check_time from
supervision_threestep where type = 1) b
on a.earthsites_id = b.eobject_id
and DATE_FORMAT(a.self_check_time,("%y%m%d")) =
DATE_FORMAT(b.eself_check_time,("%y%m%d"))
ORDER BY a.create_time DESC
</select> -->
<select id="selectDayWorkList" parameterType="SupervisionThreestep" resultMap="SupervisionThreestepResult">
select * from supervision_threestep
<where>
and self_check_time BETWEEN #{workStartTime} and #{workEndTime}
</where>
ORDER BY create_time DESC
</select>
<select id="selectDayWorkListByType" parameterType="SupervisionThreestep"
resultType="java.util.HashMap">
select object_id id,name,earthsites_id relationSiteId,company_trucks
from supervision_threestep
<where>
<if test="type != null"> and type = #{type} </if>
<if test="objectId != null and objectId != ''"> and object_id = #{objectId} </if>
<if test="companyTrucks != null">
and company_trucks like concat('%', #{companyTrucks}, '%')
</if>
and self_check_time BETWEEN #{workStartTime} and #{workEndTime}
and status = 1
</where>
ORDER BY self_check_time DESC
</select>
<select id="selectThreestepByTruckDate" parameterType="SupervisionThreestep" resultMap="SupervisionThreestepResult">
select * from supervision_threestep
where object_id = #{objectId}
and type = 0
and status = 1
and self_check_time BETWEEN #{workStartTime} and #{workEndTime}
ORDER BY self_check_time DESC
</select>
<select id="selectSupervisionThreestepById" parameterType="Long"
resultMap="SupervisionThreestepResult">
<include refid="selectSupervisionThreestepVo" />
where id = #{id}
</select>
<select id="selectTodayData" parameterType="SupervisionThreestep"
resultMap="SupervisionThreestepResult">
<include refid="selectSupervisionThreestepVo" />
<where>
and object_id = #{objectId}
and type = #{type}
and self_check_time BETWEEN #{workStartTime} and #{workEndTime}
</where>
</select>
<select id="selectTodayDataList" parameterType="SupervisionThreestep"
resultMap="SupervisionThreestepResult">
<include refid="selectSupervisionThreestepVo" />
<where>
<if test="companys != null">and companys like concat('%', #{companys}, '%')</if>
<if test="place != null and place != ''"> and place = #{place}</if>
<if test="status != null">and status = #{status}</if>
and type = #{type}
and self_check_time BETWEEN #{workStartTime} and #{workEndTime}
</where>
</select>
<insert id="insertSupervisionThreestep" parameterType="SupervisionThreestep"
useGeneratedKeys="true" keyProperty="id">
insert into supervision_threestep
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="type != null">type,</if>
<if test="place != null">place,</if>
<if test="selfCheckTime != null">self_check_time,</if>
<if test="objectId != null">object_id,</if>
<if test="earthsitesId != null">earthsites_id,</if>
<if test="createTime != null">create_time,</if>
<if test="earthsitesName != null">earthsites_name,</if>
<if test="contract != null">contract,</if>
<if test="contractId != null">contract_id,</if>
<if test="companys != null">companys,</if>
<if test="companyTrucks != null">company_trucks,</if>
<if test="img0 != null">img0,</if>
<if test="img1 != null">img1,</if>
<if test="img2 != null">img2,</if>
<if test="img3 != null">img3,</if>
<if test="img4 != null">img4,</if>
<if test="img5 != null">img5,</if>
<if test="img6 != null">img6,</if>
<if test="img7 != null">img7,</if>
<if test="img8 != null">img8,</if>
<if test="img9 != null">img9,</if>
<if test="img10 != null">img10,</if>
<if test="img11 != null">img11,</if>
<if test="img12 != null">img12,</if>
<if test="person != null">person,</if>
<if test="phone != null">phone,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="type != null">#{type},</if>
<if test="place != null">#{place},</if>
<if test="selfCheckTime != null">#{selfCheckTime},</if>
<if test="objectId != null">#{objectId},</if>
<if test="earthsitesId != null">#{earthsitesId},</if>
<if test="createTime != null">#{createTime},</if>
<if test="earthsitesName != null">#{earthsitesName},</if>
<if test="contract != null">#{contract},</if>
<if test="contractId != null">#{contractId},</if>
<if test="companys != null">#{companys},</if>
<if test="companyTrucks != null">#{companyTrucks},</if>
<if test="img0 != null">#{img0},</if>
<if test="img1 != null">#{img1},</if>
<if test="img2 != null">#{img2},</if>
<if test="img3 != null">#{img3},</if>
<if test="img4 != null">#{img4},</if>
<if test="img5 != null">#{img5},</if>
<if test="img6 != null">#{img6},</if>
<if test="img7 != null">#{img7},</if>
<if test="img8 != null">#{img8},</if>
<if test="img9 != null">#{img9},</if>
<if test="img10 != null">#{img10},</if>
<if test="img11 != null">#{img11},</if>
<if test="img12 != null">#{img12},</if>
<if test="person != null">#{person},</if>
<if test="phone != null">#{phone},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null"> #{createBy},</if>
</trim>
</insert>
<update id="updateStatusByObjectAndType" parameterType="SupervisionThreestep">
update supervision_threestep
<trim prefix="SET" suffixOverrides=",">
<if test="status != null">status = #{status},</if>
</trim>
<where>
and object_id = #{objectId}
and type = #{type}
and self_check_time BETWEEN #{workStartTime} and #{workEndTime}
</where>
</update>
<update id="updateSupervisionThreestep" parameterType="SupervisionThreestep">
update supervision_threestep
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="type != null">type = #{type},</if>
<if test="place != null">place = #{place},</if>
<if test="selfCheckTime != null">self_check_time = #{selfCheckTime},</if>
<if test="objectId != null">object_id = #{objectId},</if>
<if test="earthsitesId != null">earthsites_id = #{earthsitesId},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="checkTime != null">check_time = #{checkTime},</if>
<if test="earthsitesName != null">earthsites_name = #{earthsitesName},</if>
<if test="contract != null">contract = #{contract},</if>
<if test="contractId != null">contract_id = #{contractId},</if>
<if test="companys != null">companys = #{companys},</if>
<if test="companyTrucks != null">company_trucks = #{companyTrucks},</if>
<if test="img0 != null">img0 = #{img0},</if>
<if test="img1 != null">img1 = #{img1},</if>
<if test="img2 != null">img2 = #{img2},</if>
<if test="img3 != null">img3 = #{img3},</if>
<if test="img4 != null">img4 = #{img4},</if>
<if test="img5 != null">img5 = #{img5},</if>
<if test="img6 != null">img6 = #{img6},</if>
<if test="img7 != null">img7 = #{img7},</if>
<if test="img8 != null">img8 = #{img8},</if>
<if test="img9 != null">img9 = #{img9},</if>
<if test="img10 != null">img10 = #{img10},</if>
<if test="img11 != null">img11 = #{img11},</if>
<if test="img12 != null">img12 = #{img12},</if>
<if test="sub_img0 != null">sub_img0 = #{sub_img0},</if>
<if test="sub_img1 != null">sub_img1 = #{sub_img1},</if>
<if test="sub_img2 != null">sub_img2 = #{sub_img2},</if>
<if test="sub_img3 != null">sub_img3 = #{sub_img3},</if>
<if test="sub_img4 != null">sub_img4 = #{sub_img4},</if>
<if test="sub_img5 != null">sub_img5 = #{sub_img5},</if>
<if test="sub_img6 != null">sub_img6 = #{sub_img6},</if>
<if test="sub_img7 != null">sub_img7 = #{sub_img7},</if>
<if test="sub_img8 != null">sub_img8 = #{sub_img8},</if>
<if test="sub_img9 != null">sub_img9 = #{sub_img9},</if>
<if test="sub_img10 != null">sub_img10 = #{sub_img10},</if>
<if test="sub_img11 != null">sub_img11 = #{sub_img11},</if>
<if test="sub_img12 != null">sub_img12 = #{sub_img12},</if>
<if test="subReason != null">sub_reason = #{subReason},</if>
<if test="earthPipPerson != null">earth_pip_person = #{earthPipPerson},</if>
<if test="enforcePerson != null">enforce_person = #{enforcePerson},</if>
<if test="subSubReason != null">sub_sub_reason = #{subSubReason},</if>
<if test="attchItem1 != null">attch_item1 = #{attchItem1},</if>
<if test="attchItem2 != null">attch_item2 = #{attchItem2},</if>
<if test="attchItem3 != null">attch_item3 = #{attchItem3},</if>
<if test="person != null">person = #{person},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="status != null">status = #{status},</if>
<if test="checkEndTime != null">check_end_time = #{checkEndTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSupervisionThreestepById" parameterType="Long">
delete from supervision_threestep where id = #{id}
</delete>
<delete id="deleteSupervisionThreestepByIds" parameterType="String">
delete from supervision_threestep where id in
<foreach item="id" collection="array" open="(" separator=","
close=")">
#{id}
</foreach>
</delete>
</mapper>