广州市综治平台后端
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
<?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-18 10:05:35
 * @version 1.0.0
-->
<mapper namespace="cn.huge.module.cases.dao.mapper.CaseAssistInfoMapper">
    <!-- 结果集 -->
    <resultMap id="dataResult" type="cn.huge.module.cases.domain.po.CaseAssistInfo">
            <result property="id" column="id"/>
            <result property="caseId" column="case_id"/>
            <result property="processInstanceId" column="process_instance_id"/>
            <result property="caseTaskId" column="case_task_id"/>
            <result property="applyId" column="apply_id"/>
            <result property="assistUnitId" column="assist_unit_id"/>
            <result property="assistUnitName" column="assist_unit_name"/>
            <result property="acceptTime" column="accept_time"/>
            <result property="assistUserId" column="assist_user_id"/>
            <result property="assistUserName" column="assist_user_name"/>
            <result property="assistStatus" column="assist_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_assist_info</sql>
    <!-- 字段 -->
    <sql id="column-part">
        id,
        case_id,
        process_instance_id,
        case_task_id,
        apply_id,
        assist_unit_id,
        assist_unit_name,
        accept_time,
        assist_user_id,
        assist_user_name,
        assist_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.processInstanceId != null">process_instance_id = #{entity.processInstanceId},</if>
            <if test="entity.caseTaskId != null">case_task_id = #{entity.caseTaskId},</if>
            <if test="entity.applyId != null">apply_id = #{entity.applyId},</if>
            <if test="entity.assistUnitId != null">assist_unit_id = #{entity.assistUnitId},</if>
            <if test="entity.assistUnitName != null">assist_unit_name = #{entity.assistUnitName},</if>
            <if test="entity.acceptTime != null">accept_time = #{entity.acceptTime},</if>
            <if test="entity.assistUserId != null">assist_user_id = #{entity.assistUserId},</if>
            <if test="entity.assistUserName != null">assist_user_name = #{entity.assistUserName},</if>
            <if test="entity.assistStatus != null">assist_status = #{entity.assistStatus},</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.processInstanceId != null and terms.processInstanceId !=''">
                    and process_instance_id = #{terms.processInstanceId}
                </if>
                <if test="terms.caseTaskId != null and terms.caseTaskId !=''">
                    and case_task_id = #{terms.caseTaskId}
                </if>
                <if test="terms.applyId != null and terms.applyId !=''">
                    and apply_id = #{terms.applyId}
                </if>
                <if test="terms.assistUnitId != null and terms.assistUnitId !=''">
                    and assist_unit_id = #{terms.assistUnitId}
                </if>
                <if test="terms.assistUnitName != null and terms.assistUnitName !=''">
                    and assist_unit_name = #{terms.assistUnitName}
                </if>
                <if test="terms.acceptTime != null and terms.acceptTime !=''">
                    and accept_time = #{terms.acceptTime}
                </if>
                <if test="terms.assistUserId != null and terms.assistUserId !=''">
                    and assist_user_id = #{terms.assistUserId}
                </if>
                <if test="terms.assistUserName != null and terms.assistUserName !=''">
                    and assist_user_name = #{terms.assistUserName}
                </if>
                <if test="terms.assistStatus != null and terms.assistStatus !=''">
                    and assist_status = #{terms.assistStatus}
                </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="updateCaseAssistInfo">
        update
        <include refid="table-name"/>
        <set>
            <include refid="set-part"/>
        </set>
        <where>
            id = #{entity.id}
        </where>
    </update>
    <!-- 条件更新对象 -->
    <update id="updateCaseAssistInfoTerms">
        update
        <include refid="table-name"/>
        <set>
            <include refid="set-part"/>
        </set>
        <include refid="where-part"/>
    </update>
    <!--  根据编号物理删除  -->
    <delete id="deleteCaseAssistInfo">
        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>