CeDo
2021-06-05 9cfd18f1e6ebfeb94030e3a907cd5e79e51a0780
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
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
<?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="com.panzhihua.service_grid.dao.EventMapper">
 
     <resultMap id="baseResult" type="com.panzhihua.service_grid.model.dos.EventDO">
        <result property="id" column="id"/>
        <result property="orderSn" column="order_sn"/>
        <result property="eventCategory" column="event_category"/>
        <result property="gridMemberStreet" column="grid_member_street"/>
        <result property="gridMemberCommunity" column="grid_member_community"/>
        <result property="gridId" column="grid_id"/>
        <result property="gridMemberId" column="grid_member_id"/>
        <result property="gridMemberName" column="grid_member_name"/>
        <result property="gridMemberTelephone" column="grid_member_telephone"/>
        <result property="eventTitle" column="event_title"/>
        <result property="propagandaType" column="propaganda_type"/>
        <result property="propagandaTime" column="propaganda_time"/>
        <result property="eventType" column="event_type"/>
        <result property="eventDes" column="event_des"/>
        <result property="propagandaObject" column="propaganda_object"/>
        <result property="propagandaNum" column="propaganda_num"/>
        <result property="communityProcess" column="community_process"/>
        <result property="happenTime" column="happen_time"/>
        <result property="happentAddress" column="happent_address"/>
        <result property="happenAddress" column="happen_address"/>
        <result property="happentLatLng" column="happent_lat_lng"/>
        <result property="eventStatus" column="event_status"/>
        <result property="eventProcessStatus" column="event_process_status"/>
        <result property="processType" column="process_type"/>
        <result property="processUserId" column="process_user_id"/>
        <result property="processUserName" column="process_user_name"/>
        <result property="processDate" column="process_date"/>
        <result property="processDesc" column="process_desc"/>
        <result property="eventResource" column="event_resource"/>
        <result property="dangerLevel" column="danger_level"/>
        <result property="redCard" column="red_card"/>
        <result property="yellowCard" column="yellow_card"/>
        <result property="invalid" column="invalid"/>
        <result property="major" column="major"/>
        <result property="deathsNumber" column="deaths_number"/>
        <result property="injuriesNumber" column="injuries_number"/>
        <result property="difficult" column="difficult"/>
        <result property="urgent" column="urgent"/>
        <result property="urgentDell" column="urgent_dell"/>
        <result property="submitDate" column="submit_date"/>
        <result property="createBy" column="create_by"/>
        <result property="createAt" column="create_at"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateAt" column="update_at"/>
        <result property="eventClazz" column="event_clazz"/>
        <result property="eventDealStatus" column="event_deal_status"/>
    </resultMap>
 
    <sql id="columns">
    <![CDATA[
        id,order_sn,event_category,grid_member_street,happen_address,grid_member_community,event_clazz,grid_id,grid_member_id,grid_member_name,grid_member_telephone,
        event_title,propaganda_type,propaganda_time,event_type,event_des,propaganda_object,propaganda_num,community_process,happen_time,happent_address,happent_lat_lng,
        event_status,event_process_status,process_type,process_user_id,process_user_name,process_date,process_desc,event_resource,danger_level,red_card,yellow_card,invalid,
        major,deaths_number,injuries_number,difficult,urgent,urgent_dell,submit_date,create_by,create_at,update_by,update_at,event_deal_status
    ]]>
    </sql>
 
 
    <select id="findByPage" resultType="com.panzhihua.common.model.vos.grid.EventVO"
        parameterType="com.panzhihua.common.model.dtos.grid.PageEventDTO">
        SELECT <include refid="columns" />
        FROM event
        <where>
            event_status != 3 AND event_category = 1
            <if test="pageEventDTO.eventDealStatus!=null">
                AND event_deal_status = #{pageEventDTO.eventDealStatus}
            </if>
           <if test="pageEventDTO.id!=null">
                AND id = #{pageEventDTO.id}
            </if>
           <if test="pageEventDTO.orderSn!=null">
                AND order_sn = #{pageEventDTO.orderSn}
            </if>
           <if test="pageEventDTO.eventCategory!=null">
                AND event_category = #{pageEventDTO.eventCategory}
            </if>
           <if test="pageEventDTO.gridMemberStreet!=null">
                AND grid_member_street = #{pageEventDTO.gridMemberStreet}
            </if>
           <if test="pageEventDTO.gridMemberCommunity!=null">
                AND grid_member_community = #{pageEventDTO.gridMemberCommunity}
            </if>
           <if test="pageEventDTO.gridId!=null">
                AND grid_id = #{pageEventDTO.gridId}
            </if>
           <if test="pageEventDTO.gridMemberId!=null">
                AND grid_member_id = #{pageEventDTO.gridMemberId}
            </if>
           <if test="pageEventDTO.gridMemberName!=null">
                AND grid_member_name = #{pageEventDTO.gridMemberName}
            </if>
           <if test="pageEventDTO.gridMemberTelephone!=null">
                AND grid_member_telephone = #{pageEventDTO.gridMemberTelephone}
            </if>
           <if test="pageEventDTO.eventTitle!=null">
                AND event_title = #{pageEventDTO.eventTitle}
            </if>
           <if test="pageEventDTO.propagandaType!=null">
                AND propaganda_type = #{pageEventDTO.propagandaType}
            </if>
           <if test="pageEventDTO.propagandaTimeBegin!=null">
                AND propaganda_time <![CDATA[>=]]> #{pageEventDTO.propagandaTimeBegin}
           </if>
           <if test="pageEventDTO.propagandaTimeEnd!=null">
                AND propaganda_time <![CDATA[<=]]> #{pageEventDTO.propagandaTimeEnd}
           </if>
           <if test="pageEventDTO.eventType!=null">
                AND event_type = #{pageEventDTO.eventType}
            </if>
           <if test="pageEventDTO.eventDes!=null">
                AND event_des = #{pageEventDTO.eventDes}
            </if>
           <if test="pageEventDTO.propagandaObject!=null">
                AND propaganda_object = #{pageEventDTO.propagandaObject}
            </if>
           <if test="pageEventDTO.propagandaNum!=null">
                AND propaganda_num = #{pageEventDTO.propagandaNum}
            </if>
           <if test="pageEventDTO.communityProcess!=null">
                AND community_process = #{pageEventDTO.communityProcess}
            </if>
           <if test="pageEventDTO.happenTimeBegin!=null">
                AND happen_time <![CDATA[>=]]> #{pageEventDTO.happenTimeBegin}
           </if>
           <if test="pageEventDTO.happenTimeEnd!=null">
                AND happen_time <![CDATA[<=]]> #{pageEventDTO.happenTimeEnd}
           </if>
           <if test="pageEventDTO.happentAddress!=null">
                AND happent_address = #{pageEventDTO.happentAddress}
            </if>
           <if test="pageEventDTO.happentLatLng!=null">
                AND happent_lat_lng = #{pageEventDTO.happentLatLng}
            </if>
           <if test="pageEventDTO.eventStatus!=null">
                AND event_status = #{pageEventDTO.eventStatus}
            </if>
           <if test="pageEventDTO.eventProcessStatus!=null">
                AND event_process_status = #{pageEventDTO.eventProcessStatus}
            </if>
           <if test="pageEventDTO.processType!=null">
                AND process_type = #{pageEventDTO.processType}
            </if>
           <if test="pageEventDTO.processUserId!=null">
                AND process_user_id = #{pageEventDTO.processUserId}
            </if>
           <if test="pageEventDTO.processUserName!=null">
                AND process_user_name = #{pageEventDTO.processUserName}
            </if>
           <if test="pageEventDTO.processDateBegin!=null">
                AND process_date <![CDATA[>=]]> #{pageEventDTO.processDateBegin}
           </if>
           <if test="pageEventDTO.processDateEnd!=null">
                AND process_date <![CDATA[<=]]> #{pageEventDTO.processDateEnd}
           </if>
           <if test="pageEventDTO.processDesc!=null">
                AND process_desc = #{pageEventDTO.processDesc}
            </if>
           <if test="pageEventDTO.eventResource!=null">
                AND event_resource = #{pageEventDTO.eventResource}
            </if>
           <if test="pageEventDTO.dangerLevel!=null">
                AND danger_level = #{pageEventDTO.dangerLevel}
            </if>
           <if test="pageEventDTO.redCard!=null">
                AND red_card = #{pageEventDTO.redCard}
            </if>
           <if test="pageEventDTO.yellowCard!=null">
                AND yellow_card = #{pageEventDTO.yellowCard}
            </if>
           <if test="pageEventDTO.invalid!=null">
                AND invalid = #{pageEventDTO.invalid}
            </if>
           <if test="pageEventDTO.major!=null">
                AND major = #{pageEventDTO.major}
            </if>
           <if test="pageEventDTO.deathsNumber!=null">
                AND deaths_number = #{pageEventDTO.deathsNumber}
            </if>
           <if test="pageEventDTO.injuriesNumber!=null">
                AND injuries_number = #{pageEventDTO.injuriesNumber}
            </if>
           <if test="pageEventDTO.difficult!=null">
                AND difficult = #{pageEventDTO.difficult}
            </if>
           <if test="pageEventDTO.urgent!=null">
                AND urgent = #{pageEventDTO.urgent}
            </if>
           <if test="pageEventDTO.urgentDell!=null">
                AND urgent_dell = #{pageEventDTO.urgentDell}
            </if>
           <if test="pageEventDTO.submitDateBegin!=null">
                AND submit_date <![CDATA[>=]]> #{pageEventDTO.submitDateBegin}
           </if>
           <if test="pageEventDTO.submitDateEnd!=null">
                AND submit_date <![CDATA[<=]]> #{pageEventDTO.submitDateEnd}
           </if>
           <if test="pageEventDTO.createBy!=null">
                AND create_by = #{pageEventDTO.createBy}
            </if>
           <if test="pageEventDTO.createAtBegin!=null">
                AND create_at  <![CDATA[>=]]> #{pageEventDTO.createAtBegin}
           </if>
           <if test="pageEventDTO.createAtEnd!=null">
                AND create_at <![CDATA[<=]]> #{pageEventDTO.createAtEnd}
           </if>
           <if test="pageEventDTO.updateBy!=null">
                AND update_by = #{pageEventDTO.updateBy}
            </if>
           <if test="pageEventDTO.updateAtBegin!=null">
                AND update_at <![CDATA[>=]]> #{pageEventDTO.updateAtBegin}
           </if>
           <if test="pageEventDTO.updateAtEnd!=null">
                AND update_at <![CDATA[<=]]> #{pageEventDTO.updateAtEnd}
           </if>
        </where>
        <if test="pageEventDTO.sortColumns!=null">
            ORDER BY ${pageEventDTO.sortColumns} ${pageEventDTO.sortType}
        </if>
    </select>
    <select id="findPublicityByPage" resultType="com.panzhihua.common.model.vos.grid.EventVO"
            parameterType="com.panzhihua.common.model.dtos.grid.PagePublicityEventDTO">
        SELECT
            e.id,e.order_sn,e.event_category,e.grid_member_street,e.happen_address,e.grid_member_community,e.event_clazz,e.grid_id,e.grid_member_id,e.grid_member_name,e.grid_member_telephone,
            e.event_title,e.propaganda_type,e.propaganda_time,e.event_type,e.event_des,e.propaganda_object,e.propaganda_num,e.community_process,e.happen_time,e.happent_address,e.happent_lat_lng,
            e.event_status,e.event_process_status,e.process_type,e.process_user_id,e.process_user_name,e.process_date,e.process_desc,e.event_resource,e.danger_level,e.red_card,e.yellow_card,e.invalid,
            e.major,e.deaths_number,e.injuries_number,e.difficult,e.urgent,e.urgent_dell,e.submit_date,e.create_by,e.create_at,e.update_by,e.update_at,e.event_deal_status
        FROM
            event e left join event_grid_data egd on e.grid_id = egd.id
        <where>
            e.event_status != 3 AND e.event_category = 2
            <if test="pagePublicityEventDTO.communityId!=null">
                AND egd.grid_community_id = #{pageEventManageDTO.communityId}
            </if>
            <if test="pagePublicityEventDTO.eventDealStatus!=null">
                AND e.event_deal_status = #{pagePublicityEventDTO.eventDealStatus}
            </if>
            <if test="pagePublicityEventDTO.id!=null">
                AND e.id = #{pagePublicityEventDTO.id}
            </if>
            <if test="pagePublicityEventDTO.orderSn!=null">
                AND e.order_sn = #{pagePublicityEventDTO.orderSn}
            </if>
            <if test="pagePublicityEventDTO.eventCategory!=null">
                AND e.event_category = #{pagePublicityEventDTO.eventCategory}
            </if>
            <if test="pagePublicityEventDTO.gridMemberStreet!=null">
                AND e.grid_member_street = #{pagePublicityEventDTO.gridMemberStreet}
            </if>
            <if test="pagePublicityEventDTO.gridMemberCommunity!=null">
                AND e.grid_member_community = #{pagePublicityEventDTO.gridMemberCommunity}
            </if>
            <if test="pagePublicityEventDTO.gridId!=null">
                AND e.grid_id = #{pagePublicityEventDTO.gridId}
            </if>
            <if test="pagePublicityEventDTO.gridMemberId!=null">
                AND e.grid_member_id = #{pagePublicityEventDTO.gridMemberId}
            </if>
            <if test="pagePublicityEventDTO.gridMemberName!=null">
                AND e.grid_member_name = #{pagePublicityEventDTO.gridMemberName}
            </if>
            <if test="pagePublicityEventDTO.gridMemberTelephone!=null">
                AND e.grid_member_telephone = #{pagePublicityEventDTO.gridMemberTelephone}
            </if>
            <if test="pagePublicityEventDTO.eventTitle!=null">
                AND e.event_title = #{pagePublicityEventDTO.eventTitle}
            </if>
            <if test="pagePublicityEventDTO.propagandaType!=null">
                AND e.propaganda_type = #{pagePublicityEventDTO.propagandaType}
            </if>
            <if test="pagePublicityEventDTO.propagandaTimeBegin!=null">
                AND e.propaganda_time <![CDATA[>=]]> #{pagePublicityEventDTO.propagandaTimeBegin}
            </if>
            <if test="pagePublicityEventDTO.propagandaTimeEnd!=null">
                AND e.propaganda_time <![CDATA[<=]]> #{pagePublicityEventDTO.propagandaTimeEnd}
            </if>
            <if test="pagePublicityEventDTO.eventDes!=null">
                AND e.event_des = #{pagePublicityEventDTO.eventDes}
            </if>
            <if test="pagePublicityEventDTO.propagandaObject!=null">
                AND e.propaganda_object = #{pagePublicityEventDTO.propagandaObject}
            </if>
            <if test="pagePublicityEventDTO.propagandaNum!=null">
                AND e.propaganda_num = #{pagePublicityEventDTO.propagandaNum}
            </if>
            <if test="pagePublicityEventDTO.communityProcess!=null">
                AND e.community_process = #{pagePublicityEventDTO.communityProcess}
            </if>
            <if test="pagePublicityEventDTO.happenTimeBegin!=null">
                AND e.happen_time <![CDATA[>=]]> #{pagePublicityEventDTO.happenTimeBegin}
            </if>
            <if test="pagePublicityEventDTO.happenTimeEnd!=null">
                AND e.happen_time <![CDATA[<=]]> #{pagePublicityEventDTO.happenTimeEnd}
            </if>
            <if test="pagePublicityEventDTO.happentAddress!=null">
                AND e.happent_address = #{pagePublicityEventDTO.happentAddress}
            </if>
            <if test="pagePublicityEventDTO.happentLatLng!=null">
                AND e.happent_lat_lng = #{pagePublicityEventDTO.happentLatLng}
            </if>
            <if test="pagePublicityEventDTO.eventStatus!=null">
                AND e.event_status = #{pagePublicityEventDTO.eventStatus}
            </if>
            <if test="pagePublicityEventDTO.eventProcessStatus!=null">
                AND e.event_process_status = #{pagePublicityEventDTO.eventProcessStatus}
            </if>
            <if test="pagePublicityEventDTO.processType!=null">
                AND e.process_type = #{pagePublicityEventDTO.processType}
            </if>
            <if test="pagePublicityEventDTO.processUserId!=null">
                AND e.process_user_id = #{pagePublicityEventDTO.processUserId}
            </if>
            <if test="pagePublicityEventDTO.processUserName!=null">
                AND e.process_user_name = #{pagePublicityEventDTO.processUserName}
            </if>
            <if test="pagePublicityEventDTO.processDateBegin!=null">
                AND e.process_date <![CDATA[>=]]> #{pagePublicityEventDTO.processDateBegin}
            </if>
            <if test="pagePublicityEventDTO.processDateEnd!=null">
                AND e.process_date <![CDATA[<=]]> #{pagePublicityEventDTO.processDateEnd}
            </if>
            <if test="pagePublicityEventDTO.processDesc!=null">
                AND e.process_desc = #{pagePublicityEventDTO.processDesc}
            </if>
            <if test="pagePublicityEventDTO.eventResource!=null">
                AND e.event_resource = #{pagePublicityEventDTO.eventResource}
            </if>
            <if test="pagePublicityEventDTO.dangerLevel!=null">
                AND e.danger_level = #{pagePublicityEventDTO.dangerLevel}
            </if>
            <if test="pagePublicityEventDTO.redCard!=null">
                AND e.red_card = #{pagePublicityEventDTO.redCard}
            </if>
            <if test="pagePublicityEventDTO.yellowCard!=null">
                AND e.yellow_card = #{pagePublicityEventDTO.yellowCard}
            </if>
            <if test="pagePublicityEventDTO.invalid!=null">
                AND e.invalid = #{pagePublicityEventDTO.invalid}
            </if>
            <if test="pagePublicityEventDTO.major!=null">
                AND e.major = #{pagePublicityEventDTO.major}
            </if>
            <if test="pagePublicityEventDTO.deathsNumber!=null">
                AND e.deaths_number = #{pagePublicityEventDTO.deathsNumber}
            </if>
            <if test="pagePublicityEventDTO.injuriesNumber!=null">
                AND e.injuries_number = #{pagePublicityEventDTO.injuriesNumber}
            </if>
            <if test="pagePublicityEventDTO.difficult!=null">
                AND e.difficult = #{pagePublicityEventDTO.difficult}
            </if>
            <if test="pagePublicityEventDTO.urgent!=null">
                AND e.urgent = #{pagePublicityEventDTO.urgent}
            </if>
            <if test="pagePublicityEventDTO.urgentDell!=null">
                AND e.urgent_dell = #{pagePublicityEventDTO.urgentDell}
            </if>
            <if test="pagePublicityEventDTO.submitDateBegin!=null">
                AND e.submit_date <![CDATA[>=]]> #{pagePublicityEventDTO.submitDateBegin}
            </if>
            <if test="pagePublicityEventDTO.submitDateEnd!=null">
                AND e.submit_date <![CDATA[<=]]> #{pagePublicityEventDTO.submitDateEnd}
            </if>
            <if test="pagePublicityEventDTO.createBy!=null">
                AND e.create_by = #{pagePublicityEventDTO.createBy}
            </if>
            <if test="pagePublicityEventDTO.createAtBegin!=null">
                AND e.create_at  <![CDATA[>=]]> #{pagePublicityEventDTO.createAtBegin}
            </if>
            <if test="pagePublicityEventDTO.createAtEnd!=null">
                AND e.create_at <![CDATA[<=]]> #{pagePublicityEventDTO.createAtEnd}
            </if>
            <if test="pagePublicityEventDTO.updateBy!=null">
                AND e.update_by = #{pagePublicityEventDTO.updateBy}
            </if>
            <if test="pagePublicityEventDTO.updateAtBegin!=null">
                AND e.update_at <![CDATA[>=]]> #{pagePublicityEventDTO.updateAtBegin}
            </if>
            <if test="pagePublicityEventDTO.updateAtEnd!=null">
                AND e.update_at <![CDATA[<=]]> #{pagePublicityEventDTO.updateAtEnd}
            </if>
        </where>
        <if test="pagePublicityEventDTO.sortColumns!=null">
            ORDER BY e.${pagePublicityEventDTO.sortColumns} ${pagePublicityEventDTO.sortType}
        </if>
    </select>
 
    <select id="getEventByGridId" resultType="com.panzhihua.common.model.vos.grid.ComMapGridEventVO">
        SELECT
            id,
            event_type AS type,
            event_title AS eventTitle,
            happent_address AS happentAddress,
            happent_lat_lng AS happentLatLng
        FROM
            `event`
        WHERE
            ( event_category = 1 OR event_category = 2 )
            AND event_process_status = 1
            AND event_status = 2
            AND grid_id = #{gridId}
            AND process_type = 1 UNION ALL
        SELECT
            id,
            IFNULL( NULL, 7 ) AS type,
            event_title AS eventTitle,
            happent_address AS happentAddress,
            happent_lat_lng AS happentLatLng
        FROM
            event_visiting_tasks
        WHERE
            event_status = 1
            AND dell_type = 1
            AND grid_id = #{gridId}
    </select>
 
    <select id="getGridMemberImageUrl" resultType="String">
        select image_url from sys_user where user_id = #{gridMemberId}
    </select>
    <select id="findToManageByPage" resultType="com.panzhihua.common.model.vos.grid.EventVO"
            parameterType="com.panzhihua.common.model.dtos.grid.PageEventManageDTO">
        SELECT
            e.id,e.order_sn,e.event_category,e.grid_member_street,e.happen_address,e.grid_member_community,e.event_clazz,e.grid_id,e.grid_member_id,e.grid_member_name,e.grid_member_telephone,
            e.event_title,e.propaganda_type,e.propaganda_time,e.event_type,e.event_des,e.propaganda_object,e.propaganda_num,e.community_process,e.happen_time,e.happent_address,e.happent_lat_lng,
            e.event_status,e.event_process_status,e.process_type,e.process_user_id,e.process_user_name,e.process_date,e.process_desc,e.event_resource,e.danger_level,e.red_card,e.yellow_card,e.invalid,
            e.major,e.deaths_number,e.injuries_number,e.difficult,e.urgent,e.urgent_dell,e.submit_date,e.create_by,e.create_at,e.update_by,e.update_at,e.event_deal_status
        FROM
            event e left join event_grid_data egd on e.grid_id = egd.id
        <where>
            e.event_status != 3 AND e.event_category = 1
            <if test="pageEventManageDTO.communityId!=null">
                AND egd.grid_community_id = #{pageEventManageDTO.communityId}
            </if>
            <if test='pageEventManageDTO.keyWord != null and pageEventManageDTO.keyWord != &quot;&quot;'>
                AND (
                e.grid_member_name like concat('%', #{pageEventManageDTO.keyWord},'%') OR
                e.event_title like concat('%', #{pageEventManageDTO.keyWord},'%') OR
                e.happen_address like concat('%', #{pageEventManageDTO.keyWord},'%')
                e.order_sn like concat('%', #{pageEventManageDTO.keyWord},'%')
                )
             </if>
            <if test="pageEventManageDTO.eventDealStatus!=null">
                AND e.event_deal_status = #{pageEventManageDTO.eventDealStatus}
            </if>
            <if test="pageEventManageDTO.communityProcess!=null">
                AND e.community_process = #{pageEventManageDTO.communityProcess}
            </if>
            <if test="pageEventManageDTO.eventType!=null">
                AND e.event_type = #{pageEventManageDTO.eventType}
            </if>
            <if test="pageEventManageDTO.dangerLevel!=null">
                AND e.danger_level = #{pageEventManageDTO.dangerLevel}
            </if>
            <if test="pageEventManageDTO.redCard!=null">
                AND e.red_card = #{pageEventManageDTO.redCard}
            </if>
            <if test="pageEventManageDTO.yellowCard!=null">
                AND e.yellow_card = #{pageEventManageDTO.yellowCard}
            </if>
            <if test="pageEventManageDTO.urgent!=null">
                AND e.urgent = #{pageEventManageDTO.urgent}
            </if>
            <if test="pageEventManageDTO.major!=null">
                AND e.major = #{pageEventManageDTO.major}
            </if>
            <if test="pageEventManageDTO.invalid!=null">
                AND e.invalid = #{pageEventManageDTO.invalid}
            </if>
        </where>
        <if test="pageEventManageDTO.sortColumns!=null">
            ORDER BY e.${pageEventManageDTO.sortColumns} ${pageEventManageDTO.sortType}
        </if>
    </select>
 
    <select id="findCommunityPublicityByPage" resultType="com.panzhihua.common.model.vos.grid.EventVO"
            parameterType="com.panzhihua.common.model.dtos.grid.PagePublicityEventCommunityDTO">
        SELECT
            e.id,e.order_sn,e.event_category,e.grid_member_street,e.happen_address,e.grid_member_community,e.event_clazz,e.grid_id,e.grid_member_id,e.grid_member_name,e.grid_member_telephone,
            e.event_title,e.propaganda_type,e.propaganda_time,e.event_type,e.event_des,e.propaganda_object,e.propaganda_num,e.community_process,e.happen_time,e.happent_address,e.happent_lat_lng,
            e.event_status,e.event_process_status,e.process_type,e.process_user_id,e.process_user_name,e.process_date,e.process_desc,e.event_resource,e.danger_level,e.red_card,e.yellow_card,e.invalid,
            e.major,e.deaths_number,e.injuries_number,e.difficult,e.urgent,e.urgent_dell,e.submit_date,e.create_by,e.create_at,e.update_by,e.update_at,e.event_deal_status
        FROM
            event e left join event_grid_data egd on e.grid_id = egd.id
        <where>
            e.event_status != 3 AND e.event_category = 2
            <if test='pagePublicityEventCommunityDTO.keyWord != null and pagePublicityEventCommunityDTO.keyWord != &quot;&quot;'>
                AND (
                e.grid_member_name like concat('%', #{pagePublicityEventCommunityDTO.keyWord},'%') OR
                e.event_title like concat('%', #{pagePublicityEventCommunityDTO.keyWord},'%') OR
                e.happen_address like concat('%', #{pagePublicityEventCommunityDTO.keyWord},'%')
                e.order_sn like concat('%', #{pagePublicityEventCommunityDTO.keyWord},'%')
                )
            </if>
            <if test="pagePublicityEventCommunityDTO.communityId!=null">
                AND egd.grid_community_id = #{pageEventManageDTO.communityId}
            </if>
            <if test="pagePublicityEventCommunityDTO.eventDealStatus!=null">
                AND e.event_deal_status = #{pagePublicityEventCommunityDTO.eventDealStatus}
            </if>
        </where>
        <if test="pagePublicityEventCommunityDTO.sortColumns!=null">
            ORDER BY e.${pagePublicityEventCommunityDTO.sortColumns} ${pagePublicityEventCommunityDTO.sortType}
        </if>
    </select>
    <select id="eventStatistics" resultType="com.panzhihua.common.model.vos.grid.EventStatisticsAllAdminVO">
        SELECT
            count( e.id ) AS eventTotal,(
            SELECT
                count( e.id )
            FROM
                `event` AS e
                LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id
            WHERE
                egd.grid_community_id = #{communityId}
                AND e.event_status = 2
                AND e.event_process_status = 2
            ) AS handleEventTotal,
            (
            SELECT
                count( e.id )
            FROM
                `event` AS e
                LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id
            WHERE
                egd.grid_community_id = #{communityId}
                AND e.event_category = 2
                AND e.event_status = 2
            ) AS propagandaEducationTotal,
            ( SELECT count( id ) FROM com_act_easy_photo WHERE handle_status = 2 AND community_id = #{communityId} ) AS easyPhotoTotal
        FROM
            `event` AS e
            LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id
        WHERE
            egd.grid_community_id = #{communityId}
            AND e.event_status = 2
    </select>
 
    <select id="getEventCountByGridIds" resultType="Integer">
        select count(id) from event where grid_id in
        <foreach item="item" collection="ids" separator="," open="(" close=")" index="">
        #{item}
        </foreach>
    </select>
 
</mapper>