wuxw
2025-03-03 ef905363be52c021fe5384b2a5e17600fb1d2928
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
<?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="workPoolV1ServiceDaoImpl">
 
 
    <!-- 保存工作单信息 add by wuxw 2018-07-03 -->
    <insert id="saveWorkPoolInfo" parameterType="Map">
        insert into work_pool(
        work_cycle,create_user_id,create_user_name,store_id,work_name,work_id,wt_id,create_user_tel,start_time,end_time,state,community_id
        ) values (
        #{workCycle},#{createUserId},#{createUserName},#{storeId},#{workName},#{workId},#{wtId},#{createUserTel},#{startTime},#{endTime},#{state},#{communityId}
        )
    </insert>
 
 
    <!-- 查询工作单信息 add by wuxw 2018-07-03 -->
    <select id="getWorkPoolInfo" parameterType="Map" resultType="Map">
        select t.work_cycle,t.work_cycle workCycle,t.create_user_id,t.create_user_id
        createUserId,t.create_user_name,t.create_user_name createUserName,t.status_cd,t.status_cd
        statusCd,t.store_id,t.store_id storeId,t.work_name,t.work_name workName,t.work_id,t.work_id
        workId,t.wt_id,t.wt_id wtId,t.create_user_tel,t.create_user_tel createUserTel,t.start_time,t.start_time
        startTime,t.end_time,t.end_time endTime,t.state,t.community_id,t.community_id communityId,t.create_time createTime,
        td.`name` stateName,wt.type_name typeName,wt.deduction
        from work_pool t
        left join work_type wt on t.wt_id = wt.wt_id
        left join t_dict td on t.state = td.status_cd and td.table_name = 'work_pool' and td.table_columns = 'state'
        where 1 =1
        <if test="createUserNameLike !=null and createUserNameLike != ''">
            and t.create_user_name like concat('%', #{createUserNameLike},'%')
        </if>
        <if test="workNameLike !=null and workNameLike != ''">
            and t.work_name like concat('%', #{workNameLike},'%')
        </if>
        <if test="workCycle !=null and workCycle != ''">
            and t.work_cycle= #{workCycle}
        </if>
        <if test="createUserId !=null and createUserId != ''">
            and t.create_user_id= #{createUserId}
        </if>
        <if test="createUserName !=null and createUserName != ''">
            and t.create_user_name= #{createUserName}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </if>
        <if test="workName !=null and workName != ''">
            and t.work_name= #{workName}
        </if>
        <if test="workId !=null and workId != ''">
            and t.work_id= #{workId}
        </if>
        <if test="wtId !=null and wtId != ''">
            and t.wt_id= #{wtId}
        </if>
        <if test="createUserTel !=null and createUserTel != ''">
            and t.create_user_tel= #{createUserTel}
        </if>
        <if test="startTime !=null and startTime != ''">
            and t.start_time= #{startTime}
        </if>
        <if test="endTime !=null and endTime != ''">
            and t.end_time= #{endTime}
        </if>
        <if test="queryStartTime !=null and queryStartTime !=''">
            and t.create_time &gt;= #{queryStartTime}
        </if>
        <if test="queryEndTime !=null and queryEndTime !=''">
            and t.create_time &lt;= #{queryEndTime}
        </if>
        <if test="state !=null and state != ''">
            and t.state= #{state}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        order by t.create_time desc
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>
 
    </select>
 
 
    <!-- 修改工作单信息 add by wuxw 2018-07-03 -->
    <update id="updateWorkPoolInfo" parameterType="Map">
        update work_pool t set t.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,t.b_id = #{newBId}
        </if>
        <if test="workCycle !=null and workCycle != ''">
            , t.work_cycle= #{workCycle}
        </if>
        <if test="createUserId !=null and createUserId != ''">
            , t.create_user_id= #{createUserId}
        </if>
        <if test="createUserName !=null and createUserName != ''">
            , t.create_user_name= #{createUserName}
        </if>
        <if test="storeId !=null and storeId != ''">
            , t.store_id= #{storeId}
        </if>
        <if test="workName !=null and workName != ''">
            , t.work_name= #{workName}
        </if>
        <if test="wtId !=null and wtId != ''">
            , t.wt_id= #{wtId}
        </if>
        <if test="createUserTel !=null and createUserTel != ''">
            , t.create_user_tel= #{createUserTel}
        </if>
        <if test="startTime !=null and startTime != ''">
            , t.start_time= #{startTime}
        </if>
        <if test="endTime !=null and endTime != ''">
            , t.end_time= #{endTime}
        </if>
        <if test="state !=null and state != ''">
            , t.state= #{state}
        </if>
        where 1=1
        <if test="workId !=null and workId != ''">
            and t.work_id= #{workId}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
 
    </update>
 
    <!-- 查询工作单数量 add by wuxw 2018-07-03 -->
    <select id="queryWorkPoolsCount" parameterType="Map" resultType="Map">
        select count(1) count
        from work_pool t
        where 1 =1
        <if test="createUserNameLike !=null and createUserNameLike != ''">
            and t.create_user_name like concat('%', #{createUserNameLike},'%')
        </if>
        <if test="workNameLike !=null and workNameLike != ''">
            and t.work_name like concat('%', #{workNameLike},'%')
        </if>
        <if test="workCycle !=null and workCycle != ''">
            and t.work_cycle= #{workCycle}
        </if>
        <if test="createUserId !=null and createUserId != ''">
            and t.create_user_id= #{createUserId}
        </if>
        <if test="createUserName !=null and createUserName != ''">
            and t.create_user_name= #{createUserName}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </if>
        <if test="workName !=null and workName != ''">
            and t.work_name= #{workName}
        </if>
        <if test="workId !=null and workId != ''">
            and t.work_id= #{workId}
        </if>
        <if test="wtId !=null and wtId != ''">
            and t.wt_id= #{wtId}
        </if>
        <if test="createUserTel !=null and createUserTel != ''">
            and t.create_user_tel= #{createUserTel}
        </if>
        <if test="startTime !=null and startTime != ''">
            and t.start_time= #{startTime}
        </if>
        <if test="endTime !=null and endTime != ''">
            and t.end_time= #{endTime}
        </if>
 
        <if test="queryStartTime !=null and queryStartTime !=''">
            and t.create_time &gt;= #{queryStartTime}
        </if>
        <if test="queryEndTime !=null and queryEndTime !=''">
            and t.create_time &lt;= #{queryEndTime}
        </if>
        <if test="state !=null and state != ''">
            and t.state= #{state}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
 
 
    </select>
 
    <select id="queryTaskWorkPoolsCount" parameterType="Map" resultType="Map">
        select count(1) count
        from work_pool t
        left join work_type wt on t.wt_id = wt.wt_id
        left join work_task wtk on t.work_id = wtk.work_id and wtk.status_cd = '0'
        left join t_dict td on wtk.state = td.status_cd and td.table_name = 'work_pool' and td.table_columns = 'state'
        where 1 =1
        <if test="createUserNameLike !=null and createUserNameLike != ''">
            and t.create_user_name like concat('%', #{createUserNameLike},'%')
        </if>
        <if test="workNameLike !=null and workNameLike != ''">
            and t.work_name like concat('%', #{workNameLike},'%')
        </if>
        <if test="workCycle !=null and workCycle != ''">
            and t.work_cycle= #{workCycle}
        </if>
        <if test="staffId !=null and staffId != ''">
            and wtk.staff_id= #{staffId}
        </if>
        <if test="staffName !=null and staffName != ''">
            and wtk.staff_name = #{staffName}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </if>
        <if test="workName !=null and workName != ''">
            and t.work_name= #{workName}
        </if>
        <if test="workId !=null and workId != ''">
            and t.work_id= #{workId}
        </if>
        <if test="wtId !=null and wtId != ''">
            and t.wt_id= #{wtId}
        </if>
        <if test="states != null">
            and wtk.state in
            <foreach collection="states" item="item" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
 
        <if test="queryStartTime !=null and queryStartTime !=''">
            and wtk.create_time &gt;= #{queryStartTime}
        </if>
        <if test="queryEndTime !=null and queryEndTime !=''">
            and wtk.create_time &lt;= #{queryEndTime}
        </if>
        <if test="state !=null and state != ''">
            and wtk.state= #{state}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
 
 
    </select>
 
    <select id="queryTaskWorkPools" parameterType="Map" resultType="Map">
        select t.work_cycle,t.work_cycle workCycle,t.create_user_id
        createUserId,t.create_user_name,t.create_user_name createUserName,t.status_cd,t.status_cd
        statusCd,t.store_id storeId,t.work_name workName,t.work_id
        workId,t.wt_id wtId,t.create_user_tel createUserTel,wtk.start_time
        startTime,wtk.end_time endTime,wtk.state,t.community_id communityId,wtk.create_time createTime,
        td.`name` stateName,wt.type_name typeName,wtk.staff_name curStaffName,wtk.task_id taskId
        from work_pool t
        left join work_type wt on t.wt_id = wt.wt_id
        left join work_task wtk on t.work_id = wtk.work_id and wtk.status_cd = '0'
        left join t_dict td on wtk.state = td.status_cd and td.table_name = 'work_pool' and td.table_columns = 'state'
        where 1 =1
        <if test="createUserNameLike !=null and createUserNameLike != ''">
            and t.create_user_name like concat('%', #{createUserNameLike},'%')
        </if>
        <if test="workNameLike !=null and workNameLike != ''">
            and t.work_name like concat('%', #{workNameLike},'%')
        </if>
        <if test="workCycle !=null and workCycle != ''">
            and t.work_cycle= #{workCycle}
        </if>
        <if test="staffId !=null and staffId != ''">
            and wtk.staff_id= #{staffId}
        </if>
        <if test="staffName !=null and staffName != ''">
            and wtk.staff_name = #{staffName}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </if>
        <if test="workName !=null and workName != ''">
            and t.work_name= #{workName}
        </if>
        <if test="workId !=null and workId != ''">
            and t.work_id= #{workId}
        </if>
        <if test="wtId !=null and wtId != ''">
            and t.wt_id= #{wtId}
        </if>
        <if test="states != null">
            and wtk.state in
            <foreach collection="states" item="item" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="queryStartTime !=null and queryStartTime !=''">
            and wtk.create_time &gt;= #{queryStartTime}
        </if>
        <if test="queryEndTime !=null and queryEndTime !=''">
            and wtk.create_time &lt;= #{queryEndTime}
        </if>
        <if test="state !=null and state != ''">
            and wtk.state= #{state}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        order by wtk.create_time desc
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>
 
    </select>
 
    <select id="queryCopyWorkPoolsCount" parameterType="Map" resultType="Map">
        select count(1) count
        from work_pool t
        left join work_type wt on t.wt_id = wt.wt_id
        left join work_copy wc on t.work_id = wc.work_id and wc.status_cd = '0'
        left join t_dict td on wc.state = td.status_cd and td.table_name = 'work_pool' and td.table_columns = 'state'
        where 1 =1
        <if test="createUserNameLike !=null and createUserNameLike != ''">
            and t.create_user_name like concat('%', #{createUserNameLike},'%')
        </if>
        <if test="workNameLike !=null and workNameLike != ''">
            and t.work_name like concat('%', #{workNameLike},'%')
        </if>
        <if test="workCycle !=null and workCycle != ''">
            and t.work_cycle= #{workCycle}
        </if>
        <if test="staffId !=null and staffId != ''">
            and wc.staff_id= #{staffId}
        </if>
        <if test="staffName !=null and staffName != ''">
            and wc.staff_name = #{staffName}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </if>
        <if test="workName !=null and workName != ''">
            and t.work_name= #{workName}
        </if>
        <if test="workId !=null and workId != ''">
            and t.work_id= #{workId}
        </if>
        <if test="wtId !=null and wtId != ''">
            and t.wt_id= #{wtId}
        </if>
 
        <if test="queryStartTime !=null and queryStartTime !=''">
            and wc.create_time &gt;= #{queryStartTime}
        </if>
        <if test="queryEndTime !=null and queryEndTime !=''">
            and wc.create_time &lt;= #{queryEndTime}
        </if>
        <if test="state !=null and state != ''">
            and wc.state= #{state}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
 
 
    </select>
 
    <select id="queryCopyWorkPools" parameterType="Map" resultType="Map">
        select t.work_cycle,t.work_cycle workCycle,t.create_user_id
        createUserId,t.create_user_name,t.create_user_name createUserName,t.status_cd,t.status_cd
        statusCd,t.store_id storeId,t.work_name workName,t.work_id
        workId,t.wt_id wtId,t.create_user_tel createUserTel,t.start_time
        startTime,t.end_time endTime,wc.state,t.community_id communityId,t.create_time createTime,
        td.`name` stateName,wt.type_name typeName,wc.staff_name curCopyName,wc.copy_id copyId,wc.remark
        from work_pool t
        left join work_type wt on t.wt_id = wt.wt_id
        left join work_copy wc on t.work_id = wc.work_id and wc.status_cd = '0'
        left join t_dict td on wc.state = td.status_cd and td.table_name = 'work_pool' and td.table_columns = 'state'
        where 1 =1
        <if test="createUserNameLike !=null and createUserNameLike != ''">
            and t.create_user_name like concat('%', #{createUserNameLike},'%')
        </if>
        <if test="workNameLike !=null and workNameLike != ''">
            and t.work_name like concat('%', #{workNameLike},'%')
        </if>
        <if test="workCycle !=null and workCycle != ''">
            and t.work_cycle= #{workCycle}
        </if>
        <if test="staffId !=null and staffId != ''">
            and wc.staff_id= #{staffId}
        </if>
        <if test="staffName !=null and staffName != ''">
            and wc.staff_name = #{staffName}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </if>
        <if test="workName !=null and workName != ''">
            and t.work_name= #{workName}
        </if>
        <if test="workId !=null and workId != ''">
            and t.work_id= #{workId}
        </if>
        <if test="wtId !=null and wtId != ''">
            and t.wt_id= #{wtId}
        </if>
 
        <if test="queryStartTime !=null and queryStartTime !=''">
            and wc.create_time &gt;= #{queryStartTime}
        </if>
        <if test="queryEndTime !=null and queryEndTime !=''">
            and wc.create_time &lt;= #{queryEndTime}
        </if>
        <if test="state !=null and state != ''">
            and wc.state= #{state}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        order by wc.create_time desc
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>
 
    </select>
 
</mapper>