广州市综治平台后端
xusd
2 days ago c490640493f04e2ed0fc5c4c8fbc92ebdd4d5380
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
<?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: liyj
 * @time:2024-09-24 14:18:41
 * @version 1.0.0
-->
<mapper namespace="cn.huge.module.cases.dao.mapper.CasePersonMapper">
    <!-- 结果集 -->
    <resultMap id="dataResult" type="cn.huge.module.cases.domain.po.CasePerson">
            <result property="id" column="id"/>
            <result property="caseId" column="case_id"/>
            <result property="partyUserId" column="party_user_id"/>
            <result property="companyId" column="company_id"/>
            <result property="perType" column="per_type"/>
            <result property="perTypeName" column="per_type_name"/>
            <result property="perClass" column="per_class"/>
            <result property="perClassName" column="per_class_name"/>
            <result property="trueName" column="true_name"/>
            <result property="mobile" column="mobile"/>
            <result property="orgaCode" column="orga_code"/>
            <result property="deputy" column="deputy"/>
            <result property="orgaType" column="orga_type"/>
            <result property="orgaTypeName" column="orga_type_name"/>
            <result property="certiType" column="certi_type"/>
            <result property="certiTypeName" column="certi_type_name"/>
            <result property="certiNo" column="certi_no"/>
            <result property="prov" column="prov"/>
            <result property="provName" column="prov_name"/>
            <result property="city" column="city"/>
            <result property="cityName" column="city_name"/>
            <result property="area" column="area"/>
            <result property="areaName" column="area_name"/>
            <result property="road" column="road"/>
            <result property="roadName" column="road_name"/>
            <result property="village" column="village"/>
            <result property="villageName" column="village_name"/>
            <result property="addr" column="addr"/>
            <result property="placeProv" column="place_prov"/>
            <result property="placeProvName" column="place_prov_name"/>
            <result property="placeCity" column="place_city"/>
            <result property="placeCityName" column="place_city_name"/>
            <result property="placeArea" column="place_area"/>
            <result property="placeAreaName" column="place_area_name"/>
            <result property="placeRoad" column="place_road"/>
            <result property="placeRoadName" column="place_road_name"/>
            <result property="placeVillage" column="place_village"/>
            <result property="placeVillageName" column="place_village_name"/>
            <result property="placeAddr" column="place_addr"/>
            <result property="workUnitId" column="work_unit_id"/>
            <result property="workUnit" column="work_unit"/>
            <result property="nation" column="nation"/>
            <result property="nationName" column="nation_name"/>
            <result property="sex" column="sex"/>
            <result property="sexName" column="sex_name"/>
            <result property="extreme" column="extreme"/>
            <result property="avatar" column="avatar"/>
            <result property="job" column="job"/>
            <result property="jobName" column="job_name"/>
            <result property="birthday" column="birthday"/>
            <result property="age" column="age"/>
            <result property="agentStatus" column="agent_status"/>
            <result property="custId" column="cust_id"/>
            <result property="deleteStatus" column="delete_status"/>
            <result property="createTime" column="create_time"/>
            <result property="updateTime" column="update_time"/>
    </resultMap>
    <!-- 表 -->
    <sql id='table-name'>dyh_case_person</sql>
    <!-- 字段 -->
    <sql id="column-part">
        id,
        case_id,
        party_user_id,
        company_id,
        per_type,
        per_type_name,
        per_class,
        per_class_name,
        true_name,
        mobile,
        orga_code,
        deputy,
        orga_type,
        orga_type_name,
        certi_type,
        certi_type_name,
        certi_no,
        prov,
        prov_name,
        city,
        city_name,
        area,
        area_name,
        road,
        road_name,
        village,
        village_name,
        addr,
        place_prov,
        place_prov_name,
        place_city,
        place_city_name,
        place_area,
        place_area_name,
        place_road,
        place_road_name,
        place_village,
        place_village_name,
        place_addr,
        work_unit_id,
        work_unit,
        nation,
        nation_name,
        sex,
        sex_name,
        extreme,
        avatar,
        job,
        job_name,
        birthday,
        age,
        agent_status,
        cust_id,
        delete_status,
        create_time,
        update_time
    </sql>
    <!-- 更新实体字段 -->
    <sql id="set-part">
            <if test="entity.caseId != null">case_id = #{entity.caseId},</if>
            <if test="entity.partyUserId != null">party_user_id = #{entity.partyUserId},</if>
            <if test="entity.companyId != null">company_id = #{entity.companyId},</if>
            <if test="entity.perType != null">per_type = #{entity.perType},</if>
            <if test="entity.perTypeName != null">per_type_name = #{entity.perTypeName},</if>
            <if test="entity.perClass != null">per_class = #{entity.perClass},</if>
            <if test="entity.perClassName != null">per_class_name = #{entity.perClassName},</if>
            <if test="entity.trueName != null">true_name = #{entity.trueName},</if>
            <if test="entity.mobile != null">mobile = #{entity.mobile},</if>
            <if test="entity.orgaCode != null">orga_code = #{entity.orgaCode},</if>
            <if test="entity.deputy != null">deputy = #{entity.deputy},</if>
            <if test="entity.orgaType != null">orga_type = #{entity.orgaType},</if>
            <if test="entity.orgaTypeName != null">orga_type_name = #{entity.orgaTypeName},</if>
            <if test="entity.certiType != null">certi_type = #{entity.certiType},</if>
            <if test="entity.certiTypeName != null">certi_type_name = #{entity.certiTypeName},</if>
            <if test="entity.certiNo != null">certi_no = #{entity.certiNo},</if>
            <if test="entity.prov != null">prov = #{entity.prov},</if>
            <if test="entity.provName != null">prov_name = #{entity.provName},</if>
            <if test="entity.city != null">city = #{entity.city},</if>
            <if test="entity.cityName != null">city_name = #{entity.cityName},</if>
            <if test="entity.area != null">area = #{entity.area},</if>
            <if test="entity.areaName != null">area_name = #{entity.areaName},</if>
            <if test="entity.road != null">road = #{entity.road},</if>
            <if test="entity.roadName != null">road_name = #{entity.roadName},</if>
            <if test="entity.village != null">village = #{entity.village},</if>
            <if test="entity.villageName != null">village_name = #{entity.villageName},</if>
            <if test="entity.addr != null">addr = #{entity.addr},</if>
            <if test="entity.placeProv != null">place_prov = #{entity.placeProv},</if>
            <if test="entity.placeProvName != null">place_prov_name = #{entity.placeProvName},</if>
            <if test="entity.placeCity != null">place_city = #{entity.placeCity},</if>
            <if test="entity.placeCityName != null">place_city_name = #{entity.placeCityName},</if>
            <if test="entity.placeArea != null">place_area = #{entity.placeArea},</if>
            <if test="entity.placeAreaName != null">place_area_name = #{entity.placeAreaName},</if>
            <if test="entity.placeRoad != null">place_road = #{entity.placeRoad},</if>
            <if test="entity.placeRoadName != null">place_road_name = #{entity.placeRoadName},</if>
            <if test="entity.placeVillage != null">place_village = #{entity.placeVillage},</if>
            <if test="entity.placeVillageName != null">place_village_name = #{entity.placeVillageName},</if>
            <if test="entity.placeAddr != null">place_addr = #{entity.placeAddr},</if>
            <if test="entity.workUnitId != null">work_unit_id = #{entity.workUnitId},</if>
            <if test="entity.workUnit != null">work_unit = #{entity.workUnit},</if>
            <if test="entity.nation != null">nation = #{entity.nation},</if>
            <if test="entity.nationName != null">nation_name = #{entity.nationName},</if>
            <if test="entity.sex != null">sex = #{entity.sex},</if>
            <if test="entity.sexName != null">sex_name = #{entity.sexName},</if>
            <if test="entity.extreme != null">extreme = #{entity.extreme},</if>
            <if test="entity.avatar != null">avatar = #{entity.avatar},</if>
            <if test="entity.job != null">job = #{entity.job},</if>
            <if test="entity.jobName != null">job_name = #{entity.jobName},</if>
            <if test="entity.birthday != null">birthday = #{entity.birthday},</if>
            <if test="entity.age != null">age = #{entity.age},</if>
            <if test="entity.agentStatus != null">agent_status = #{entity.agentStatus},</if>
            <if test="entity.custId != null">cust_id = #{entity.custId},</if>
            <if test="entity.deleteStatus != null">delete_status = #{entity.deleteStatus},</if>
            <if test="entity.createTime != null">create_time = #{entity.createTime},</if>
            <if test="entity.updateTime != null">update_time = #{entity.updateTime}</if>
    </sql>
    <!-- 条件 -->
    <sql id="where-part">
        <if test="terms != null">
            <where>
                <if test="terms.id != null and terms.id !=''">
                    and id = #{terms.id}
                </if>
                <if test="terms.caseId != null and terms.caseId !=''">
                    and case_id = #{terms.caseId}
                </if>
                <if test="terms.partyUserId != null and terms.partyUserId !=''">
                    and party_user_id = #{terms.partyUserId}
                </if>
                <if test="terms.companyId != null and terms.companyId !=''">
                    and company_id = #{terms.companyId}
                </if>
                <if test="terms.perType != null and terms.perType !=''">
                    and per_type = #{terms.perType}
                </if>
                <if test="terms.perTypeName != null and terms.perTypeName !=''">
                    and per_type_name = #{terms.perTypeName}
                </if>
                <if test="terms.perClass != null and terms.perClass !=''">
                    and per_class = #{terms.perClass}
                </if>
                <if test="terms.perClassName != null and terms.perClassName !=''">
                    and per_class_name = #{terms.perClassName}
                </if>
                <if test="terms.trueName != null and terms.trueName !=''">
                    and true_name = #{terms.trueName}
                </if>
                <if test="terms.mobile != null and terms.mobile !=''">
                    and mobile = #{terms.mobile}
                </if>
                <if test="terms.orgaCode != null and terms.orgaCode !=''">
                    and orga_code = #{terms.orgaCode}
                </if>
                <if test="terms.deputy != null and terms.deputy !=''">
                    and deputy = #{terms.deputy}
                </if>
                <if test="terms.orgaType != null and terms.orgaType !=''">
                    and orga_type = #{terms.orgaType}
                </if>
                <if test="terms.orgaTypeName != null and terms.orgaTypeName !=''">
                    and orga_type_name = #{terms.orgaTypeName}
                </if>
                <if test="terms.certiType != null and terms.certiType !=''">
                    and certi_type = #{terms.certiType}
                </if>
                <if test="terms.certiTypeName != null and terms.certiTypeName !=''">
                    and certi_type_name = #{terms.certiTypeName}
                </if>
                <if test="terms.certiNo != null and terms.certiNo !=''">
                    and certi_no = #{terms.certiNo}
                </if>
                <if test="terms.prov != null and terms.prov !=''">
                    and prov = #{terms.prov}
                </if>
                <if test="terms.provName != null and terms.provName !=''">
                    and prov_name = #{terms.provName}
                </if>
                <if test="terms.city != null and terms.city !=''">
                    and city = #{terms.city}
                </if>
                <if test="terms.cityName != null and terms.cityName !=''">
                    and city_name = #{terms.cityName}
                </if>
                <if test="terms.area != null and terms.area !=''">
                    and area = #{terms.area}
                </if>
                <if test="terms.areaName != null and terms.areaName !=''">
                    and area_name = #{terms.areaName}
                </if>
                <if test="terms.road != null and terms.road !=''">
                    and road = #{terms.road}
                </if>
                <if test="terms.roadName != null and terms.roadName !=''">
                    and road_name = #{terms.roadName}
                </if>
                <if test="terms.village != null and terms.village !=''">
                    and village = #{terms.village}
                </if>
                <if test="terms.villageName != null and terms.villageName !=''">
                    and village_name = #{terms.villageName}
                </if>
                <if test="terms.addr != null and terms.addr !=''">
                    and addr = #{terms.addr}
                </if>
                <if test="terms.placeProv != null and terms.placeProv !=''">
                    and place_prov = #{terms.placeProv}
                </if>
                <if test="terms.placeProvName != null and terms.placeProvName !=''">
                    and place_prov_name = #{terms.placeProvName}
                </if>
                <if test="terms.placeCity != null and terms.placeCity !=''">
                    and place_city = #{terms.placeCity}
                </if>
                <if test="terms.placeCityName != null and terms.placeCityName !=''">
                    and place_city_name = #{terms.placeCityName}
                </if>
                <if test="terms.placeArea != null and terms.placeArea !=''">
                    and place_area = #{terms.placeArea}
                </if>
                <if test="terms.placeAreaName != null and terms.placeAreaName !=''">
                    and place_area_name = #{terms.placeAreaName}
                </if>
                <if test="terms.placeRoad != null and terms.placeRoad !=''">
                    and place_road = #{terms.placeRoad}
                </if>
                <if test="terms.placeRoadName != null and terms.placeRoadName !=''">
                    and place_road_name = #{terms.placeRoadName}
                </if>
                <if test="terms.placeVillage != null and terms.placeVillage !=''">
                    and place_village = #{terms.placeVillage}
                </if>
                <if test="terms.placeVillageName != null and terms.placeVillageName !=''">
                    and place_village_name = #{terms.placeVillageName}
                </if>
                <if test="terms.placeAddr != null and terms.placeAddr !=''">
                    and place_addr = #{terms.placeAddr}
                </if>
                <if test="terms.workUnitId != null and terms.workUnitId !=''">
                    and work_unit_id = #{terms.workUnitId}
                </if>
                <if test="terms.workUnit != null and terms.workUnit !=''">
                    and work_unit = #{terms.workUnit}
                </if>
                <if test="terms.nation != null and terms.nation !=''">
                    and nation = #{terms.nation}
                </if>
                <if test="terms.nationName != null and terms.nationName !=''">
                    and nation_name = #{terms.nationName}
                </if>
                <if test="terms.sex != null and terms.sex !=''">
                    and sex = #{terms.sex}
                </if>
                <if test="terms.sexName != null and terms.sexName !=''">
                    and sex_name = #{terms.sexName}
                </if>
                <if test="terms.extreme != null and terms.extreme !=''">
                    and extreme = #{terms.extreme}
                </if>
                <if test="terms.avatar != null and terms.avatar !=''">
                    and avatar = #{terms.avatar}
                </if>
                <if test="terms.job != null and terms.job !=''">
                    and job = #{terms.job}
                </if>
                <if test="terms.jobName != null and terms.jobName !=''">
                    and job_name = #{terms.jobName}
                </if>
                <if test="terms.birthday != null and terms.birthday !=''">
                    and birthday = #{terms.birthday}
                </if>
                <if test="terms.age != null and terms.age !=''">
                    and age = #{terms.age}
                </if>
                <if test="terms.agentStatus != null and terms.agentStatus !=''">
                    and agent_status = #{terms.agentStatus}
                </if>
                <if test="terms.custId != null and terms.custId !=''">
                    and cust_id = #{terms.custId}
                </if>
                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
                    and delete_status = 0
                </if>
                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                    and delete_status = #{terms.deleteStatus}
                </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>
            </where>
        </if>
    </sql>
    <!-- 更新对象 -->
    <update id="updateCasePerson">
        update
        <include refid="table-name"/>
        <set>
            <include refid="set-part"/>
        </set>
        <where>
            id = #{entity.id}
        </where>
    </update>
    <!-- 条件更新对象 -->
    <update id="updateCasePersonTerms">
        update
        <include refid="table-name"/>
        <set>
            <include refid="set-part"/>
        </set>
        <include refid="where-part"/>
    </update>
    <!--  根据编号物理删除  -->
    <delete id="deleteCasePerson">
        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>
    <!--  根据条件统计  -->
    <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">
        SELECT
        <include refid="column-part"/>
        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>
 
    <!--  根据纠纷编号查询人员编号  -->
    <select id="listIdByCaseId" resultType="java.lang.String">
        select
        id
        from
        <include refid="table-name" />
        where case_id = #{caseId}
    </select>
 
    <!--  根据纠纷编号查询人员编号  -->
    <select id="listByCertiNo" resultMap="dataResult">
        select
        a.case_id,a.certi_no,a.per_type
        from
            dyh_case_person a INNER JOIN dyh_case_info b ON a.case_id = b.id
        where a.certi_no = #{certiNo} and b.delete_status = 0
    </select>
 
</mapper>