广州市综治平台后端
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
<?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
 * @time:2024-09-25 10:00:00
 * @version 1.0.0
-->
<mapper namespace="cn.huge.module.cases.dao.mapper.ThGridCitizenEventMapper">
    <!-- 结果集 -->
    <resultMap id="dataResult" type="cn.huge.module.cases.domain.po.ThGridCitizenEvent">
        <result property="caseId" column="case_id"/>
        <result property="citizenEventCode" column="citizen_event_code"/>
        <result property="qrcodeImg" column="qrcode_img"/>
        <result property="title" column="title"/>
        <result property="reportTime" column="report_time"/>
        <result property="reportUser" column="report_user"/>
        <result property="entryItemName" column="entry_item_name"/>
        <result property="unifiedCode" column="unified_code"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
        <result property="deleteStatus" column="delete_status"/>
    </resultMap>
 
    <!-- 表 -->
    <sql id='table-name'>dyh_th_grid_citizen_event</sql>
 
    <!-- 字段 -->
    <sql id="column-part">
        case_id,
        citizen_event_code,
        qrcode_img,
        title,
        report_time,
        report_user,
        entry_item_name,
        unified_code,
        create_time,
        update_time,
        delete_status
    </sql>
 
    <!-- 条件查询 -->
    <select id="listTerms" resultMap="dataResult" parameterType="map">
        select
        <include refid="column-part"/>
        from
        <include refid="table-name"/>
        <where>
            delete_status = 0
            <if test="terms.caseId != null and terms.caseId != ''">
                and case_id = #{terms.caseId}
            </if>
            <if test="terms.citizenEventCode != null and terms.citizenEventCode != ''">
                and citizen_event_code = #{terms.citizenEventCode}
            </if>
            <if test="terms.title != null and terms.title != ''">
                and title like CONCAT('%',#{terms.title},'%')
            </if>
            <if test="terms.reportTimeStart != null and terms.reportTimeStart != ''">
                and report_time &gt;= #{terms.reportTimeStart}
            </if>
            <if test="terms.reportTimeEnd != null and terms.reportTimeEnd != ''">
                and report_time &lt;= #{terms.reportTimeEnd}
            </if>
            <if test="terms.reportUser != null and terms.reportUser != ''">
                and report_user like CONCAT('%',#{terms.reportUser},'%')
            </if>
        </where>
        order by create_time desc
    </select>
 
    <!-- 统计条数 -->
    <select id="countTerms" resultType="long" parameterType="map">
        select count(*) from
        <include refid="table-name"/>
        <where>
            delete_status = 0
            <if test="terms.caseId != null and terms.caseId != ''">
                and case_id = #{terms.caseId}
            </if>
            <if test="terms.citizenEventCode != null and terms.citizenEventCode != ''">
                and citizen_event_code = #{terms.citizenEventCode}
            </if>
            <if test="terms.title != null and terms.title != ''">
                and title like CONCAT('%',#{terms.title},'%')
            </if>
            <if test="terms.reportTimeStart != null and terms.reportTimeStart != ''">
                and report_time &gt;= #{terms.reportTimeStart}
            </if>
            <if test="terms.reportTimeEnd != null and terms.reportTimeEnd != ''">
                and report_time &lt;= #{terms.reportTimeEnd}
            </if>
            <if test="terms.reportUser != null and terms.reportUser != ''">
                and report_user like CONCAT('%',#{terms.reportUser},'%')
            </if>
        </where>
    </select>
 
    <!-- 分页查询 -->
    <select id="pageTerms" resultMap="dataResult" parameterType="map">
        select
        <include refid="column-part"/>
        from
        <include refid="table-name"/>
        <where>
            delete_status = 0
            <if test="terms.caseId != null and terms.caseId != ''">
                and case_id = #{terms.caseId}
            </if>
            <if test="terms.citizenEventCode != null and terms.citizenEventCode != ''">
                and citizen_event_code = #{terms.citizenEventCode}
            </if>
            <if test="terms.title != null and terms.title != ''">
                and title like CONCAT('%',#{terms.title},'%')
            </if>
            <if test="terms.reportTimeStart != null and terms.reportTimeStart != ''">
                and report_time &gt;= #{terms.reportTimeStart}
            </if>
            <if test="terms.reportTimeEnd != null and terms.reportTimeEnd != ''">
                and report_time &lt;= #{terms.reportTimeEnd}
            </if>
            <if test="terms.reportUser != null and terms.reportUser != ''">
                and report_user like CONCAT('%',#{terms.reportUser},'%')
            </if>
        </where>
        order by create_time desc
        limit #{page.offset}, #{page.pageSize}
    </select>
 
    <!-- 更新对象 -->
    <update id="updateThGridCitizenEvent" parameterType="cn.huge.module.cases.domain.po.ThGridCitizenEvent">
        update
        <include refid="table-name"/>
        <set>
            <if test="entity.citizenEventCode != null and entity.citizenEventCode != ''">
                citizen_event_code = #{entity.citizenEventCode},
            </if>
            <if test="entity.qrcodeImg != null and entity.qrcodeImg != ''">
                qrcode_img = #{entity.qrcodeImg},
            </if>
            <if test="entity.title != null and entity.title != ''">
                title = #{entity.title},
            </if>
            <if test="entity.reportTime != null">
                report_time = #{entity.reportTime},
            </if>
            <if test="entity.reportUser != null and entity.reportUser != ''">
                report_user = #{entity.reportUser},
            </if>
            <if test="entity.entryItemName != null and entity.entryItemName != ''">
                entry_item_name = #{entity.entryItemName},
            </if>
            <if test="entity.unifiedCode != null and entity.unifiedCode != ''">
                unified_code = #{entity.unifiedCode},
            </if>
            update_time = now()
        </set>
        where case_id = #{entity.caseId}
    </update>
 
    <!-- 条件更新 -->
    <update id="updateThGridCitizenEventTerms" parameterType="map">
        update
        <include refid="table-name"/>
        <set>
            <if test="entity.citizenEventCode != null and entity.citizenEventCode != ''">
                citizen_event_code = #{entity.citizenEventCode},
            </if>
            <if test="entity.qrcodeImg != null and entity.qrcodeImg != ''">
                qrcode_img = #{entity.qrcodeImg},
            </if>
            <if test="entity.title != null and entity.title != ''">
                title = #{entity.title},
            </if>
            <if test="entity.reportTime != null">
                report_time = #{entity.reportTime},
            </if>
            <if test="entity.reportUser != null and entity.reportUser != ''">
                report_user = #{entity.reportUser},
            </if>
            <if test="entity.entryItemName != null and entity.entryItemName != ''">
                entry_item_name = #{entity.entryItemName},
            </if>
            <if test="entity.unifiedCode != null and entity.unifiedCode != ''">
                unified_code = #{entity.unifiedCode},
            </if>
            update_time = now()
        </set>
        <where>
            delete_status = 0
            <if test="terms.caseId != null and terms.caseId != ''">
                and case_id = #{terms.caseId}
            </if>
            <if test="terms.citizenEventCode != null and terms.citizenEventCode != ''">
                and citizen_event_code = #{terms.citizenEventCode}
            </if>
        </where>
    </update>
 
    <!-- 物理删除 -->
    <delete id="deleteThGridCitizenEvent" parameterType="java.lang.String">
        delete from
        <include refid="table-name"/>
        where case_id = #{caseId}
    </delete>
 
    <!-- 根据案件ID查询市民工单信息 -->
    <select id="getByCaseId" resultMap="dataResult" parameterType="java.lang.String">
        select
        <include refid="column-part"/>
        from
        <include refid="table-name"/>
        where case_id = #{caseId} and delete_status = 0
    </select>
</mapper>