广州市综治平台后端
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
<?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-21 08:46:40
 * @version 1.0.0
-->
<mapper namespace="cn.huge.module.bycase.dao.mapper.CaseDispMapper">
    <!-- 结果集 -->
    <resultMap id="dataResult" type="cn.huge.module.bycase.domain.po.CaseDisp">
            <result property="id" column="id"/>
            <result property="caseId" column="case_id"/>
            <result property="caseNo" column="case_no"/>
            <result property="serieStatus" column="serie_status"/>
            <result property="applyCanal" column="apply_canal"/>
            <result property="applyCanalName" column="apply_canal_name"/>
            <result property="dispTag" column="disp_tag"/>
            <result property="dispTagName" column="disp_tag_name"/>
            <result property="sourceUnitId" column="source_unit_id"/>
            <result property="sourceUnitName" column="source_unit_name"/>
            <result property="sourceUserId" column="source_user_id"/>
            <result property="sourceUserName" column="source_user_name"/>
            <result property="sourceReason" column="source_reason"/>
            <result property="sourceContent" column="source_content"/>
            <result property="dispWay" column="disp_way"/>
            <result property="dispWayName" column="disp_way_name"/>
            <result property="dispType" column="disp_type"/>
            <result property="dispTypeName" column="disp_type_name"/>
            <result property="dispHandle" column="disp_handle"/>
            <result property="dispHandleName" column="disp_handle_name"/>
            <result property="dispObj" column="disp_obj"/>
            <result property="dispObjName" column="disp_obj_name"/>
            <result property="acceptObjId" column="accept_obj_id"/>
            <result property="acceptObjName" column="accept_obj_name"/>
            <result property="acceptObjSign" column="accept_obj_sign"/>
            <result property="acceptSignTime" column="accept_sign_time"/>
            <result property="endReason" column="end_reason"/>
            <result property="endReasonName" column="end_reason_name"/>
            <result property="endOtherReason" column="end_other_reason"/>
            <result property="dispContent" column="disp_content"/>
            <result property="dispUnitId" column="disp_unit_id"/>
            <result property="dispUnitName" column="disp_unit_name"/>
            <result property="dispDeptId" column="disp_dept_id"/>
            <result property="dispDeptName" column="disp_dept_name"/>
            <result property="dispUserId" column="disp_user_id"/>
            <result property="dispUserName" column="disp_user_name"/>
            <result property="dispTime" column="disp_time"/>
            <result property="status" column="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"/>
            <result property="lastDispId" column="last_disp_id"/>
    </resultMap>
    <!-- 表 -->
    <sql id='table-name'>dyh_case_disp</sql>
    <!-- 字段 -->
    <sql id="column-part">
        id,
        case_id,
        case_no,
        serie_status,
        apply_canal,
        apply_canal_name,
        disp_tag,
        disp_tag_name,
        source_unit_id,
        source_unit_name,
        source_user_id,
        source_user_name,
        source_reason,
        source_content,
        disp_way,
        disp_way_name,
        disp_type,
        disp_type_name,
        disp_handle,
        disp_handle_name,
        disp_obj,
        disp_obj_name,
        accept_obj_id,
        accept_obj_name,
        accept_obj_sign,
        accept_sign_time,
        end_reason,
        end_reason_name,
        end_other_reason,
        disp_content,
        disp_unit_id,
        disp_unit_name,
        disp_dept_id,
        disp_dept_name,
        disp_user_id,
        disp_user_name,
        disp_time,
        status,
        cust_id,
        delete_status,
        create_time,
        update_time,
        last_disp_id
    </sql>
    <!-- 更新实体字段 -->
    <sql id="set-part">
            <if test="entity.caseId != null">case_id = #{entity.caseId},</if>
            <if test="entity.caseNo != null">case_no = #{entity.caseNo},</if>
            <if test="entity.serieStatus != null">serie_status = #{entity.serieStatus},</if>
            <if test="entity.applyCanal != null">apply_canal = #{entity.applyCanal},</if>
            <if test="entity.applyCanalName != null">apply_canal_name = #{entity.applyCanalName},</if>
            <if test="entity.dispTag != null">disp_tag = #{entity.dispTag},</if>
            <if test="entity.dispTagName != null">disp_tag_name = #{entity.dispTagName},</if>
            <if test="entity.sourceUnitId != null">source_unit_id = #{entity.sourceUnitId},</if>
            <if test="entity.sourceUnitName != null">source_unit_name = #{entity.sourceUnitName},</if>
            <if test="entity.sourceUserId != null">source_user_id = #{entity.sourceUserId},</if>
            <if test="entity.sourceUserName != null">source_user_name = #{entity.sourceUserName},</if>
            <if test="entity.sourceReason != null">source_reason = #{entity.sourceReason},</if>
            <if test="entity.sourceContent != null">source_content = #{entity.sourceContent},</if>
            <if test="entity.dispWay != null">disp_way = #{entity.dispWay},</if>
            <if test="entity.dispWayName != null">disp_way_name = #{entity.dispWayName},</if>
            <if test="entity.dispType != null">disp_type = #{entity.dispType},</if>
            <if test="entity.dispTypeName != null">disp_type_name = #{entity.dispTypeName},</if>
            <if test="entity.dispHandle != null">disp_handle = #{entity.dispHandle},</if>
            <if test="entity.dispHandleName != null">disp_handle_name = #{entity.dispHandleName},</if>
            <if test="entity.dispObj != null">disp_obj = #{entity.dispObj},</if>
            <if test="entity.dispObjName != null">disp_obj_name = #{entity.dispObjName},</if>
            <if test="entity.acceptObjId != null">accept_obj_id = #{entity.acceptObjId},</if>
            <if test="entity.acceptObjName != null">accept_obj_name = #{entity.acceptObjName},</if>
            <if test="entity.acceptObjSign != null">accept_obj_sign = #{entity.acceptObjSign},</if>
            <if test="entity.acceptSignTime != null">accept_sign_time = #{entity.acceptSignTime},</if>
            <if test="entity.endReason != null">end_reason = #{entity.endReason},</if>
            <if test="entity.endReasonName != null">end_reason_name = #{entity.endReasonName},</if>
            <if test="entity.endOtherReason != null">end_other_reason = #{entity.endOtherReason},</if>
            <if test="entity.dispContent != null">disp_content = #{entity.dispContent},</if>
            <if test="entity.dispUnitId != null">disp_unit_id = #{entity.dispUnitId},</if>
            <if test="entity.dispUnitName != null">disp_unit_name = #{entity.dispUnitName},</if>
            <if test="entity.dispDeptId != null">disp_dept_id = #{entity.dispDeptId},</if>
            <if test="entity.dispDeptName != null">disp_dept_name = #{entity.dispDeptName},</if>
            <if test="entity.dispUserId != null">disp_user_id = #{entity.dispUserId},</if>
            <if test="entity.dispUserName != null">disp_user_name = #{entity.dispUserName},</if>
            <if test="entity.dispTime != null">disp_time = #{entity.dispTime},</if>
            <if test="entity.status != null">status = #{entity.status},</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>
            <if test="entity.lastDispId != null">last_disp_id = #{entity.lastDispId}</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.caseNo != null and terms.caseNo !=''">
                    and case_no = #{terms.caseNo}
                </if>
                <if test="terms.serieStatus != null and terms.serieStatus !=''">
                    and serie_status = #{terms.serieStatus}
                </if>
                <if test="terms.applyCanal != null and terms.applyCanal !=''">
                    and apply_canal = #{terms.applyCanal}
                </if>
                <if test="terms.applyCanalName != null and terms.applyCanalName !=''">
                    and apply_canal_name = #{terms.applyCanalName}
                </if>
                <if test="terms.dispTag != null and terms.dispTag !=''">
                    and disp_tag = #{terms.dispTag}
                </if>
                <if test="terms.dispTagName != null and terms.dispTagName !=''">
                    and disp_tag_name = #{terms.dispTagName}
                </if>
                <if test="terms.sourceUnitId != null and terms.sourceUnitId !=''">
                    and source_unit_id = #{terms.sourceUnitId}
                </if>
                <if test="terms.sourceUnitName != null and terms.sourceUnitName !=''">
                    and source_unit_name = #{terms.sourceUnitName}
                </if>
                <if test="terms.sourceUserId != null and terms.sourceUserId !=''">
                    and source_user_id = #{terms.sourceUserId}
                </if>
                <if test="terms.sourceUserName != null and terms.sourceUserName !=''">
                    and source_user_name = #{terms.sourceUserName}
                </if>
                <if test="terms.sourceReason != null and terms.sourceReason !=''">
                    and source_reason = #{terms.sourceReason}
                </if>
                <if test="terms.sourceContent != null and terms.sourceContent !=''">
                    and source_content = #{terms.sourceContent}
                </if>
                <if test="terms.dispWay != null and terms.dispWay !=''">
                    and disp_way = #{terms.dispWay}
                </if>
                <if test="terms.dispWayName != null and terms.dispWayName !=''">
                    and disp_way_name = #{terms.dispWayName}
                </if>
                <if test="terms.dispType != null and terms.dispType !=''">
                    and disp_type = #{terms.dispType}
                </if>
                <if test="terms.dispTypeName != null and terms.dispTypeName !=''">
                    and disp_type_name = #{terms.dispTypeName}
                </if>
                <if test="terms.dispHandle != null and terms.dispHandle !=''">
                    and disp_handle = #{terms.dispHandle}
                </if>
                <if test="terms.dispHandleName != null and terms.dispHandleName !=''">
                    and disp_handle_name = #{terms.dispHandleName}
                </if>
                <if test="terms.dispObj != null and terms.dispObj !=''">
                    and disp_obj = #{terms.dispObj}
                </if>
                <if test="terms.dispObjName != null and terms.dispObjName !=''">
                    and disp_obj_name = #{terms.dispObjName}
                </if>
                <if test="terms.acceptObjId != null and terms.acceptObjId !=''">
                    and accept_obj_id = #{terms.acceptObjId}
                </if>
                <if test="terms.acceptObjName != null and terms.acceptObjName !=''">
                    and accept_obj_name = #{terms.acceptObjName}
                </if>
                <if test="terms.acceptObjSign != null and terms.acceptObjSign !=''">
                    and accept_obj_sign = #{terms.acceptObjSign}
                </if>
                <if test="terms.acceptSignTime != null and terms.acceptSignTime !=''">
                    and accept_sign_time = #{terms.acceptSignTime}
                </if>
                <if test="terms.endReason != null and terms.endReason !=''">
                    and end_reason = #{terms.endReason}
                </if>
                <if test="terms.endReasonName != null and terms.endReasonName !=''">
                    and end_reason_name = #{terms.endReasonName}
                </if>
                <if test="terms.endOtherReason != null and terms.endOtherReason !=''">
                    and end_other_reason = #{terms.endOtherReason}
                </if>
                <if test="terms.dispContent != null and terms.dispContent !=''">
                    and disp_content = #{terms.dispContent}
                </if>
                <if test="terms.dispUnitId != null and terms.dispUnitId !=''">
                    and disp_unit_id = #{terms.dispUnitId}
                </if>
                <if test="terms.dispUnitName != null and terms.dispUnitName !=''">
                    and disp_unit_name = #{terms.dispUnitName}
                </if>
                <if test="terms.dispDeptId != null and terms.dispDeptId !=''">
                    and disp_dept_id = #{terms.dispDeptId}
                </if>
                <if test="terms.dispDeptName != null and terms.dispDeptName !=''">
                    and disp_dept_name = #{terms.dispDeptName}
                </if>
                <if test="terms.dispUserId != null and terms.dispUserId !=''">
                    and disp_user_id = #{terms.dispUserId}
                </if>
                <if test="terms.dispUserName != null and terms.dispUserName !=''">
                    and disp_user_name = #{terms.dispUserName}
                </if>
                <if test="terms.dispTime != null and terms.dispTime !=''">
                    and disp_time = #{terms.dispTime}
                </if>
                <if test="terms.status != null and terms.status !=''">
                    and status = #{terms.status}
                </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 = '1'
                </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>
                <if test="terms.lastDispId != null and terms.lastDispId !=''">
                    and last_disp_id = #{terms.lastDispId}
                </if>
            </where>
        </if>
    </sql>
    <!-- 更新对象 -->
    <update id="updateCaseDisp">
        update
        <include refid="table-name"/>
        <set>
            <include refid="set-part"/>
        </set>
        <where>
            id = #{entity.id}
        </where>
    </update>
    <!-- 条件更新对象 -->
    <update id="updateCaseDispTerms">
        update
        <include refid="table-name"/>
        <set>
            <include refid="set-part"/>
        </set>
        <include refid="where-part"/>
    </update>
    <!--  根据编号物理删除  -->
    <delete id="deleteCaseDisp">
        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>
 
</mapper>