lin
2024-04-11 440a38bf126ccc8b19352ee6f89ef3141775ec63
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
<?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">
<mapper namespace="org.springblade.modules.task.mapper.TaskLabelReportingEventMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="taskLabelReportingEventResultMap" type="org.springblade.modules.task.entity.TaskLabelReportingEventEntity">
        <result property="id"    column="id"    />
        <result property="taskId"    column="task_id"    />
        <result property="placeId"    column="place_id"    />
        <result property="districtName"    column="district_name"    />
        <result property="happenTime"    column="happen_time"    />
        <result property="userId"    column="user_id"    />
        <result property="owner"    column="owner"    />
        <result property="phoneNumber"    column="phone_number"    />
        <result property="imageUrls"    column="image_urls"    />
        <result property="localtion"    column="localtion"    />
        <result property="eventType"    column="event_type"    />
        <result property="confirmFlag"    column="confirm_flag"    />
        <result property="confirmUserId"    column="confirm_user_id"    />
        <result property="confirmTime"    column="confirm_time"    />
        <result property="confirmNotion"    column="confirm_notion"    />
        <result property="transactionObjectTel"    column="transaction_object_tel"    />
        <result property="transactionMoney"    column="transaction_money"    />
        <result property="goodsNums"    column="goods_nums"    />
        <result property="goodsImageUrls"    column="goods_image_urls"    />
        <result property="transactionObject"    column="transaction_object"    />
        <result property="transactionProcess"    column="transaction_process"    />
        <result property="labelName"    column="label_name"    />
        <result property="source"    column="source"    />
        <result property="createTime"    column="create_time"    />
        <result property="createUser"    column="create_user"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateUser"    column="update_user"    />
        <result property="isDeleted"    column="is_deleted"    />
        <result property="idCard"    column="id_card"    />
        <result property="receiptUrls"    column="receipt_urls"    />
    </resultMap>
 
    <!--二手交易自定义分页查询-->
    <select id="selectTaskLabelReportingEventPage" resultType="org.springblade.modules.task.vo.TaskLabelReportingEventVO">
        select
        jtlre.*,
        jp.place_name,
        jp.principal,
        jp.principal_phone,
        jp.nine_type ,
        jp.front_type ,
        jp.location,
        br.town_name streetName,
        br.village_name communityName
        from
        jczz_task_label_reporting_event jtlre
        LEFT JOIN jczz_place jp ON jtlre.place_id=jp.id and jp.is_deleted = 0
        LEFT JOIN jczz_grid jg on jg.grid_code = jp.grid_code and jg.is_deleted = 0
        LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
        LEFT JOIN blade_region br on br.code = jpag.community_code
        where jtlre.is_deleted = 0
        <if test="taskLabelReportingEvent.userId != null and taskLabelReportingEvent.userId != ''">
            AND jtlre.user_id = #{taskLabelReportingEvent.userId}
        </if>
 
        <if test="taskLabelReportingEvent.houseCode != null  and taskLabelReportingEvent.houseCode != ''">
            and jp.house_code = #{taskLabelReportingEvent.houseCode}
        </if>
 
        <if test="taskLabelReportingEvent.eventType != null and taskLabelReportingEvent.eventType != ''">
            AND jtlre.event_type = #{taskLabelReportingEvent.eventType}
        </if>
        <if test="taskLabelReportingEvent.transactionObject != null and taskLabelReportingEvent.transactionObject != ''">
            AND jtlre.transaction_object like concat('%',#{taskLabelReportingEvent.transactionObject},'%')
        </if>
        <if test="taskLabelReportingEvent.transactionObjectTel != null and taskLabelReportingEvent.transactionObjectTel != ''">
            AND jtlre.transaction_object_tel like concat('%',#{taskLabelReportingEvent.transactionObjectTel},'%')
        </if>
        <if test="taskLabelReportingEvent.idCard != null and taskLabelReportingEvent.idCard != ''">
            AND jtlre.id_card like concat('%',#{taskLabelReportingEvent.idCard},'%')
        </if>
        <if test="taskLabelReportingEvent.frontType != null ">
            AND jp.front_type = #{taskLabelReportingEvent.frontType}
        </if>
        <if test="taskLabelReportingEvent.placeName != null and taskLabelReportingEvent.placeName != ''">
            AND jp.place_name like concat('%',#{taskLabelReportingEvent.placeName},'%')
        </if>
        <if test="taskLabelReportingEvent.principal != null and taskLabelReportingEvent.principal != ''">
            AND jp.principal like concat('%',#{taskLabelReportingEvent.principal},'%')
        </if>
        <if test="taskLabelReportingEvent.principalPhone != null and taskLabelReportingEvent.principalPhone != ''">
            AND jp.principal_phone like concat('%',#{taskLabelReportingEvent.principalPhone},'%')
        </if>
        <if test="taskLabelReportingEvent.roleName != null and taskLabelReportingEvent.roleName != ''">
            <if test="taskLabelReportingEvent.roleName=='wgy'">
                <if test="isAdministrator==2">
                    <choose>
                        <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                            and jp.grid_code in
                            <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                #{code}
                            </foreach>
                        </when>
                        <otherwise>
                            and jp.grid_code in ('')
                        </otherwise>
                    </choose>
                </if>
            </if>
            <if test="taskLabelReportingEvent.roleName=='mj'">
                <if test="isAdministrator==2">
                    <choose>
                        <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                            and jpag.community_code in
                            <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                #{code}
                            </foreach>
                        </when>
                        <otherwise>
                            and jpag.community_code in ('')
                        </otherwise>
                    </choose>
                </if>
            </if>
        </if>
        <if test="isAdministrator==2">
            <choose>
                <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                    and
                    (
                    jg.grid_code in
                    <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                        #{code}
                    </foreach>
                    or
                    br.village_code in
                    <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                        #{code}
                    </foreach>
                    )
                </when>
                <otherwise>
                    and
                    (
                    jg.grid_code in ('') or br.village_code in ('')
                    )
                </otherwise>
            </choose>
        </if>
        order by jtlre.create_time desc,jtlre.id desc
    </select>
 
 
    <resultMap type="org.springblade.modules.task.dto.TaskLabelReportingEventDTO" id="TaskLabelReportingEventDTOResult">
        <result property="id"    column="id"    />
        <result property="taskId"    column="task_id"    />
        <result property="placeId"    column="place_id"    />
        <result property="districtName"    column="district_name"    />
        <result property="happenTime"    column="happen_time"    />
        <result property="userId"    column="user_id"    />
        <result property="owner"    column="owner"    />
        <result property="phoneNumber"    column="phone_number"    />
        <result property="imageUrls"    column="image_urls"    />
        <result property="localtion"    column="localtion"    />
        <result property="eventType"    column="event_type"    />
        <result property="confirmFlag"    column="confirm_flag"    />
        <result property="confirmUserId"    column="confirm_user_id"    />
        <result property="confirmTime"    column="confirm_time"    />
        <result property="confirmNotion"    column="confirm_notion"    />
        <result property="transactionObjectTel"    column="transaction_object_tel"    />
        <result property="transactionMoney"    column="transaction_money"    />
        <result property="goodsNums"    column="goods_nums"    />
        <result property="goodsImageUrls"    column="goods_image_urls"    />
        <result property="transactionObject"    column="transaction_object"    />
        <result property="transactionProcess"    column="transaction_process"    />
        <result property="labelName"    column="label_name"    />
        <result property="source"    column="source"    />
        <result property="createTime"    column="create_time"    />
        <result property="createUser"    column="create_user"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateUser"    column="update_user"    />
        <result property="isDeleted"    column="is_deleted"    />
        <result property="idCard"    column="id_card"    />
        <result property="receiptUrls"    column="receipt_urls"    />
    </resultMap>
 
    <sql id="selectTaskLabelReportingEvent">
        select
            id,
            task_id,
            place_id,
            district_name,
            happen_time,
            user_id,
            owner,
            phone_number,
            image_urls,
            localtion,
            event_type,
            confirm_flag,
            confirm_user_id,
            confirm_time,
            confirm_notion,
            transaction_object_tel,
            transaction_money,
            goods_nums,
            goods_image_urls,
            transaction_object,
            transaction_process,
            label_name,
            source,
            create_time,
            create_user,
            update_time,
            update_user,
            is_deleted,
            id_card,
            receipt_urls
        from
            jczz_task_label_reporting_event
    </sql>
 
    <select id="selectTaskLabelReportingEventById" parameterType="long" resultMap="TaskLabelReportingEventDTOResult">
        <include refid="selectTaskLabelReportingEvent"/>
        where
        id = #{id}
    </select>
 
    <select id="selectTaskLabelReportingEventList" parameterType="org.springblade.modules.task.dto.TaskLabelReportingEventDTO" resultMap="TaskLabelReportingEventDTOResult">
        <include refid="selectTaskLabelReportingEvent"/>
        <where>
            <if test="id != null "> and id = #{id}</if>
            <if test="taskId != null "> and task_id = #{taskId}</if>
            <if test="placeId != null "> and place_id = #{placeId}</if>
            <if test="districtName != null  and districtName != ''"> and district_name = #{districtName}</if>
            <if test="happenTime != null "> and happen_time = #{happenTime}</if>
            <if test="userId != null "> and user_id = #{userId}</if>
            <if test="owner != null  and owner != ''"> and owner = #{owner}</if>
            <if test="phoneNumber != null  and phoneNumber != ''"> and phone_number = #{phoneNumber}</if>
            <if test="imageUrls != null  and imageUrls != ''"> and image_urls = #{imageUrls}</if>
            <if test="localtion != null  and localtion != ''"> and localtion = #{localtion}</if>
            <if test="eventType != null  and eventType != ''"> and event_type = #{eventType}</if>
            <if test="confirmFlag != null  and confirmFlag != ''"> and confirm_flag = #{confirmFlag}</if>
            <if test="confirmUserId != null "> and confirm_user_id = #{confirmUserId}</if>
            <if test="confirmTime != null "> and confirm_time = #{confirmTime}</if>
            <if test="confirmNotion != null  and confirmNotion != ''"> and confirm_notion = #{confirmNotion}</if>
            <if test="transactionObjectTel != null  and transactionObjectTel != ''"> and transaction_object_tel = #{transactionObjectTel}</if>
            <if test="transactionMoney != null "> and transaction_money = #{transactionMoney}</if>
            <if test="goodsNums != null "> and goods_nums = #{goodsNums}</if>
            <if test="goodsImageUrls != null  and goodsImageUrls != ''"> and goods_image_urls = #{goodsImageUrls}</if>
            <if test="transactionObject != null  and transactionObject != ''"> and transaction_object = #{transactionObject}</if>
            <if test="transactionProcess != null  and transactionProcess != ''"> and transaction_process = #{transactionProcess}</if>
            <if test="labelName != null  and labelName != ''"> and label_name = #{labelName}</if>
            <if test="source != null "> and source = #{source}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="createUser != null "> and create_user = #{createUser}</if>
            <if test="updateTime != null "> and update_time = #{updateTime}</if>
            <if test="updateUser != null "> and update_user = #{updateUser}</if>
            <if test="isDeleted != null "> and is_deleted = #{isDeleted}</if>
            <if test="idCard != null  and idCard != ''"> and id_card = #{idCard}</if>
            <if test="receiptUrls != null  and receiptUrls != ''"> and receipt_urls = #{receiptUrls}</if>
        </where>
    </select>
 
    <!--二手交易自定义分页查询-->
    <select id="exportTaskLabelReportingEventList" resultType="org.springblade.modules.task.excel.TaskLabelReportingEventExcel">
        select
        jtlre.id,
        jtlre.transaction_object,
        jtlre.transaction_object_tel,
        jtlre.id_card,
        jtlre.goods_nums,
        jtlre.transaction_money,
        jtlre.transaction_process,
        case when jtlre.confirm_flag=1 then '待审核'
        when jtlre.confirm_flag=2 then '审核通过'
        when jtlre.confirm_flag=3 then '审核不通过'
        else '待完成' end as confirm_flag,
        jtlre.confirm_notion,
        jtlre.create_time,
        jp.place_name,
        jp.principal,
        jp.principal_phone,
        jp.nine_type ,
        jp.front_type ,
        jp.location,
        br.town_name streetName,
        br.village_name communityName
        from
        jczz_task_label_reporting_event jtlre
        LEFT JOIN jczz_place jp ON jtlre.place_id=jp.id and jp.is_deleted = 0
        LEFT JOIN jczz_grid jg on jg.grid_code = jp.grid_code and jg.is_deleted = 0
        LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
        LEFT JOIN blade_region br on br.code = jpag.community_code
        where jtlre.is_deleted = 0
        <if test="taskLabelReportingEvent.userId != null and taskLabelReportingEvent.userId != ''">
            AND jtlre.user_id = #{taskLabelReportingEvent.userId}
        </if>
        <if test="taskLabelReportingEvent.eventType != null and taskLabelReportingEvent.eventType != ''">
            AND jtlre.event_type = #{taskLabelReportingEvent.eventType}
        </if>
        <if test="taskLabelReportingEvent.transactionObject != null and taskLabelReportingEvent.transactionObject != ''">
            AND jtlre.transaction_object like concat('%',#{taskLabelReportingEvent.transactionObject},'%')
        </if>
        <if test="taskLabelReportingEvent.transactionObjectTel != null and taskLabelReportingEvent.transactionObjectTel != ''">
            AND jtlre.transaction_object_tel like concat('%',#{taskLabelReportingEvent.transactionObjectTel},'%')
        </if>
        <if test="taskLabelReportingEvent.idCard != null and taskLabelReportingEvent.idCard != ''">
            AND jtlre.id_card like concat('%',#{taskLabelReportingEvent.idCard},'%')
        </if>
        <if test="taskLabelReportingEvent.frontType != null ">
            AND jp.front_type = #{taskLabelReportingEvent.frontType}
        </if>
        <if test="taskLabelReportingEvent.placeName != null and taskLabelReportingEvent.placeName != ''">
            AND jp.place_name like concat('%',#{taskLabelReportingEvent.placeName},'%')
        </if>
        <if test="taskLabelReportingEvent.principal != null and taskLabelReportingEvent.principal != ''">
            AND jp.principal like concat('%',#{taskLabelReportingEvent.principal},'%')
        </if>
        <if test="taskLabelReportingEvent.principalPhone != null and taskLabelReportingEvent.principalPhone != ''">
            AND jp.principal_phone like concat('%',#{taskLabelReportingEvent.principalPhone},'%')
        </if>
        <if test="taskLabelReportingEvent.roleName != null and taskLabelReportingEvent.roleName != ''">
            <if test="taskLabelReportingEvent.roleName=='wgy'">
                <if test="isAdministrator==2">
                    <choose>
                        <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                            and jp.grid_code in
                            <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                #{code}
                            </foreach>
                        </when>
                        <otherwise>
                            and jp.grid_code in ('')
                        </otherwise>
                    </choose>
                </if>
            </if>
            <if test="taskLabelReportingEvent.roleName=='mj'">
                <if test="isAdministrator==2">
                    <choose>
                        <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                            and jpag.community_code in
                            <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                #{code}
                            </foreach>
                        </when>
                        <otherwise>
                            and jpag.community_code in ('')
                        </otherwise>
                    </choose>
                </if>
            </if>
        </if>
        <if test="isAdministrator==2">
            <choose>
                <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                    and
                    (
                    jg.grid_code in
                    <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                        #{code}
                    </foreach>
                    or
                    br.village_code in
                    <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                        #{code}
                    </foreach>
                    )
                </when>
                <otherwise>
                    and
                    (
                    jg.grid_code in ('') or br.village_code in ('')
                    )
                </otherwise>
            </choose>
        </if>
        order by jtlre.create_time desc,jtlre.id desc
    </select>
 
    <!--二手交易自定义分页查询-->
    <select id="getDetail" resultType="org.springblade.modules.task.vo.TaskLabelReportingEventVO">
        select
        jtlre.*,
        jp.place_name,
        jp.principal,
        jp.principal_phone,
        jp.nine_type ,
        jp.front_type ,
        jp.location
        from
        jczz_task_label_reporting_event jtlre
        LEFT JOIN jczz_place jp ON jtlre.place_id=jp.id and jp.is_deleted = 0
        where jtlre.is_deleted = 0
        <if test="taskLabelReportingEvent.id != null">
            AND jtlre.id = #{taskLabelReportingEvent.id}
        </if>
        <if test="taskLabelReportingEvent.taskId != null">
            AND jtlre.task_id = #{taskLabelReportingEvent.taskId}
        </if>
    </select>
 
 
</mapper>