广州市综治平台后端
xusd
2025-06-07 36306491396230522fa20585c2621a7fc899849a
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
<?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">
<!--
 * @title: 调解案件信息表
 * @description: 自定义sql,请自行实现业务逻辑
 * @company: hugeinfo
 * @author: huangh
 * @time:2024年12月20日
 * @version 1.0.0
-->
<mapper namespace="cn.huge.module.knowledge.dao.mapper.DyhCaseInfoMapper">
    <!-- 结果集 -->
    <resultMap id="dataResult" type="cn.huge.module.knowledge.domain.po.DyhCaseInfo">
        <result property="id" column="id"/>
        <result property="caseTitle" column="case_title"/>
        <result property="caseRef" column="case_ref"/>
        <result property="caseLevel" column="case_level"/>
        <result property="visitTime" column="visit_time"/>
        <result property="visitPeopleNum" column="visit_people_num"/>
        <result property="mediType" column="medi_type"/>
        <result property="mediTypeName" column="medi_type_name"/>
        <result property="caseTypeFirst" column="case_type_first"/>
        <result property="caseTypeFirstName" column="case_type_first_name"/>
        <result property="caseType" column="case_type"/>
        <result property="caseTypeName" column="case_type_name"/>
        <result property="occurTime" column="occur_time"/>
        <result property="addr" column="addr"/>
        <result property="lng" column="lng"/>
        <result property="lat" column="lat"/>
        <result property="wgAddr" column="wg_addr"/>
        <result property="wgLng" column="wg_lng"/>
        <result property="wgLat" column="wg_lat"/>
        <result property="queProv" column="que_prov"/>
        <result property="queProvName" column="que_prov_name"/>
        <result property="queCity" column="que_city"/>
        <result property="queCityName" column="que_city_name"/>
        <result property="queArea" column="que_area"/>
        <result property="queAreaName" column="que_area_name"/>
        <result property="queRoad" column="que_road"/>
        <result property="queRoadName" column="que_road_name"/>
        <result property="queVillage" column="que_village"/>
        <result property="queVillageName" column="que_village_name"/>
        <result property="amount" column="amount"/>
        <result property="crowd" column="crowd"/>
        <result property="crowdName" column="crowd_name"/>
        <result property="canal" column="canal"/>
        <result property="canalName" column="canal_name"/>
        <result property="visitWay" column="visit_way"/>
        <result property="visitWayName" column="visit_way_name"/>
        <result property="zxslStatus" column="zxsl_status"/>
        <result property="caseDes" column="case_des"/>
        <result property="caseClaim" column="case_claim"/>
        <result property="majorStatus" column="major_status"/>
        <result property="source" column="source"/>
        <result property="sourceName" column="source_name"/>
        <result property="caseNo" column="case_no"/>
        <result property="mediateNo" column="mediate_no"/>
        <result property="mediateBookNo" column="mediate_book_no"/>
        <result property="civilNo" column="civil_no"/>
        <result property="plaintiffs" column="plaintiffs"/>
        <result property="pagents" column="pagents"/>
        <result property="defendants" column="defendants"/>
        <result property="dagents" column="dagents"/>
        <result property="partyShow" column="party_show"/>
        <result property="wantUnitId" column="want_unit_id"/>
        <result property="wantUnitName" column="want_unit_name"/>
        <result property="wantUserId" column="want_user_id"/>
        <result property="wantUserName" column="want_user_name"/>
        <result property="inputUnitId" column="input_unit_id"/>
        <result property="inputUnitName" column="input_unit_name"/>
        <result property="inputUserId" column="input_user_id"/>
        <result property="inputUserName" column="input_user_name"/>
        <result property="inputWay" column="input_way"/>
        <result property="status" column="status"/>
        <result property="statusName" column="status_name"/>
        <result property="process" column="process"/>
        <result property="processName" column="process_name"/>
        <result property="infoProcess" column="info_process"/>
        <result property="infoProcessName" column="info_process_name"/>
        <result property="deleteStatus" column="delete_status"/>
        <result property="custId" column="cust_id"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
        <result property="syncStatus" column="sync_status"/>
        <result property="oldCaseType" column="old_case_type"/>
        <result property="oldCaseTypeName" column="old_case_type_name"/>
    </resultMap>
 
    <!-- 案件详情查询结果映射 -->
    <resultMap id="CaseDetailResultMap" type="cn.huge.module.knowledge.domain.dto.DyhCaseDetailDTO">
        <id column="id" property="id"/>
        <result column="case_title" property="caseTitle"/>
        <result column="case_des" property="caseDes"/>
        <result column="case_claim" property="caseClaim"/>
        <result column="agree_content" property="agreeContent"/>
        <result column="plaintiffs" property="plaintiffs"/>
        <result column="defendants" property="defendants"/>
    </resultMap>
 
    <!-- 表 -->
    <sql id='table-name'>ai.dyh_case_info</sql>
    <!-- 字段 -->
    <sql id="column-part">
        id, case_title, case_ref, case_level, visit_time, visit_people_num, medi_type, medi_type_name, case_type_first, case_type_first_name, case_type, case_type_name, occur_time, addr, lng, lat, wg_addr, wg_lng, wg_lat, que_prov, que_prov_name, que_city, que_city_name, que_area, que_area_name, que_road, que_road_name, que_village, que_village_name, people_num, amount, crowd, crowd_name, canal, canal_name, visit_way, visit_way_name, zxsl_status, case_des, case_claim, major_status, source, source_name, case_no, mediate_no, mediate_book_no, civil_no, plaintiffs, pagents, defendants, dagents, party_show, want_unit_id, want_unit_name, want_user_id, want_user_name, input_unit_id, input_unit_name, input_user_id, input_user_name, input_way, status, status_name, process, process_name, info_process, info_process_name, delete_status, cust_id, create_time, update_time, sync_status, old_case_type, old_case_type_name
    </sql>
    <!-- 更新实体字段 -->
    <sql id="set-part">
        <if test="entity.caseTitle != null">case_title = #{entity.caseTitle},</if>
        <if test="entity.caseRef != null">case_ref = #{entity.caseRef},</if>
        <if test="entity.caseLevel != null">case_level = #{entity.caseLevel},</if>
        <if test="entity.visitTime != null">visit_time = #{entity.visitTime},</if>
        <if test="entity.visitPeopleNum != null">visit_people_num = #{entity.visitPeopleNum},</if>
        <if test="entity.mediType != null">medi_type = #{entity.mediType},</if>
        <if test="entity.mediTypeName != null">medi_type_name = #{entity.mediTypeName},</if>
        <if test="entity.caseTypeFirst != null">case_type_first = #{entity.caseTypeFirst},</if>
        <if test="entity.caseTypeFirstName != null">case_type_first_name = #{entity.caseTypeFirstName},</if>
        <if test="entity.caseType != null">case_type = #{entity.caseType},</if>
        <if test="entity.caseTypeName != null">case_type_name = #{entity.caseTypeName},</if>
        <if test="entity.occurTime != null">occur_time = #{entity.occurTime},</if>
        <if test="entity.addr != null">addr = #{entity.addr},</if>
        <if test="entity.lng != null">lng = #{entity.lng},</if>
        <if test="entity.lat != null">lat = #{entity.lat},</if>
        <if test="entity.wgAddr != null">wg_addr = #{entity.wgAddr},</if>
        <if test="entity.wgLng != null">wg_lng = #{entity.wgLng},</if>
        <if test="entity.wgLat != null">wg_lat = #{entity.wgLat},</if>
        <if test="entity.queProv != null">que_prov = #{entity.queProv},</if>
        <if test="entity.queProvName != null">que_prov_name = #{entity.queProvName},</if>
        <if test="entity.queCity != null">que_city = #{entity.queCity},</if>
        <if test="entity.queCityName != null">que_city_name = #{entity.queCityName},</if>
        <if test="entity.queArea != null">que_area = #{entity.queArea},</if>
        <if test="entity.queAreaName != null">que_area_name = #{entity.queAreaName},</if>
        <if test="entity.queRoad != null">que_road = #{entity.queRoad},</if>
        <if test="entity.queRoadName != null">que_road_name = #{entity.queRoadName},</if>
        <if test="entity.queVillage != null">que_village = #{entity.queVillage},</if>
        <if test="entity.queVillageName != null">que_village_name = #{entity.queVillageName},</if>
        <if test="entity.amount != null">amount = #{entity.amount},</if>
        <if test="entity.crowd != null">crowd = #{entity.crowd},</if>
        <if test="entity.crowdName != null">crowd_name = #{entity.crowdName},</if>
        <if test="entity.canal != null">canal = #{entity.canal},</if>
        <if test="entity.canalName != null">canal_name = #{entity.canalName},</if>
        <if test="entity.visitWay != null">visit_way = #{entity.visitWay},</if>
        <if test="entity.visitWayName != null">visit_way_name = #{entity.visitWayName},</if>
        <if test="entity.zxslStatus != null">zxsl_status = #{entity.zxslStatus},</if>
        <if test="entity.caseDes != null">case_des = #{entity.caseDes},</if>
        <if test="entity.caseClaim != null">case_claim = #{entity.caseClaim},</if>
        <if test="entity.majorStatus != null">major_status = #{entity.majorStatus},</if>
        <if test="entity.source != null">source = #{entity.source},</if>
        <if test="entity.sourceName != null">source_name = #{entity.sourceName},</if>
        <if test="entity.caseNo != null">case_no = #{entity.caseNo},</if>
        <if test="entity.mediateNo != null">mediate_no = #{entity.mediateNo},</if>
        <if test="entity.mediateBookNo != null">mediate_book_no = #{entity.mediateBookNo},</if>
        <if test="entity.civilNo != null">civil_no = #{entity.civilNo},</if>
        <if test="entity.plaintiffs != null">plaintiffs = #{entity.plaintiffs},</if>
        <if test="entity.pagents != null">pagents = #{entity.pagents},</if>
        <if test="entity.defendants != null">defendants = #{entity.defendants},</if>
        <if test="entity.dagents != null">dagents = #{entity.dagents},</if>
        <if test="entity.partyShow != null">party_show = #{entity.partyShow},</if>
        <if test="entity.wantUnitId != null">want_unit_id = #{entity.wantUnitId},</if>
        <if test="entity.wantUnitName != null">want_unit_name = #{entity.wantUnitName},</if>
        <if test="entity.wantUserId != null">want_user_id = #{entity.wantUserId},</if>
        <if test="entity.wantUserName != null">want_user_name = #{entity.wantUserName},</if>
        <if test="entity.inputUnitId != null">input_unit_id = #{entity.inputUnitId},</if>
        <if test="entity.inputUnitName != null">input_unit_name = #{entity.inputUnitName},</if>
        <if test="entity.inputUserId != null">input_user_id = #{entity.inputUserId},</if>
        <if test="entity.inputUserName != null">input_user_name = #{entity.inputUserName},</if>
        <if test="entity.inputWay != null">input_way = #{entity.inputWay},</if>
        <if test="entity.status != null">status = #{entity.status},</if>
        <if test="entity.statusName != null">status_name = #{entity.statusName},</if>
        <if test="entity.process != null">process = #{entity.process},</if>
        <if test="entity.processName != null">process_name = #{entity.processName},</if>
        <if test="entity.infoProcess != null">info_process = #{entity.infoProcess},</if>
        <if test="entity.infoProcessName != null">info_process_name = #{entity.infoProcessName},</if>
        <if test="entity.deleteStatus != null">delete_status = #{entity.deleteStatus},</if>
        <if test="entity.custId != null">cust_id = #{entity.custId},</if>
        <if test="entity.createTime != null">create_time = #{entity.createTime},</if>
        <if test="entity.updateTime != null">update_time = #{entity.updateTime},</if>
        <if test="entity.syncStatus != null">sync_status = #{entity.syncStatus},</if>
        <if test="entity.oldCaseType != null">old_case_type = #{entity.oldCaseType},</if>
        <if test="entity.oldCaseTypeName != null">old_case_type_name = #{entity.oldCaseTypeName}</if>
    </sql>
    <!-- 条件 -->
    <sql id="where-part">
        <if test="terms != null">
            <where>
                <if test="terms.caseTitle != null and terms.caseTitle !=''">
                    and case_title = #{terms.caseTitle}
                </if>
                <if test="terms.caseRef != null and terms.caseRef !=''">
                    and case_ref = #{terms.caseRef}
                </if>
                <if test="terms.caseLevel != null">
                    and case_level = #{terms.caseLevel}
                </if>
                <if test="terms.visitTime != null and terms.visitTime !=''">
                    and DATE_FORMAT(visit_time,'%Y-%m-%d') = #{terms.visitTime}
                </if>
                <if test="terms.visitStart != null and terms.visitStart !='' and terms.visitEnd != null and terms.visitEnd !=''">
                    and (DATE_FORMAT(visit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.visitStart}
                    and DATE_FORMAT(visit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.visitEnd})
                </if>
                <if test="terms.visitPeopleNum != null">
                    and visit_people_num = #{terms.visitPeopleNum}
                </if>
                <if test="terms.mediType != null and terms.mediType !=''">
                    and medi_type = #{terms.mediType}
                </if>
                <if test="terms.mediTypeName != null and terms.mediTypeName !=''">
                    and medi_type_name = #{terms.mediTypeName}
                </if>
                <if test="terms.caseTypeFirst != null and terms.caseTypeFirst !=''">
                    and case_type_first = #{terms.caseTypeFirst}
                </if>
                <if test="terms.caseTypeFirstName != null and terms.caseTypeFirstName !=''">
                    and case_type_first_name = #{terms.caseTypeFirstName}
                </if>
                <if test="terms.caseType != null and terms.caseType !=''">
                    and case_type = #{terms.caseType}
                </if>
                <if test="terms.caseTypeName != null and terms.caseTypeName !=''">
                    and case_type_name = #{terms.caseTypeName}
                </if>
                <if test="terms.occurTime != null and terms.occurTime !=''">
                    and DATE_FORMAT(occur_time,'%Y-%m-%d') = #{terms.occurTime}
                </if>
                <if test="terms.occurStart != null and terms.occurStart !='' and terms.occurEnd != null and terms.occurEnd !=''">
                    and (DATE_FORMAT(occur_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.occurStart}
                    and DATE_FORMAT(occur_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.occurEnd})
                </if>
                <if test="terms.addr != null and terms.addr !=''">
                    and addr = #{terms.addr}
                </if>
                <if test="terms.lng != null and terms.lng !=''">
                    and lng = #{terms.lng}
                </if>
                <if test="terms.lat != null and terms.lat !=''">
                    and lat = #{terms.lat}
                </if>
                <if test="terms.wgAddr != null and terms.wgAddr !=''">
                    and wg_addr = #{terms.wgAddr}
                </if>
                <if test="terms.wgLng != null and terms.wgLng !=''">
                    and wg_lng = #{terms.wgLng}
                </if>
                <if test="terms.wgLat != null and terms.wgLat !=''">
                    and wg_lat = #{terms.wgLat}
                </if>
                <if test="terms.queProv != null and terms.queProv !=''">
                    and que_prov = #{terms.queProv}
                </if>
                <if test="terms.queProvName != null and terms.queProvName !=''">
                    and que_prov_name = #{terms.queProvName}
                </if>
                <if test="terms.queCity != null and terms.queCity !=''">
                    and que_city = #{terms.queCity}
                </if>
                <if test="terms.queCityName != null and terms.queCityName !=''">
                    and que_city_name = #{terms.queCityName}
                </if>
                <if test="terms.queArea != null and terms.queArea !=''">
                    and que_area = #{terms.queArea}
                </if>
                <if test="terms.queAreaName != null and terms.queAreaName !=''">
                    and que_area_name = #{terms.queAreaName}
                </if>
                <if test="terms.queRoad != null and terms.queRoad !=''">
                    and que_road = #{terms.queRoad}
                </if>
                <if test="terms.queRoadName != null and terms.queRoadName !=''">
                    and que_road_name = #{terms.queRoadName}
                </if>
                <if test="terms.queVillage != null and terms.queVillage !=''">
                    and que_village = #{terms.queVillage}
                </if>
                <if test="terms.queVillageName != null and terms.queVillageName !=''">
                    and que_village_name = #{terms.queVillageName}
                </if>
                <if test="terms.peopleNum != null">
                    and people_num = #{terms.peopleNum}
                </if>
                <if test="terms.amount != null">
                    and amount = #{terms.amount}
                </if>
                <if test="terms.crowd != null and terms.crowd !=''">
                    and crowd = #{terms.crowd}
                </if>
                <if test="terms.crowdName != null and terms.crowdName !=''">
                    and crowd_name = #{terms.crowdName}
                </if>
                <if test="terms.canal != null and terms.canal !=''">
                    and canal = #{terms.canal}
                </if>
                <if test="terms.canalName != null and terms.canalName !=''">
                    and canal_name = #{terms.canalName}
                </if>
                <if test="terms.visitWay != null and terms.visitWay !=''">
                    and visit_way = #{terms.visitWay}
                </if>
                <if test="terms.visitWayName != null and terms.visitWayName !=''">
                    and visit_way_name = #{terms.visitWayName}
                </if>
                <if test="terms.zxslStatus != null">
                    and zxsl_status = #{terms.zxslStatus}
                </if>
                <if test="terms.caseDes != null and terms.caseDes !=''">
                    and case_des = #{terms.caseDes}
                </if>
                <if test="terms.caseClaim != null and terms.caseClaim !=''">
                    and case_claim = #{terms.caseClaim}
                </if>
                <if test="terms.majorStatus != null">
                    and major_status = #{terms.majorStatus}
                </if>
                <if test="terms.source != null and terms.source !=''">
                    and source = #{terms.source}
                </if>
                <if test="terms.sourceName != null and terms.sourceName !=''">
                    and source_name = #{terms.sourceName}
                </if>
                <if test="terms.caseNo != null and terms.caseNo !=''">
                    and case_no = #{terms.caseNo}
                </if>
                <if test="terms.mediateNo != null and terms.mediateNo !=''">
                    and mediate_no = #{terms.mediateNo}
                </if>
                <if test="terms.mediateBookNo != null and terms.mediateBookNo !=''">
                    and mediate_book_no = #{terms.mediateBookNo}
                </if>
                <if test="terms.civilNo != null and terms.civilNo !=''">
                    and civil_no = #{terms.civilNo}
                </if>
                <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
                    and plaintiffs = #{terms.plaintiffs}
                </if>
                <if test="terms.pagents != null and terms.pagents !=''">
                    and pagents = #{terms.pagents}
                </if>
                <if test="terms.defendants != null and terms.defendants !=''">
                    and defendants = #{terms.defendants}
                </if>
                <if test="terms.dagents != null and terms.dagents !=''">
                    and dagents = #{terms.dagents}
                </if>
                <if test="terms.partyShow != null">
                    and party_show = #{terms.partyShow}
                </if>
                <if test="terms.wantUnitId != null and terms.wantUnitId !=''">
                    and want_unit_id = #{terms.wantUnitId}
                </if>
                <if test="terms.wantUnitName != null and terms.wantUnitName !=''">
                    and want_unit_name = #{terms.wantUnitName}
                </if>
                <if test="terms.wantUserId != null and terms.wantUserId !=''">
                    and want_user_id = #{terms.wantUserId}
                </if>
                <if test="terms.wantUserName != null and terms.wantUserName !=''">
                    and want_user_name = #{terms.wantUserName}
                </if>
                <if test="terms.inputUnitId != null and terms.inputUnitId !=''">
                    and input_unit_id = #{terms.inputUnitId}
                </if>
                <if test="terms.inputUnitName != null and terms.inputUnitName !=''">
                    and input_unit_name = #{terms.inputUnitName}
                </if>
                <if test="terms.inputUserId != null and terms.inputUserId !=''">
                    and input_user_id = #{terms.inputUserId}
                </if>
                <if test="terms.inputUserName != null and terms.inputUserName !=''">
                    and input_user_name = #{terms.inputUserName}
                </if>
                <if test="terms.inputWay != null">
                    and input_way = #{terms.inputWay}
                </if>
                <if test="terms.status != null">
                    and status = #{terms.status}
                </if>
                <if test="terms.statusName != null and terms.statusName !=''">
                    and status_name = #{terms.statusName}
                </if>
                <if test="terms.process != null">
                    and process = #{terms.process}
                </if>
                <if test="terms.processName != null and terms.processName !=''">
                    and process_name = #{terms.processName}
                </if>
                <if test="terms.infoProcess != null">
                    and info_process = #{terms.infoProcess}
                </if>
                <if test="terms.infoProcessName != null and terms.infoProcessName !=''">
                    and info_process_name = #{terms.infoProcessName}
                </if>
                <if test="terms.deleteStatus == null or terms.deleteStatus == ''">
                    and delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus != ''">
                    and delete_status = #{terms.deleteStatus}
                </if>
                <if test="terms.custId != null and terms.custId !=''">
                    and cust_id = #{terms.custId}
                </if>
                <if test="terms.createTime != null and terms.createTime !=''">
                    and DATE_FORMAT(create_time,'%Y-%m-%d') = #{terms.createTime}
                </if>
                <if test="terms.createStart != null and terms.createStart !='' and terms.createEnd != null and terms.createEnd !=''">
                    and (DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.createStart}
                    and DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.createEnd})
                </if>
                <if test="terms.updateTime != null and terms.updateTime !=''">
                    and DATE_FORMAT(update_time,'%Y-%m-%d') = #{terms.updateTime}
                </if>
                <if test="terms.updateStart != null and terms.updateStart !='' and terms.updateEnd != null and terms.updateEnd !=''">
                    and (DATE_FORMAT(update_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.updateStart}
                    and DATE_FORMAT(update_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.updateEnd})
                </if>
                <if test="terms.syncStatus != null">
                    and sync_status = #{terms.syncStatus}
                </if>
                <if test="terms.oldCaseType != null and terms.oldCaseType !=''">
                    and old_case_type = #{terms.oldCaseType}
                </if>
                <if test="terms.oldCaseTypeName != null and terms.oldCaseTypeName !=''">
                    and old_case_type_name = #{terms.oldCaseTypeName}
                </if>
                <if test="terms.keyword != null and terms.keyword !=''">
                    and (
                        case_title like concat('%',#{terms.keyword},'%') or
                        case_claim like concat('%',#{terms.keyword},'%') or
                        case_des like concat('%',#{terms.keyword},'%')
                    )
                </if>
                <if test="terms.noNull != null and terms.noNull !=''">
                    and occur_time IS NOT NULL
                    and que_city_name IS NOT NULL
                </if>
            </where>
        </if>
    </sql>
    <!-- 更新对象 -->
    <update id="updateDyhCaseInfo">
        update
        <include refid="table-name"/>
        <set>
            <include refid="set-part"/>
        </set>
        <where>
            id = #{entity.id}
        </where>
    </update>
    <!-- 条件更新对象 -->
    <update id="updateDyhCaseInfoTerms">
        update
        <include refid="table-name"/>
        <set>
            <include refid="set-part"/>
        </set>
        <include refid="where-part"/>
    </update>
    <!--  根据编号物理删除  -->
    <delete id="deleteDyhCaseInfo">
        delete from
        <include refid="table-name" />
        where id = #{id}
    </delete>
    <!--  根据条件查询  -->
    <select id="listTerms" resultMap="dataResult">
        select
        <include refid="column-part"/>
        from
        <include refid="table-name" />
        <include refid="where-part"/>
    </select>
 
    <!-- 结果集 -->
    <resultMap id="dataResult-page" type="cn.huge.module.knowledge.domain.dto.DyhCaseInfoDTO">
        <result property="id" column="id"/>
        <result property="caseTitle" column="case_title"/>
        <result property="visitTime" column="visit_time"/>
        <result property="caseTypeFirst" column="case_type_first"/>
        <result property="caseTypeFirstName" column="case_type_first_name"/>
        <result property="caseType" column="case_type"/>
        <result property="caseTypeName" column="case_type_name"/>
        <result property="occurTime" column="occur_time"/>
        <result property="addr" column="addr"/>
        <result property="queProv" column="que_prov"/>
        <result property="queProvName" column="que_prov_name"/>
        <result property="queCity" column="que_city"/>
        <result property="queCityName" column="que_city_name"/>
        <result property="queArea" column="que_area"/>
        <result property="queAreaName" column="que_area_name"/>
        <result property="queRoad" column="que_road"/>
        <result property="queRoadName" column="que_road_name"/>
        <result property="queVillage" column="que_village"/>
        <result property="queVillageName" column="que_village_name"/>
    </resultMap>
 
    <!-- 字段 -->
    <sql id="column-part-page">
        id, case_title, visit_time,  case_type_first, case_type_first_name, case_type, case_type_name, occur_time, addr,  que_prov, que_prov_name, que_city, que_city_name, que_area, que_area_name, que_road, que_road_name, que_village, que_village_name, create_time
    </sql>
    <!--  根据条件统计  -->
    <select id="countTerms" resultType="java.lang.Long">
        select
        COUNT(1)
        from
        <include refid="table-name" />
        <include refid="where-part"/>
    </select>
    <!--  根据条件分页查询  -->
    <select id="pageTerms" resultMap="dataResult-page">
        SELECT
        <include refid="column-part-page"/>
        FROM
        <include refid="table-name" />
        <include refid="where-part"/>
        <if test="page.sort != null">
            <foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
                isnull(${s.property}), ${s.property} ${s.direction}
            </foreach>
        </if>
        <if test="page.sort == null">
            order by isnull(create_time), create_time desc
        </if>
        limit #{page.offset}, #{page.size}
    </select>
 
    <!-- 单项统计-结果集 -->
    <resultMap id="dataResult-oneCount" type="cn.huge.module.knowledge.domain.dto.CategoryCountDTO">
<!--        <result property="category" column="category"/>-->
        <result property="name" column="name"/>
        <result property="count" column="count"/>
    </resultMap>
    <!--  年份统计  -->
    <select id="yearCount" resultMap="dataResult-oneCount">
        SELECT
<!--            "year" as category,-->
            YEAR(occur_time) AS name,
            COUNT(id) AS count
        FROM
            `ai`.`dyh_case_info`
        <include refid="where-part"/>   and occur_time is not null
        GROUP BY
            YEAR(occur_time)
        ORDER BY
            name
    </select>
    <!--  区域统计  -->
    <select id="areaCount" resultMap="dataResult-oneCount">
        SELECT
            que_city_name AS name,
            COUNT(id) AS count
        FROM
            `ai`.`dyh_case_info`
            <include refid="where-part"/>
        GROUP BY
            que_city_name
        ORDER BY
            name
    </select>
    <!--  根据编号查询案件描述和调解协议  -->
    <select id="getDyhCaseById" resultMap="dataResult">
        SELECT dci.*,agree_content
        FROM `ai`.`dyh_case_info` dci left join `ai`.`dyh_case_info_unfold` dciu on dci.id=dciu.id
        where dci.id = #{id} and dci.delete_status ='0'
    </select>
 
    <!-- 获取案件详情 -->
    <select id="getCaseDetail" resultMap="CaseDetailResultMap">
        SELECT dci.id, dci.case_title, dci.case_des, dci.case_claim, dciu.agree_content,dci.plaintiffs,dci.defendants
        FROM ai.dyh_case_info dci 
        LEFT JOIN ai.dyh_case_info_unfold dciu ON dci.id = dciu.id
        WHERE dci.id = #{id} AND dci.delete_status = '0'
    </select>
 
    <!-- 根据ID查询案件标题 -->
    <select id="getCaseTitleById" resultMap="dataResult">
        SELECT id, case_title,plaintiffs,defendants
        FROM ai.dyh_case_info
        WHERE id = #{id} AND delete_status = '0'
    </select>
 
</mapper>