linwe
2024-06-13 b636e92e32c2a698e2590210037c471e45b9c88a
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
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
<?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="org.springblade.modules.eCallEventTwo.mapper.EcOrderMapper">
 
    <resultMap type="org.springblade.modules.eCallEventTwo.dto.EcOrderDTO" id="EcOrderDTOResult">
        <result property="id"    column="id"    />
        <result property="orderId"    column="order_id"    />
        <result property="orderCode"    column="order_code"    />
        <result property="issueOrigin"    column="issue_origin"    />
        <result property="issueTitle"    column="issue_title"    />
        <result property="issueContent"    column="issue_content"    />
        <result property="applicantType"    column="applicant_type"    />
        <result property="applicantName"    column="applicant_name"    />
        <result property="applicantGender"    column="applicant_gender"    />
        <result property="applicantHomeaddr"    column="applicant_homeaddr"    />
        <result property="applicantPhone"    column="applicant_phone"    />
        <result property="applicantGrid"    column="applicant_grid"    />
        <result property="applicantDistrict"    column="applicant_district"    />
        <result property="sceneAddr"    column="scene_addr"    />
        <result property="sceneAddrGrid"    column="scene_addr_grid"    />
        <result property="sceneDistrict"    column="scene_district"    />
        <result property="scenePlace"    column="scene_place"    />
        <result property="sceneGeoLat"    column="scene_geo_lat"    />
        <result property="sceneGeoLng"    column="scene_geo_lng"    />
        <result property="sceneAddrCor"    column="scene_addr_cor"    />
        <result property="sceneGeoLatCor"    column="scene_geo_lat_cor"    />
        <result property="sceneGeoLngCor"    column="scene_geo_lng_cor"    />
        <result property="isSecret"    column="is_secret"    />
        <result property="isRepeat"    column="is_repeat"    />
        <result property="issueType"    column="issue_type"    />
        <result property="issueClazz"    column="issue_clazz"    />
        <result property="issueLevel"    column="issue_level"    />
        <result property="deadline"    column="deadline"    />
        <result property="linkOrders"    column="link_orders"    />
        <result property="linkOrdersCode"    column="link_orders_code"    />
        <result property="wikiRef"    column="wiki_ref"    />
        <result property="acptOrgCode"    column="acpt_org_code"    />
        <result property="acptOrgName"    column="acpt_org_name"    />
        <result property="handleWay"    column="handle_way"    />
        <result property="externalHandleWay"    column="external_handle_way"    />
        <result property="directFeed"    column="direct_feed"    />
        <result property="directFeedHandler"    column="direct_feed_handler"    />
        <result property="directFeedTime"    column="direct_feed_time"    />
        <result property="images"    column="images"    />
        <result property="flagVaild"    column="flag_vaild"    />
        <result property="invalidNote"    column="invalid_note"    />
        <result property="invalidTime"    column="invalid_time"    />
        <result property="invalidUserName"    column="invalid_user_name"    />
        <result property="status"    column="status"    />
        <result property="tagApply"    column="tag_apply"    />
        <result property="tagDelay"    column="tag_delay"    />
        <result property="tagDoing"    column="tag_doing"    />
        <result property="tagResp"    column="tag_resp"    />
        <result property="tagDone"    column="tag_done"    />
        <result property="tagCheck"    column="tag_check"    />
        <result property="tagChkTel"    column="tag_chk_tel"    />
        <result property="tagRedo"    column="tag_redo"    />
    </resultMap>
 
    <sql id="selectEcOrder">
        select id,
            order_id,
            order_code,
            issue_origin,
            issue_title,
            issue_content,
            applicant_type,
            applicant_name,
            applicant_gender,
            applicant_homeaddr,
            applicant_phone,
            applicant_grid,
            applicant_district,
            scene_addr,
            scene_addr_grid,
            scene_district,
            scene_place,
            scene_geo_lat,
            scene_geo_lng,
            scene_addr_cor,
            scene_geo_lat_cor,
            scene_geo_lng_cor,
            is_secret,
            is_repeat,
            issue_type,
            issue_clazz,
            issue_level,
            deadline,
            link_orders,
            link_orders_code,
            wiki_ref,
            acpt_org_code,
            acpt_org_name,
            handle_way,
            external_handle_way,
            direct_feed,
            direct_feed_handler,
            direct_feed_time,
            images,
            flag_vaild,
            invalid_note,
            invalid_time,
            invalid_user_name,
            status,
            tag_apply,
            tag_delay,
            tag_doing,
            tag_resp,
            tag_done,
            tag_check,
            tag_chk_tel,
            tag_redo
        from
            ec_order
    </sql>
 
    <select id="selectEcOrderById" parameterType="long" resultMap="EcOrderDTOResult">
        <include refid="selectEcOrder"/>
        where
            order_id = #{orderId}
    </select>
 
    <select id="selectEcOrderList" parameterType="org.springblade.modules.eCallEventTwo.dto.EcOrderDTO" resultMap="EcOrderDTOResult">
        SELECT
        *
        FROM ec_order
        <where>
        <if test="startTime != null and endTime != null">and eoc.callin_time BETWEEN #{startTime} AND #{endTime}
        </if>
        <if test="orderId != null "> and order_id = #{orderId}</if>
        <if test="orderCode != null  and orderCode != ''"> and order_code = #{orderCode}</if>
        <if test="issueOrigin != null  and issueOrigin != ''"> and issue_origin = #{issueOrigin}</if>
        <if test="issueTitle != null  and issueTitle != ''"> and issue_title = #{issueTitle}</if>
        <if test="issueContent != null  and issueContent != ''"> and issue_content = #{issueContent}</if>
        <if test="applicantType != null  and applicantType != ''"> and applicant_type = #{applicantType}</if>
        <if test="applicantName != null  and applicantName != ''"> and applicant_name = #{applicantName}</if>
        <if test="applicantGender != null  and applicantGender != ''"> and applicant_gender = #{applicantGender}</if>
        <if test="applicantHomeaddr != null  and applicantHomeaddr != ''"> and applicant_homeaddr = #{applicantHomeaddr}</if>
        <if test="applicantPhone != null  and applicantPhone != ''"> and applicant_phone = #{applicantPhone}</if>
        <if test="applicantGrid != null  and applicantGrid != ''"> and applicant_grid = #{applicantGrid}</if>
        <if test="applicantDistrict != null  and applicantDistrict != ''"> and applicant_district = #{applicantDistrict}</if>
        <if test="sceneAddr != null  and sceneAddr != ''"> and scene_addr = #{sceneAddr}</if>
            <if test="sceneAddrGrid != null  and sceneAddrGrid != ''">and scene_addr_grid = #{sceneAddrGrid}</if>
            <if test="sceneDistrict != null  and sceneDistrict != ''">and scene_district = #{sceneDistrict}</if>
            <if test="scenePlace != null  and scenePlace != ''">and scene_place = #{scenePlace}</if>
            <if test="sceneGeoLat != null ">and scene_geo_lat = #{sceneGeoLat}</if>
            <if test="sceneGeoLng != null ">and scene_geo_lng = #{sceneGeoLng}</if>
            <if test="sceneAddrCor != null  and sceneAddrCor != ''">and scene_addr_cor = #{sceneAddrCor}</if>
            <if test="sceneGeoLatCor != null ">and scene_geo_lat_cor = #{sceneGeoLatCor}</if>
            <if test="sceneGeoLngCor != null ">and scene_geo_lng_cor = #{sceneGeoLngCor}</if>
            <if test="isSecret != null  and isSecret != ''">and is_secret = #{isSecret}</if>
            <if test="isRepeat != null  and isRepeat != ''">and is_repeat = #{isRepeat}</if>
            <if test="issueType != null  and issueType != ''">and issue_type = #{issueType}</if>
            <if test="issueClazz != null  and issueClazz != ''">and issue_clazz = #{issueClazz}</if>
            <if test="issueLevel != null  and issueLevel != ''">and issue_level = #{issueLevel}</if>
            <if test="deadline != null ">and deadline = #{deadline}</if>
            <if test="linkOrders != null  and linkOrders != ''">and link_orders = #{linkOrders}</if>
            <if test="linkOrdersCode != null  and linkOrdersCode != ''">and link_orders_code = #{linkOrdersCode}</if>
            <if test="wikiRef != null  and wikiRef != ''">and wiki_ref = #{wikiRef}</if>
            <if test="acptOrgCode != null  and acptOrgCode != ''">and acpt_org_code = #{acptOrgCode}</if>
            <if test="acptOrgName != null  and acptOrgName != ''">and acpt_org_name = #{acptOrgName}</if>
            <if test="handleWay != null  and handleWay != ''">and handle_way = #{handleWay}</if>
            <if test="externalHandleWay != null  and externalHandleWay != ''">and external_handle_way =
                #{externalHandleWay}
            </if>
            <if test="directFeed != null  and directFeed != ''">and direct_feed = #{directFeed}</if>
            <if test="directFeedHandler != null  and directFeedHandler != ''">and direct_feed_handler =
                #{directFeedHandler}
            </if>
            <if test="directFeedTime != null ">and direct_feed_time = #{directFeedTime}</if>
            <if test="images != null  and images != ''">and images = #{images}</if>
            <if test="flagVaild != null  and flagVaild != ''">and flag_vaild = #{flagVaild}</if>
            <if test="invalidNote != null  and invalidNote != ''">and invalid_note = #{invalidNote}</if>
            <if test="invalidTime != null ">and invalid_time = #{invalidTime}</if>
            <if test="invalidUserName != null  and invalidUserName != ''">and invalid_user_name = #{invalidUserName}
            </if>
            <if test="status != null  and status != ''">and status = #{status}</if>
            <if test="tagApply != null  and tagApply != ''">and tag_apply = #{tagApply}</if>
            <if test="tagDelay != null  and tagDelay != ''">and tag_delay = #{tagDelay}</if>
            <if test="tagDoing != null  and tagDoing != ''">and tag_doing = #{tagDoing}</if>
            <if test="tagResp != null  and tagResp != ''">and tag_resp = #{tagResp}</if>
            <if test="tagDone != null  and tagDone != ''">and tag_done = #{tagDone}</if>
            <if test="tagCheck != null  and tagCheck != ''">and tag_check = #{tagCheck}</if>
            <if test="tagChkTel != null  and tagChkTel != ''">and tag_chk_tel = #{tagChkTel}</if>
            <if test="tagRedo != null  and tagRedo != ''">and tag_redo = #{tagRedo}</if>
        </where>
    </select>
 
 
    <select id="selectEcOrderCount" parameterType="org.springblade.modules.eCallEventTwo.dto.EcOrderDTO"
            resultType="java.lang.Integer">
        SELECT
        COUNT(DISTINCT(eo.order_id))
        FROM ec_order eo
        LEFT JOIN ec_dispatch ed ON eo.order_id = ed.order_id
        LEFT JOIN ec_order_cti eoc on eoc.order_id = eo.order_id
        <where>
            <if test="tagMain != null and tagMain != ''">and ed.tag_main = #{tagMain}</if>
            <if test="subjectOrgCode != null and subjectOrgCode != ''">and ed.subject_org_code = #{subjectOrgCode}</if>
            <if test="sinkOrgCode != null and sinkOrgCode != ''">and ed.sink_org_code = #{sinkOrgCode}</if>
            <if test="startTime != null and endTime != null">and eoc.callin_time BETWEEN #{startTime} AND #{endTime}
            </if>
 
            <if test="orderId != null ">and eo.order_id = #{orderId}</if>
            <if test="orderCode != null  and orderCode != ''">and eo.order_code = #{orderCode}</if>
            <if test="issueOrigin != null  and issueOrigin != ''">and eo.issue_origin = #{issueOrigin}</if>
            <if test="issueTitle != null  and issueTitle != ''">and eo.issue_title = #{issueTitle}</if>
            <if test="issueContent != null  and issueContent != ''">and eo.issue_content = #{issueContent}</if>
            <if test="applicantType != null  and applicantType != ''">and eo.applicant_type = #{applicantType}</if>
            <if test="applicantName != null  and applicantName != ''">and eo.applicant_name = #{applicantName}</if>
            <if test="applicantGender != null  and applicantGender != ''">and eo.applicant_gender = #{applicantGender}
            </if>
            <if test="applicantHomeaddr != null  and applicantHomeaddr != ''">and eo.applicant_homeaddr =
                #{applicantHomeaddr}
            </if>
            <if test="applicantPhone != null  and applicantPhone != ''">and eo.applicant_phone = #{applicantPhone}</if>
            <if test="applicantGrid != null  and applicantGrid != ''">and eo.applicant_grid = #{applicantGrid}</if>
            <if test="applicantDistrict != null  and applicantDistrict != ''">and eo.applicant_district =
                #{applicantDistrict}
            </if>
            <if test="sceneAddr != null  and sceneAddr != ''">and eo.scene_addr = #{sceneAddr}</if>
            <if test="sceneAddrGrid != null  and sceneAddrGrid != ''">and eo.scene_addr_grid = #{sceneAddrGrid}</if>
            <if test="sceneDistrict != null  and sceneDistrict != ''">and eo.scene_district = #{sceneDistrict}</if>
            <if test="scenePlace != null  and scenePlace != ''">and eo.scene_place = #{scenePlace}</if>
            <if test="sceneGeoLat != null ">and eo.scene_geo_lat = #{sceneGeoLat}</if>
            <if test="sceneGeoLng != null ">and eo.scene_geo_lng = #{sceneGeoLng}</if>
            <if test="sceneAddrCor != null  and sceneAddrCor != ''">and eo.scene_addr_cor = #{sceneAddrCor}</if>
            <if test="sceneGeoLatCor != null ">and eo.scene_geo_lat_cor = #{sceneGeoLatCor}</if>
            <if test="sceneGeoLngCor != null ">and eo.scene_geo_lng_cor = #{sceneGeoLngCor}</if>
            <if test="isSecret != null  and isSecret != ''">and eo.is_secret = #{isSecret}</if>
            <if test="isRepeat != null  and isRepeat != ''">and eo.is_repeat = #{isRepeat}</if>
            <if test="issueType != null  and issueType != ''">and eo.issue_type = #{issueType}</if>
            <if test="issueClazz != null  and issueClazz != ''">and eo.issue_clazz = #{issueClazz}</if>
            <if test="issueLevel != null  and issueLevel != ''">and eo.issue_level = #{issueLevel}</if>
            <if test="deadline != null ">and eo.deadline = #{deadline}</if>
            <if test="linkOrders != null  and linkOrders != ''">and eo.link_orders = #{linkOrders}</if>
            <if test="linkOrdersCode != null  and linkOrdersCode != ''">and eo.link_orders_code = #{linkOrdersCode}</if>
            <if test="wikiRef != null  and wikiRef != ''">and eo.wiki_ref = #{wikiRef}</if>
            <if test="acptOrgCode != null  and acptOrgCode != ''">and eo.acpt_org_code = #{acptOrgCode}</if>
            <if test="acptOrgName != null  and acptOrgName != ''">and eo.acpt_org_name = #{acptOrgName}</if>
            <if test="handleWay != null  and handleWay != ''">and eo.handle_way = #{handleWay}</if>
            <if test="externalHandleWay != null  and externalHandleWay != ''">and eo.external_handle_way =
                #{externalHandleWay}
            </if>
            <if test="directFeed != null  and directFeed != ''">and eo.direct_feed = #{directFeed}</if>
            <if test="directFeedHandler != null  and directFeedHandler != ''">and eo.direct_feed_handler =
                #{directFeedHandler}
            </if>
            <if test="directFeedTime != null ">and eo.direct_feed_time = #{directFeedTime}</if>
            <if test="images != null  and images != ''">and eo.images = #{images}</if>
            <if test="flagVaild != null  and flagVaild != ''">and eo.flag_vaild = #{flagVaild}</if>
            <if test="invalidNote != null  and invalidNote != ''">and eo.invalid_note = #{invalidNote}</if>
            <if test="invalidTime != null ">and eo.invalid_time = #{invalidTime}</if>
            <if test="invalidUserName != null  and invalidUserName != ''">and eo.invalid_user_name = #{invalidUserName}
            </if>
            <if test="status != null  and status != ''">and eo.status = #{status}</if>
            <if test="tagApply != null  and tagApply != ''">and eo.tag_apply = #{tagApply}</if>
            <if test="tagDelay != null  and tagDelay != ''">and eo.tag_delay = #{tagDelay}</if>
            <if test="tagDoing != null  and tagDoing != ''">and eo.tag_doing = #{tagDoing}</if>
            <if test="tagResp != null  and tagResp != ''">and eo.tag_resp = #{tagResp}</if>
            <if test="tagDone != null  and tagDone != ''">and eo.tag_done = #{tagDone}</if>
            <if test="tagCheck != null  and tagCheck != ''">and eo.tag_check = #{tagCheck}</if>
            <if test="tagChkTel != null  and tagChkTel != ''">and eo.tag_chk_tel = #{tagChkTel}</if>
            <if test="tagRedo != null  and tagRedo != ''">and eo.tag_redo = #{tagRedo}</if>
        </where>
    </select>
 
 
    <select id="selectEcDispatchCount" parameterType="org.springblade.modules.eCallEventTwo.dto.EcDispatchDTO"
            resultType="java.lang.Integer">
        SELECT
        COUNT(1)
        FROM
        ec_dispatch ed
        LEFT JOIN ec_order eo ON eo.order_id = ed.order_id
        LEFT JOIN ec_order_cti eoc on eoc.order_id = eo.order_id
        <where>
            <if test="tagMain != null and tagMain != ''">and ed.tag_main = #{tagMain}</if>
            <if test="subjectOrgCode != null and subjectOrgCode != ''">and ed.subject_org_code = #{subjectOrgCode}</if>
            <if test="sinkOrgCode != null and sinkOrgCode != ''">and ed.sink_org_code = #{sinkOrgCode}</if>
            <if test="startTime != null and endTime != null">and ed.dispatch_time BETWEEN #{startTime} AND #{endTime}
            </if>
            <if test="startTime != null and endTime != null">and eoc.callin_time BETWEEN #{startTime} AND #{endTime}
            </if>
 
            <if test="dispatchId != null ">and dispatch_id = #{dispatchId}</if>
            <if test="orderId != null ">and order_id = #{orderId}</if>
            <if test="dispatchCode != null  and dispatchCode != ''">and dispatch_code = #{dispatchCode}</if>
            <if test="dispatchTime != null ">and dispatch_time = #{dispatchTime}</if>
            <if test="dispatchNote != null  and dispatchNote != ''">and dispatch_note = #{dispatchNote}</if>
            <if test="dispatchImages != null  and dispatchImages != ''">and dispatch_images = #{dispatchImages}</if>
            <if test="subjectOrgCode != null  and subjectOrgCode != ''">and subject_org_code = #{subjectOrgCode}</if>
            <if test="subjectOrgName != null  and subjectOrgName != ''">and subject_org_name = #{subjectOrgName}</if>
            <if test="subjectUserName != null  and subjectUserName != ''">and subject_user_name = #{subjectUserName}
            </if>
            <if test="subjectUserCnname != null  and subjectUserCnname != ''">and subject_user_cnname =
                #{subjectUserCnname}
            </if>
            <if test="objectOrgCode != null  and objectOrgCode != ''">and object_org_code = #{objectOrgCode}</if>
            <if test="objectOrgName != null  and objectOrgName != ''">and object_org_name = #{objectOrgName}</if>
            <if test="sinkOrgCode != null  and sinkOrgCode != ''">and sink_org_code = #{sinkOrgCode}</if>
            <if test="sinkOrgName != null  and sinkOrgName != ''">and sink_org_name = #{sinkOrgName}</if>
            <if test="tagMain != null  and tagMain != ''">and tag_main = #{tagMain}</if>
            <if test="tagCc != null  and tagCc != ''">and tag_cc = #{tagCc}</if>
            <if test="tagCti != null  and tagCti != ''">and tag_cti = #{tagCti}</if>
            <if test="tagTrans != null  and tagTrans != ''">and tag_trans = #{tagTrans}</if>
            <if test="upDispatchId != null ">and up_dispatch_id = #{upDispatchId}</if>
            <if test="ackOrgCode != null  and ackOrgCode != ''">and ack_org_code = #{ackOrgCode}</if>
            <if test="ackOrgName != null  and ackOrgName != ''">and ack_org_name = #{ackOrgName}</if>
            <if test="ackUserName != null  and ackUserName != ''">and ack_user_name = #{ackUserName}</if>
            <if test="ackUserCnname != null  and ackUserCnname != ''">and ack_user_cnname = #{ackUserCnname}</if>
            <if test="ackTime != null ">and ack_time = #{ackTime}</if>
            <if test="rejectUserName != null  and rejectUserName != ''">and reject_user_name = #{rejectUserName}</if>
            <if test="rejectUserCnname != null  and rejectUserCnname != ''">and reject_user_cnname =
                #{rejectUserCnname}
            </if>
            <if test="rejectOrgCode != null  and rejectOrgCode != ''">and reject_org_code = #{rejectOrgCode}</if>
            <if test="rejectOrgName != null  and rejectOrgName != ''">and reject_org_name = #{rejectOrgName}</if>
            <if test="rejectTime != null ">and reject_time = #{rejectTime}</if>
            <if test="rejectNote != null  and rejectNote != ''">and reject_note = #{rejectNote}</if>
            <if test="rejectImages != null  and rejectImages != ''">and reject_images = #{rejectImages}</if>
            <if test="tagReject != null  and tagReject != ''">and tag_reject = #{tagReject}</if>
            <if test="rejectType != null  and rejectType != ''">and reject_type = #{rejectType}</if>
        </where>
    </select>
 
 
    <select id="selectEcHandleCount" parameterType="org.springblade.modules.eCallEventTwo.dto.EcHandleDTO"
            resultType="java.lang.Integer">
        SELECT
        COUNT(DISTINCT(ehd.uid))
        FROM
        ec_handle_doing ehd
        LEFT JOIN ec_handle eh ON ehd.order_id = eh.order_id
        LEFT JOIN ec_order eo ON eh.order_id = eo.order_id
        LEFT JOIN ec_dispatch ed ON eo.order_id = ed.order_id
        LEFT JOIN ec_order_cti eoc on eoc.order_id = eo.order_id
        <where>
            <if test="tagMain != null and tagMain != ''">and ed.tag_main = #{tagMain}</if>
            <if test="subjectOrgCode != null and subjectOrgCode != ''">and ed.subject_org_code = #{subjectOrgCode}</if>
            <if test="sinkOrgCode != null and sinkOrgCode != ''">and ed.sink_org_code = #{sinkOrgCode}</if>
            <if test="startTime != null and endTime != null">and ehd.biz_time BETWEEN #{startTime} AND
                #{endTime}
            </if>
            <if test="startTime != null and endTime != null">and eoc.callin_time BETWEEN #{startTime} AND #{endTime}
            </if>
 
            <if test="handleId != null ">and handle_id = #{handleId}</if>
            <if test="orderId != null ">and order_id = #{orderId}</if>
            <if test="dispatchId != null ">and dispatch_id = #{dispatchId}</if>
            <if test="handleCode != null  and handleCode != ''">and handle_code = #{handleCode}</if>
            <if test="hdlOrgCode != null  and hdlOrgCode != ''">and hdl_org_code = #{hdlOrgCode}</if>
            <if test="hdlOrgName != null  and hdlOrgName != ''">and hdl_org_name = #{hdlOrgName}</if>
            <if test="arriveLoc != null  and arriveLoc != ''">and arrive_loc = #{arriveLoc}</if>
            <if test="arriveLocLat != null ">and arrive_loc_lat = #{arriveLocLat}</if>
            <if test="arriveLocLng != null ">and arrive_loc_lng = #{arriveLocLng}</if>
            <if test="arriveBizTime != null ">and arrive_biz_time = #{arriveBizTime}</if>
            <if test="remoteHdlTime != null ">and remote_hdl_time = #{remoteHdlTime}</if>
            <if test="remoteHdlNote != null  and remoteHdlNote != ''">and remote_hdl_note = #{remoteHdlNote}</if>
            <if test="remoteHdlImages != null  and remoteHdlImages != ''">and remote_hdl_images = #{remoteHdlImages}
            </if>
            <if test="nosopHdlNote != null  and nosopHdlNote != ''">and nosop_hdl_note = #{nosopHdlNote}</if>
            <if test="nosopHdlImages != null  and nosopHdlImages != ''">and nosop_hdl_images = #{nosopHdlImages}</if>
            <if test="limitTime != null ">and limit_time = #{limitTime}</if>
            <if test="delayTime != null ">and delay_time = #{delayTime}</if>
            <if test="tagHdlDoing != null  and tagHdlDoing != ''">and tag_hdl_doing = #{tagHdlDoing}</if>
        </where>
    </select>
 
 
    <select id="selectEcOrderCheckCount" parameterType="org.springblade.modules.eCallEventTwo.dto.EcOrderCheckDTO"
            resultType="java.lang.Integer">
        SELECT
        COUNT(
        DISTINCT ( eoct.uid ))
        FROM
        ec_order_check_tel eoct
        LEFT JOIN ec_order_check eoc ON eoct.order_id = eoc.order_id
        LEFT JOIN ec_order eo ON eoc.order_id = eo.order_id
        LEFT JOIN ec_dispatch ed ON eo.order_id = ed.order_id
        LEFT JOIN ec_order_cti eoci on eoci.order_id = eo.order_id
        <where>
            <if test="tagMain != null and tagMain != ''">and ed.tag_main = #{tagMain}</if>
            <if test="subjectOrgCode != null and subjectOrgCode != ''">and ed.subject_org_code = #{subjectOrgCode}</if>
            <if test="sinkOrgCode != null and sinkOrgCode != ''">and ed.sink_org_code = #{sinkOrgCode}</if>
            <if test="startTime != null and endTime != null">and eoct.chk_time BETWEEN #{startTime} AND #{endTime}</if>
            <if test="startTime != null and endTime != null">and eoci.callin_time BETWEEN #{startTime} AND #{endTime}
            </if>
 
            <if test="orderId != null ">and order_id = #{orderId}</if>
            <if test="checkCode != null  and checkCode != ''">and check_code = #{checkCode}</if>
            <if test="checkOrgCode != null  and checkOrgCode != ''">and check_org_code = #{checkOrgCode}</if>
            <if test="checkOrgName != null  and checkOrgName != ''">and check_org_name = #{checkOrgName}</if>
            <if test="limitStartTime != null ">and limit_start_time = #{limitStartTime}</if>
            <if test="limitEndTime != null ">and limit_end_time = #{limitEndTime}</if>
        </where>
    </select>
 
 
    <select id="selectEcOrderDoneCount" parameterType="org.springblade.modules.eCallEventTwo.dto.EcOrderDoneDTO"
            resultType="java.lang.Integer">
        SELECT
        COUNT(
        DISTINCT ( eodl.uid ))
        FROM
        ec_order_done_log eodl
        LEFT JOIN ec_order_done eod ON eod.order_id = eodl.order_id
        LEFT JOIN ec_order eo ON eod.order_id = eo.order_id
        LEFT JOIN ec_dispatch ed ON eo.order_id = ed.order_id
        LEFT JOIN ec_order_cti eoc on eoc.order_id = eo.order_id
        <where>
            <if test="tagMain != null and tagMain != ''">and ed.tag_main = #{tagMain}</if>
            <if test="subjectOrgCode != null and subjectOrgCode != ''">and ed.subject_org_code = #{subjectOrgCode}</if>
            <if test="sinkOrgCode != null and sinkOrgCode != ''">and ed.sink_org_code = #{sinkOrgCode}</if>
            <if test="startTime != null and endTime != null">and eodl.in_audit_time BETWEEN #{startTime} AND
                #{endTime}
            </if>
            <if test="startTime != null and endTime != null">and eoc.callin_time BETWEEN #{startTime} AND #{endTime}
            </if>
 
            <if test="orderId != null ">and order_id = #{orderId}</if>
            <if test="doneCode != null  and doneCode != ''">and done_code = #{doneCode}</if>
            <if test="firstDoneApplyTime != null ">and first_done_apply_time = #{firstDoneApplyTime}</if>
            <if test="firstDoneAuditYesTime != null ">and first_done_audit_yes_time = #{firstDoneAuditYesTime}</if>
        </where>
    </select>
 
 
    <select id="selectEcOrderRespCount" parameterType="org.springblade.modules.eCallEventTwo.dto.EcOrderRespDTO"
            resultType="java.lang.Integer">
        SELECT
        COUNT(
        DISTINCT ( eorl.uid ))
        FROM
        ec_order_resp_log eorl
        LEFT JOIN ec_order_resp eor ON eorl.order_id = eor.order_id
        LEFT JOIN ec_order eo ON eor.order_id = eo.order_id
        LEFT JOIN ec_dispatch ed ON eo.order_id = ed.order_id
        LEFT JOIN ec_order_cti eoc on eoc.order_id = eo.order_id
        <where>
 
            <if test="tagMain != null and tagMain != ''">and ed.tag_main = #{tagMain}</if>
            <if test="subjectOrgCode != null and subjectOrgCode != ''">and ed.subject_org_code = #{subjectOrgCode}</if>
            <if test="sinkOrgCode != null and sinkOrgCode != ''">and ed.sink_org_code = #{sinkOrgCode}</if>
            <if test="startTime != null and endTime != null">and eorl.audit_time BETWEEN #{startTime} AND #{endTime}
            </if>
            <if test="startTime != null and endTime != null">and eoc.callin_time BETWEEN #{startTime} AND #{endTime}
            </if>
 
            <if test="orderId != null ">and order_id = #{orderId}</if>
            <if test="respCode != null  and respCode != ''">and resp_code = #{respCode}</if>
        </where>
    </select>
 
 
    <select id="selectEcOrderReviewCount" parameterType="org.springblade.modules.eCallEventTwo.dto.EcOrderReviewDTO"
            resultType="java.lang.Integer">
        SELECT
        COUNT(DISTINCT(eo.order_id))
        FROM
        ec_order_review eor
        LEFT JOIN ec_order eo on eor.order_id = eo.order_id
        LEFT JOIN ec_dispatch ed ON eo.order_id = ed.order_id
        LEFT JOIN ec_order_cti eoc on eoc.order_id = eo.order_id
        <where>
 
            <if test="tagMain != null and tagMain != ''">and ed.tag_main = #{tagMain}</if>
            <if test="subjectOrgCode != null and subjectOrgCode != ''">and ed.subject_org_code = #{subjectOrgCode}</if>
            <if test="sinkOrgCode != null and sinkOrgCode != ''">and ed.sink_org_code = #{sinkOrgCode}</if>
            <if test="startTime != null and endTime != null">and eor.review_time BETWEEN #{startTime} AND #{endTime}
            </if>
            <if test="startTime != null and endTime != null">and eoc.callin_time BETWEEN #{startTime} AND #{endTime}
            </if>
 
 
            <if test="orderId != null ">and order_id = #{orderId}</if>
            <if test="reviewCode != null  and reviewCode != ''">and review_code = #{reviewCode}</if>
            <if test="orderCode != null  and orderCode != ''">and order_code = #{orderCode}</if>
            <if test="telChkId != null ">and tel_chk_id = #{telChkId}</if>
            <if test="reviewTime != null ">and review_time = #{reviewTime}</if>
            <if test="reviewUserCnname != null  and reviewUserCnname != ''">and review_user_cnname =
                #{reviewUserCnname}
            </if>
            <if test="reviewUserName != null  and reviewUserName != ''">and review_user_name = #{reviewUserName}</if>
            <if test="reviewUserPhone != null  and reviewUserPhone != ''">and review_user_phone = #{reviewUserPhone}
            </if>
            <if test="reviewOrgCode != null  and reviewOrgCode != ''">and review_org_code = #{reviewOrgCode}</if>
            <if test="reviewOrgName != null  and reviewOrgName != ''">and review_org_name = #{reviewOrgName}</if>
            <if test="reviewIssuer != null  and reviewIssuer != ''">and review_issuer = #{reviewIssuer}</if>
            <if test="reviewIssuerPhone != null  and reviewIssuerPhone != ''">and review_issuer_phone =
                #{reviewIssuerPhone}
            </if>
            <if test="reviewNote != null  and reviewNote != ''">and review_note = #{reviewNote}</if>
            <if test="reviewYesno != null  and reviewYesno != ''">and review_yesno = #{reviewYesno}</if>
            <if test="reviewImages != null  and reviewImages != ''">and review_images = #{reviewImages}</if>
            <if test="ctiVoiceRecordId != null  and ctiVoiceRecordId != ''">and cti_voice_record_id =
                #{ctiVoiceRecordId}
            </if>
            <if test="ctiVoiceRecordUrl != null  and ctiVoiceRecordUrl != ''">and cti_voice_record_url =
                #{ctiVoiceRecordUrl}
            </if>
            <if test="redoOrgCode != null  and redoOrgCode != ''">and redo_org_code = #{redoOrgCode}</if>
            <if test="redoOrgName != null  and redoOrgName != ''">and redo_org_name = #{redoOrgName}</if>
            <if test="redoUserName != null  and redoUserName != ''">and redo_user_name = #{redoUserName}</if>
            <if test="redoUserCnname != null  and redoUserCnname != ''">and redo_user_cnname = #{redoUserCnname}</if>
            <if test="redoTime != null ">and redo_time = #{redoTime}</if>
            <if test="redoNote != null  and redoNote != ''">and redo_note = #{redoNote}</if>
            <if test="redoImages != null  and redoImages != ''">and redo_images = #{redoImages}</if>
        </where>
    </select>
 
 
    <select id="selectEcOrderSuperviseCount"
            parameterType="org.springblade.modules.eCallEventTwo.dto.EcOrderSuperviseDTO"
            resultType="java.lang.Integer">
        SELECT
        COUNT(DISTINCT(eo.order_id))
        FROM
        ec_order_supervise eos
        LEFT JOIN ec_order eo on eos.order_id = eo.order_id
        LEFT JOIN ec_dispatch ed ON eo.order_id = ed.order_id
        LEFT JOIN ec_order_cti eoc on eoc.order_id = eo.order_id
        <where>
            <if test="tagMain != null and tagMain != ''">and ed.tag_main = #{tagMain}</if>
            <if test="subjectOrgCode != null and subjectOrgCode != ''">and ed.subject_org_code = #{subjectOrgCode}</if>
            <if test="sinkOrgCode != null and sinkOrgCode != ''">and ed.sink_org_code = #{sinkOrgCode}</if>
            <if test="startTime != null and endTime != null">and eos.supervise_time BETWEEN #{startTime} AND
                #{endTime}
            </if>
            <if test="startTime != null and endTime != null">and eoc.callin_time BETWEEN #{startTime} AND #{endTime}
            </if>
 
 
            <if test="orderId != null ">and order_id = #{orderId}</if>
            <if test="superviseCode != null  and superviseCode != ''">and supervise_code = #{superviseCode}</if>
            <if test="orderCode != null  and orderCode != ''">and order_code = #{orderCode}</if>
            <if test="telChkId != null ">and tel_chk_id = #{telChkId}</if>
            <if test="superviseTime != null ">and supervise_time = #{superviseTime}</if>
            <if test="supervisorName != null  and supervisorName != ''">and supervisor_name = #{supervisorName}</if>
            <if test="supervisorCnname != null  and supervisorCnname != ''">and supervisor_cnname =
                #{supervisorCnname}
            </if>
            <if test="superviseNote != null  and superviseNote != ''">and supervise_note = #{superviseNote}</if>
            <if test="superviseImages != null  and superviseImages != ''">and supervise_images = #{superviseImages}</if>
            <if test="supervisorOrgCode != null  and supervisorOrgCode != ''">and supervisor_org_code =
                #{supervisorOrgCode}
            </if>
            <if test="supervisorOrgName != null  and supervisorOrgName != ''">and supervisor_org_name =
                #{supervisorOrgName}
            </if>
            <if test="redoOrgCode != null  and redoOrgCode != ''">and redo_org_code = #{redoOrgCode}</if>
            <if test="redoOrgName != null  and redoOrgName != ''">and redo_org_name = #{redoOrgName}</if>
            <if test="redoUserName != null  and redoUserName != ''">and redo_user_name = #{redoUserName}</if>
            <if test="redoUserCnname != null  and redoUserCnname != ''">and redo_user_cnname = #{redoUserCnname}</if>
            <if test="redoTime != null ">and redo_time = #{redoTime}</if>
            <if test="redoNote != null  and redoNote != ''">and redo_note = #{redoNote}</if>
            <if test="redoImages != null  and redoImages != ''">and redo_images = #{redoImages}</if>
        </where>
    </select>
 
 
    <select id="getUnitAssessmentIndicators" resultType="java.util.Map">
        select *
        from `v_statistics_examine_2`
 
    </select>
 
 
    <select id="getOrgCode" resultType="org.springblade.modules.eCallEventTwo.dto.EcOrderDTO">
        SELECT
        ed.subject_org_code,ed.subject_org_name,ed.sink_org_code,ed.sink_org_name
        FROM
        ec_order eo
        LEFT JOIN ec_dispatch ed ON eo.order_id = ed.order_id
        LEFT JOIN ec_order_cti eoc ON eoc.order_id = eo.order_id
        <where>
            <if test="ecOrderParamDTO.tagMain != null and ecOrderParamDTO.tagMain != '' ">
                and ed.tag_main = #{ecOrderParamDTO.tagMain}
                <if test="ecOrderParamDTO.mainFlag != null and ecOrderParamDTO.mainFlag == 2">
                    <if test="ecOrderParamDTO.subjectOrgName != null and ecOrderParamDTO.subjectOrgName != ''">
                        and ed.subject_org_name like concat('%',#{ecOrderParamDTO.subjectOrgName},'%')
                    </if>
                    GROUP BY ed.subject_org_code
                </if>
                <if test="ecOrderParamDTO.mainFlag != null and ecOrderParamDTO.mainFlag == 1">
                    <if test="ecOrderParamDTO.sinkOrgName != null and ecOrderParamDTO.sinkOrgName != ''">
                        and ed.sink_org_name like concat('%',#{ecOrderParamDTO.sinkOrgName},'%')
                    </if>
                    GROUP BY ed.sink_org_code
                </if>
 
            </if>
        </where>
 
 
    </select>
 
</mapper>