广州市综治平台后端
xusd
1 days ago 3feed5879e5a9b794862bf46d38c7f66cfe41d50
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
<?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-10-14 14:23:35
 * @version 1.0.0
-->
<mapper namespace="cn.huge.module.cases.dao.mapper.CaseWindupApplyMapper">
    <!-- 结果集 -->
    <resultMap id="dataResult" type="cn.huge.module.cases.domain.po.CaseWindupApply">
            <result property="id" column="id"/>
            <result property="caseId" column="case_id"/>
            <result property="applyUnitId" column="apply_unit_id"/>
            <result property="applyUnitName" column="apply_unit_name"/>
            <result property="applyUserId" column="apply_user_id"/>
            <result property="applyUserName" column="apply_user_name"/>
            <result property="applyTime" column="apply_time"/>
            <result property="applyStatus" column="apply_status"/>
            <result property="mediResult" column="medi_result"/>
            <result property="mediResultName" column="medi_result_name"/>
            <result property="agreeType" column="agree_type"/>
            <result property="agreeTypeName" column="agree_type_name"/>
            <result property="agreeContent" column="agree_content"/>
            <result property="failReason" column="fail_reason"/>
            <result property="windupContent" column="windup_content"/>
            <result property="caseTaskId" column="case_task_id"/>
            <result property="auditUnitId" column="audit_unit_id"/>
            <result property="auditUnitName" column="audit_unit_name"/>
            <result property="auditUserId" column="audit_user_id"/>
            <result property="auditUserName" column="audit_user_name"/>
            <result property="auditTime" column="audit_time"/>
            <result property="auditResult" column="audit_result"/>
            <result property="auditResultName" column="audit_result_name"/>
            <result property="auditContent" column="audit_content"/>
            <result property="usetimeHour" column="usetime_hour"/>
            <result property="overtimeStatus" column="overtime_status"/>
            <result property="overtimeHour" column="overtime_hour"/>
            <result property="deleteStatus" column="delete_status"/>
            <result property="custId" column="cust_id"/>
            <result property="createTime" column="create_time"/>
            <result property="updateTime" column="update_time"/>
    </resultMap>
    <!-- 表 -->
    <sql id='table-name'>dyh_case_windup_apply</sql>
    <!-- 字段 -->
    <sql id="column-part">
        id,
        case_id,
        apply_unit_id,
        apply_unit_name,
        apply_user_id,
        apply_user_name,
        apply_time,
        apply_status,
        medi_result,
        medi_result_name,
        agree_type,
        agree_type_name,
        agree_content,
        fail_reason,
        windup_content,
        case_task_id,
        audit_unit_id,
        audit_unit_name,
        audit_user_id,
        audit_user_name,
        audit_time,
        audit_result,
        audit_result_name,
        audit_content,
        usetime_hour,
        overtime_status,
        overtime_hour,
        delete_status,
        cust_id,
        create_time,
        update_time
    </sql>
    <!-- 更新实体字段 -->
    <sql id="set-part">
            <if test="entity.caseId != null">case_id = #{entity.caseId},</if>
            <if test="entity.applyUnitId != null">apply_unit_id = #{entity.applyUnitId},</if>
            <if test="entity.applyUnitName != null">apply_unit_name = #{entity.applyUnitName},</if>
            <if test="entity.applyUserId != null">apply_user_id = #{entity.applyUserId},</if>
            <if test="entity.applyUserName != null">apply_user_name = #{entity.applyUserName},</if>
            <if test="entity.applyTime != null">apply_time = #{entity.applyTime},</if>
            <if test="entity.applyStatus != null">apply_status = #{entity.applyStatus},</if>
            <if test="entity.mediResult != null">medi_result = #{entity.mediResult},</if>
            <if test="entity.mediResultName != null">medi_result_name = #{entity.mediResultName},</if>
            <if test="entity.agreeType != null">agree_type = #{entity.agreeType},</if>
            <if test="entity.agreeTypeName != null">agree_type_name = #{entity.agreeTypeName},</if>
            <if test="entity.agreeContent != null">agree_content = #{entity.agreeContent},</if>
            <if test="entity.failReason != null">fail_reason = #{entity.failReason},</if>
            <if test="entity.windupContent != null">windup_content = #{entity.windupContent},</if>
            <if test="entity.caseTaskId != null">case_task_id = #{entity.caseTaskId},</if>
            <if test="entity.auditUnitId != null">audit_unit_id = #{entity.auditUnitId},</if>
            <if test="entity.auditUnitName != null">audit_unit_name = #{entity.auditUnitName},</if>
            <if test="entity.auditUserId != null">audit_user_id = #{entity.auditUserId},</if>
            <if test="entity.auditUserName != null">audit_user_name = #{entity.auditUserName},</if>
            <if test="entity.auditTime != null">audit_time = #{entity.auditTime},</if>
            <if test="entity.auditResult != null">audit_result = #{entity.auditResult},</if>
            <if test="entity.auditResultName != null">audit_result_name = #{entity.auditResultName},</if>
            <if test="entity.auditContent != null">audit_content = #{entity.auditContent},</if>
            <if test="entity.usetimeHour != null">usetime_hour = #{entity.usetimeHour},</if>
            <if test="entity.overtimeStatus != null">overtime_status = #{entity.overtimeStatus},</if>
            <if test="entity.overtimeHour != null">overtime_hour = #{entity.overtimeHour},</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>
    </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.applyUnitId != null and terms.applyUnitId !=''">
                    and apply_unit_id = #{terms.applyUnitId}
                </if>
                <if test="terms.applyUnitName != null and terms.applyUnitName !=''">
                    and apply_unit_name = #{terms.applyUnitName}
                </if>
                <if test="terms.applyUserId != null and terms.applyUserId !=''">
                    and apply_user_id = #{terms.applyUserId}
                </if>
                <if test="terms.applyUserName != null and terms.applyUserName !=''">
                    and apply_user_name = #{terms.applyUserName}
                </if>
                <if test="terms.applyTime != null and terms.applyTime !=''">
                    and apply_time = #{terms.applyTime}
                </if>
                <if test="terms.applyStatus != null and terms.applyStatus !=''">
                    and apply_status = #{terms.applyStatus}
                </if>
                <if test="terms.mediResult != null and terms.mediResult !=''">
                    and medi_result = #{terms.mediResult}
                </if>
                <if test="terms.mediResultName != null and terms.mediResultName !=''">
                    and medi_result_name = #{terms.mediResultName}
                </if>
                <if test="terms.agreeType != null and terms.agreeType !=''">
                    and agree_type = #{terms.agreeType}
                </if>
                <if test="terms.agreeTypeName != null and terms.agreeTypeName !=''">
                    and agree_type_name = #{terms.agreeTypeName}
                </if>
                <if test="terms.agreeContent != null and terms.agreeContent !=''">
                    and agree_content = #{terms.agreeContent}
                </if>
                <if test="terms.failReason != null and terms.failReason !=''">
                    and fail_reason = #{terms.failReason}
                </if>
                <if test="terms.windupContent != null and terms.windupContent !=''">
                    and windup_content = #{terms.windupContent}
                </if>
                <if test="terms.caseTaskId != null and terms.caseTaskId !=''">
                    and case_task_id = #{terms.caseTaskId}
                </if>
                <if test="terms.auditUnitId != null and terms.auditUnitId !=''">
                    and audit_unit_id = #{terms.auditUnitId}
                </if>
                <if test="terms.auditUnitName != null and terms.auditUnitName !=''">
                    and audit_unit_name = #{terms.auditUnitName}
                </if>
                <if test="terms.auditUserId != null and terms.auditUserId !=''">
                    and audit_user_id = #{terms.auditUserId}
                </if>
                <if test="terms.auditUserName != null and terms.auditUserName !=''">
                    and audit_user_name = #{terms.auditUserName}
                </if>
                <if test="terms.auditTime != null and terms.auditTime !=''">
                    and audit_time = #{terms.auditTime}
                </if>
                <if test="terms.auditResult != null and terms.auditResult !=''">
                    and audit_result = #{terms.auditResult}
                </if>
                <if test="terms.auditResultName != null and terms.auditResultName !=''">
                    and audit_result_name = #{terms.auditResultName}
                </if>
                <if test="terms.auditContent != null and terms.auditContent !=''">
                    and audit_content = #{terms.auditContent}
                </if>
                <if test="terms.usetimeHour != null and terms.usetimeHour !=''">
                    and usetime_hour = #{terms.usetimeHour}
                </if>
                <if test="terms.overtimeStatus != null and terms.overtimeStatus !=''">
                    and overtime_status = #{terms.overtimeStatus}
                </if>
                <if test="terms.overtimeHour != null and terms.overtimeHour !=''">
                    and overtime_hour = #{terms.overtimeHour}
                </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.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>
            </where>
        </if>
    </sql>
    <!-- 更新对象 -->
    <update id="updateCaseWindupApply">
        update
        <include refid="table-name"/>
        <set>
            <include refid="set-part"/>
        </set>
        <where>
            id = #{entity.id}
        </where>
    </update>
    <!-- 条件更新对象 -->
    <update id="updateCaseWindupApplyTerms">
        update
        <include refid="table-name"/>
        <set>
            <include refid="set-part"/>
        </set>
        <include refid="where-part"/>
    </update>
    <!--  根据编号物理删除  -->
    <delete id="deleteCaseWindupApply">
        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="countApplyReview" resultType="java.lang.Long">
        select
        COUNT(1)
        from
        <include refid="table-name" />
        where
        delete_status = 0
        and apply_status = 0
        and audit_unit_id = #{auditUnitId}
    </select>
 
    <!-- 首页-待审核结果集 -->
    <resultMap id="MyTaskApplyReviewResult" type="cn.huge.module.cases.domain.dto.FrontPageListDTO">
        <result property="windupId" column="windupId"/>
        <result property="ownerId" column="ownerId"/>
        <result property="caseId" column="caseId"/>
        <result property="turnaroundTime" column="turnaroundTime"/>
        <result property="timeLimit" column="timeLimit"/>
        <result property="caseGrade" column="caseGrade"/>
        <result property="caseSource" column="caseSource"/>
        <result property="caseType" column="caseType"/>
        <result property="plaintiffs" column="plaintiffs"/>
        <result property="defendants" column="defendants"/>
        <result property="processingDays" column="processingDays"/>
        <result property="mediResult" column="mediResult"/>
        <result property="organizingUnit" column="organizingUnit"/>
        <result property="cooperatingUnit" column="cooperatingUnit"/>
        <result property="manager" column="manager"/>
        <result property="mediResult" column="mediResult"/>
        <result property="backUnit" column="backUnit"/>
        <result property="reason" column="reason"/>
        <result property="opinion" column="opinion"/>
        <result property="process" column="process"/>
        <result property="auditTime" column="auditTime"/>
        <result property="auditResult" column="auditResult"/>
        <result property="isRisk" column="isRisk"/>
    </resultMap>
 
    <!--  首页-待审核条件统计  -->
    <select id="countMyTaskApplyReview" resultType="java.lang.Long">
        select
        COUNT(t1.id)
        from
            dyh_case_windup_apply t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
            t1.delete_status = 0
        and t1.apply_status = #{terms.applyStatus}
        and t1.audit_unit_id = #{terms.auditUnitId}
        <if test="terms.timeStart != null and terms.timeStart !='' and terms.timeEnd != null and terms.timeEnd !=''">
            and (DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.timeStart}
            and DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.timeEnd})
        </if>
        <if test="terms.partyName != null and terms.partyName !=''">
            and concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%')
        </if>
    </select>
    <!--  首页-待审核分页查询  -->
    <select id="listMyTaskApplyReview" resultMap="MyTaskApplyReviewResult">
        SELECT t1.id as windupId, t1.case_task_id as ownerId, t1.case_id as caseId, t1.audit_time as auditTime, t1.audit_result_name as auditResult,
        t1.apply_time as turnaroundTime, t1.apply_unit_name as organizingUnit, t1.medi_result_name as mediResult,
               t1.fail_reason as reason, t2.case_level as caseGrade, t2.canal_name as caseSource, t3.is_risk as isRisk,
               concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType, concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs,
               concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants
        FROM
        dyh_case_windup_apply t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        and t1.apply_status = #{terms.applyStatus}
        and t1.audit_unit_id = #{terms.auditUnitId}
        <if test="terms.timeStart != null and terms.timeStart !='' and terms.timeEnd != null and terms.timeEnd !=''">
            and (DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.timeStart}
            and DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.timeEnd})
        </if>
        <if test="terms.partyName != null and terms.partyName !=''">
            and concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%')
        </if>
        <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(t1.create_time), t1.create_time desc
        </if>
        limit #{page.offset}, #{page.size}
    </select>
 
 
    <!-- 工作台-结案申请条件查询-条件 -->
    <sql id="myTaskJasq-where-part">
        <if test="terms != null">
            <if test="terms.applyUnitId != null and terms.applyUnitId !=''">
                and t1.apply_unit_id = #{terms.applyUnitId}
            </if>
            <if test="terms.assistUnitId != null and terms.assistUnitId !=''">
                and t3.assist_unit_id like concat('%', #{terms.assistUnitId}, '%')
            </if>
            <if test="terms.applyTimeStart != null and terms.applyTimeStart !='' and terms.applyTimeEnd != null and terms.applyTimeEnd !=''">
                and (DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.applyTimeStart}
                and DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.applyTimeEnd})
            </if>
            <if test="terms.partyName != null and terms.partyName !=''">
                and concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%')
            </if>
        </if>
    </sql>
    <!--  首页-结案申请条件统计  -->
    <select id="countMyTaskJasq" resultType="java.lang.Long">
        select
        COUNT(t1.id)
        from
        dyh_case_windup_apply t1 left join dyh_case_info t2 on t1.case_id = t2.id
        left join dyh_case_info_unfold t3 on t3.id = t2.id
        where
        t1.apply_status = 0
        and t2.delete_status = 0
        <include refid="myTaskJasq-where-part"/>
    </select>
    <!--  首页-结案申请分页查询  -->
    <select id="listMyTaskJasq" resultType="cn.huge.module.cases.domain.dto.FrontPageListJADTO">
        SELECT
        t1.id as windupId, t1.case_task_id as ownerId, t1.case_id as caseId, t1.apply_time as turnaroundTime,
        t1.audit_unit_name as auditUnit, t2.case_level as caseGrade, t2.canal_name as caseSource, t3.is_risk as isRisk,
        concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType,
        t3.mediator as manager, t3.assist_unit_name as cooperatingUnit, t3.mediate_unit_name as organizingUnit,
        t1.medi_result as mediResult, t1.medi_result_name as mediResultName, t2.status_name as caseStatusName,
        concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs,
        concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
        (select count(1) from dyh_case_supervise where case_id = t2.id) as superviseCount
        FROM
        dyh_case_windup_apply t1 left join dyh_case_info t2 on t1.case_id = t2.id
        left join dyh_case_info_unfold t3 on t3.id = t2.id
        where
        t1.apply_status = 0
        and t2.delete_status = 0
        <include refid="myTaskJasq-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(t1.create_time), t1.create_time desc
        </if>
        limit #{page.offset}, #{page.size}
    </select>
 
    <!-- 工作台-已结案条件查询-条件 -->
    <sql id="myTaskYja-where-part">
        <if test="terms != null">
            <if test="terms.applyUnitId != null and terms.applyUnitId !=''">
                and t2.mediate_unit_id = #{terms.applyUnitId}
            </if>
            <if test="terms.assistUnitId != null and terms.assistUnitId !=''">
                and t2.assist_unit_id like concat('%', #{terms.assistUnitId}, '%')
            </if>
            <if test="terms.applyTimeStart != null and terms.applyTimeStart !='' and terms.applyTimeEnd != null and terms.applyTimeEnd !=''">
                and (DATE_FORMAT(t2.close_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.applyTimeStart}
                and DATE_FORMAT(t2.close_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.applyTimeEnd})
            </if>
            <if test="terms.partyName != null and terms.partyName !=''">
                and concat_ws('', ifnull(t1.plaintiffs, ''), ifnull(t1.pagents, ''), ifnull(t1.defendants, ''), ifnull(t1.dagents, '')) like concat('%', #{terms.partyName}, '%')
            </if>
        </if>
    </sql>
    <!--  首页-结案申请条件统计  -->
    <select id="countMyTaskYja" resultType="java.lang.Long">
        select
        COUNT(t1.id)
        from dyh_case_info t1
        left join dyh_case_info_unfold t2 on t1.id = t2.id
        left join dyh_case_windup_apply t3 on t1.id = t3.case_id
        where t1.process in (5, 6)
        and t1.delete_status = 0
        <include refid="myTaskYja-where-part"/>
    </select>
    <!--  首页-结案申请分页查询  -->
    <select id="listMyTaskYja" resultType="cn.huge.module.cases.domain.dto.FrontPageListJADTO">
        select
        t3.id as windupId, t3.case_task_id as ownerId, t1.id as caseId, t2.is_risk as isRisk,
        t2.close_time as turnaroundTime, t1.case_level as caseGrade, t1.canal_name as caseSource,
        concat_ws('', ifnull(t1.case_type_first_name, ''), '/' , ifnull(t1.case_type_name, '')) as caseType,
        t2.mediator as manager, t2.assist_unit_name as cooperatingUnit, t2.mediate_unit_name as organizingUnit,
        t2.medi_result as mediResult, t2.medi_result_name as mediResultName, t1.status_name as caseStatusName,
        concat_ws('', ifnull(t1.plaintiffs, ''), ifnull(t1.pagents, '')) as plaintiffs,
        concat_ws('', ifnull(t1.defendants, ''), ifnull(t1.dagents, '')) as defendants,
        (select count(1) from dyh_case_supervise where case_id = t1.id) as superviseCount
        from dyh_case_info t1
        left join dyh_case_info_unfold t2 on t1.id = t2.id
        left join dyh_case_windup_apply t3 on t1.id = t3.case_id
        where t1.process in (5, 6)
        and t1.delete_status = 0
        <include refid="myTaskYja-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(t1.close_time), t1.close_time desc
        </if>
        limit #{page.offset}, #{page.size}
    </select>
</mapper>