mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
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
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
<?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_community.dao.ComEventMapper">
     <resultMap id="baseResult" type="com.panzhihua.service_community.entity.ComEvent">
            <id property="id" column="id" />
            <result property="orderSn" column="order_sn" />
            <result property="requestUserId" column="request_user_id" />
            <result property="userEventStatus" column="user_event_status" />
            <result property="requestUserEventDes" column="request_user_event_des" />
            <result property="requestUserName" column="request_user_name" />
            <result property="requestUserTel" column="request_user_tel" />
            <result property="eventCategory" column="event_category" />
            <result property="type" column="type" />
            <result property="submitDate" column="submit_date" />
            <result property="appointmentTime" column="appointment_time" />
            <result property="requestUserCommunity" column="request_user_community" />
            <result property="centerId" column="center_id" />
            <result property="centerTel" column="center_tel" />
            <result property="specialistOrg" column="specialist_org" />
            <result property="specialistLevel" column="specialist_level" />
            <result property="specialistId" column="specialist_id" />
            <result property="specialistName" column="specialist_name" />
            <result property="specialistTel" column="specialist_tel" />
            <result property="specialistAcceptTime" column="specialist_accept_time" />
            <result property="revokeType" column="revoke_type" />
            <result property="eventProcessStatus" column="event_process_status" />
            <result property="currentProcessType" column="current_process_type" />
            <result property="currentOrgId" column="current_org_id" />
            <result property="currentOrgName" column="current_org_name" />
            <result property="currentProcessUserId" column="current_process_user_id" />
            <result property="currentProcessUserName" column="current_process_user_name" />
            <result property="revokeDes" column="revoke_des" />
            <result property="eventResult" column="event_result" />
            <result property="eventSucceed" column="event_succeed" />
            <result property="currentEventProcessResult" column="current_event_process_result" />
            <result property="reportSuperior" column="report_superior" />
            <result property="result" column="result" />
            <result property="resultDate" column="result_date" />
            <result property="urgent" column="urgent" />
            <result property="difficult" column="difficult" />
            <result property="urgentDell" column="urgent_dell" />
            <result property="invalid" column="invalid" />
            <result property="major" column="major" />
            <result property="requestUserResponse" column="request_user_response" />
            <result property="createBy" column="create_by" />
            <result property="createAt" column="create_at" />
            <result property="updateBy" column="update_by" />
            <result property="updateAt" column="update_at" />
 
    </resultMap>
    <sql id="columns">
        id,order_sn,request_user_id,user_event_status,request_user_event_des,event_succeed,current_event_process_result,request_user_name,request_user_tel,event_category,type,submit_date,appointment_time,request_user_community,center_id,center_tel,specialist_org,specialist_level,specialist_id,specialist_name,specialist_tel,specialist_accept_time,revoke_type,event_process_status,current_process_type,current_org_id,current_org_name,current_process_user_id,current_process_user_name,revoke_des,event_result,report_superior,result,result_date,urgent,difficult,urgent_dell,invalid,major,request_user_response,create_by,create_at,update_by,update_at,report_level,report_community,report_street,report_center,report_hall,is_end
    </sql>
 
    <select id="pageByComEvent" resultType="com.panzhihua.service_community.entity.ComEvent">
        SELECT <include refid="columns" />
        FROM com_sanshuo_event_info
        <where>
            event_process_status !=9
            AND app_id=#{comEvent.appId}
            <if test="comEvent.communityId != null and  comEvent.userType != 9">
                AND request_user_community=#{comEvent.communityId}
            </if>
            <if test="comEvent.keyword != null and comEvent.keyword!=''" >
                AND    ( order_sn like concat ('%',#{comEvent.keyword},'%')  or request_user_tel like concat ('%',#{comEvent.keyword},'%') or current_org_name like concat ('%',#{comEvent.keyword},'%'))
            </if>
            <if test="comEvent.startTime != null and comEvent.startTime != ''">
                AND create_at between DATE_FORMAT(#{comEvent.startTime},'%Y-%m-%d 00:00:00') and DATE_FORMAT(#{comEvent.endTime},'%Y-%m-%d 00:00:00')
            </if>
            <if test="comEvent.createBy != null and comEvent.createBy!=''" >
                AND create_by = #{comEvent.createBy}
            </if>
            <if test="comEvent.eventCategory != null">
                AND event_category = #{comEvent.eventCategory}
            </if>
            <if test="comEvent.eventProcessStatus != null">
                AND event_process_status = #{comEvent.eventProcessStatus}
            </if>
            <if test="comEvent.orderSn != null">
                AND order_sn = #{comEvent.orderSn}
            </if>
            <if test="comEvent.requestUserTel != null">
                AND request_user_tel = #{comEvent.requestUserTel}
            </if>
            <if test="comEvent.currentOrgName != null">
                AND current_org_name = #{comEvent.currentOrgName}
            </if>
            <if test="comEvent.userType == 1">
                AND request_user_id=#{comEvent.requestUserId}
            </if>
            <if test="comEvent.userType == 2">
                AND specialist_id=#{comEvent.specialistId}
            </if>
            <if test="comEvent.userType == 3">
                AND center_id=#{comEvent.centerId}
            </if>
            <if test="comEvent.userType == 4">
                AND request_user_community=#{comEvent.communityId}
            </if>
            <if test="comEvent.userType == 5">
                AND request_user_community in
                <foreach collection="comEvent.communityIds" item="id" separator="," open="(" close=")">
                    #{id}
                </foreach>
            </if>
            <if test="comEvent.level != null and comEvent.level != ''">
                <if test="comEvent.level == 1">
                    AND type=4 OR current_process_type=4
                </if>
                <if test="comEvent.searchId != null and comEvent.searchId != ''">
                    <if test="comEvent.level == 2">
                        AND center_id=#{comEvent.searchId} AND current_process_type in(1,5)
                    </if>
                    <if test="comEvent.level == 3">
                        AND request_user_community in (select community_id from com_act where street_id=#{comEvent.searchId})
                        AND current_process_type in (3,5)
                    </if>
                    <if test="comEvent.level == 4">
                        AND request_user_community=#{comEvent.searchId} AND current_process_type in (2,5)
                    </if>
                </if>
            </if>
        </where>
        order by create_at desc
    </select>
    <select id="pageByComEventExpert" resultType="com.panzhihua.service_community.entity.ComEvent">
        SELECT <include refid="columns" />
        FROM com_sanshuo_event_info
        <where>
            event_process_status !=9
            AND app_id=#{comEvent.appId}
            <if test="eventIds != null">
                AND id in 
                <foreach collection="eventIds" item="id" separator="," open="(" close=")">
                    #{id}
                </foreach>
            </if>
            <if test="eventIds == null and  comEvent.userType != 9">
                AND request_user_community=#{comEvent.communityId}
            </if>
            <if test="comEvent.keyword != null and comEvent.keyword!=''" >
                AND    ( order_sn = #{comEvent.keyword} or request_user_tel =#{comEvent.keyword} or current_org_name=#{comEvent.keyword})
            </if>
            <if test="comEvent.createBy != null and comEvent.createBy!=''" >
                AND create_by = #{comEvent.createBy}
            </if>
            <if test="comEvent.eventCategory != null">
                AND event_category = #{comEvent.eventCategory}
            </if>
            <if test="comEvent.eventProcessStatus != null">
                AND event_process_status = #{comEvent.eventProcessStatus}
            </if>
            <if test="comEvent.orderSn != null">
                AND order_sn = #{comEvent.orderSn}
            </if>
            <if test="comEvent.requestUserTel != null">
                AND request_user_tel = #{comEvent.requestUserTel}
            </if>
            <if test="comEvent.currentOrgName != null">
                AND current_org_name = #{comEvent.currentOrgName}
            </if>
            <!--<if test="comEvent.userType == 1">-->
                <!--AND request_user_id=#{comEvent.requestUserId}-->
            <!--</if>-->
            <!--<if test="comEvent.userType == 2">-->
                <!--AND specialist_id=#{comEvent.specialistId}-->
            <!--</if>-->
            <!--<if test="comEvent.userType == 3">-->
                <!--AND center_id=#{comEvent.centerId}-->
            <!--</if>-->
            <!--<if test="comEvent.userType == 4">-->
                <!--AND request_user_community=#{comEvent.communityId}-->
            <!--</if>-->
        </where>
        order by create_at desc
    </select>
    <select id="listEventIds" resultType="java.lang.Long">
        select event_id from com_sanshuo_expert_event where expert_id=#{expertId} and (status=0 or status=1)
    </select>
    <select id="listByComEvent" resultType="com.panzhihua.service_community.entity.ComEvent">
        SELECT <include refid="columns" />
        FROM com_sanshuo_event_info
        <if test="requestUserId != null and requestUserId != ''">
            where request_user_id=#{requestUserId}
        </if>
    </select>
 
    <select id="calculate" resultType="com.panzhihua.common.model.vos.sanshuo.ComEventCalculateVO">
        select event_process_status as status ,count(1) as  sum
        from com_sanshuo_event_info
        <where>
            event_process_status not in (9)
            AND app_id=#{comEvent.appId}
            <if test="comEvent.userType == 1">
                AND request_user_id=#{comEvent.requestUserId}
            </if>
            <if test="comEvent.userType == 2">
                <if test="comEvent.eventIds != null">
                    AND id in
                    <foreach collection="comEvent.eventIds" item="id" separator="," open="(" close=")">
                        #{id}
                    </foreach>
                </if>
                <if test="comEvent.eventIds == null">
                    AND request_user_community=#{comEvent.communityId}
                </if>
 
            </if>
            <if test="comEvent.userType == 3">
                AND center_id=#{comEvent.centerId}
            </if>
            <if test="comEvent.userType == 4">
                AND request_user_community=#{comEvent.communityId}
            </if>
            <if test="comEvent.userType == 5">
                AND request_user_community in
                <foreach collection="comEvent.communityIds" item="id" separator="," open="(" close=")">
                    #{id}
                </foreach>
            </if>
                <if test="comEvent.level != null and comEvent.level != ''">
                    <if test="comEvent.level == 1">
                        AND current_process_type=4
                    </if>
                    <if test="comEvent.searchId != null and comEvent.searchId != ''">
                        <if test="comEvent.level == 2">
                            AND center_id=#{comEvent.searchId} AND current_process_type in(1,5)
                        </if>
                        <if test="comEvent.level == 3">
                            AND request_user_community in (select community_id from com_act where street_id=#{comEvent.searchId})
                            AND current_process_type in (3,5)
                        </if>
                        <if test="comEvent.level == 4">
                            AND request_user_community=#{comEvent.searchId} AND current_process_type in (2,5)
                        </if>
                    </if>
                </if>
        </where>
        group by event_process_status
    </select>
 
 
    <select id="caculateSum" resultType="int">
        select count(id) as  sum
        from com_sanshuo_event_info
        <where>
            event_process_status not in (9)
            AND app_id=#{comEvent.appId}
            <if test="comEvent.userType == 1">
                AND request_user_id=#{comEvent.requestUserId}
            </if>
            <if test="comEvent.userType == 2">
                <if test="comEvent.eventIds != null">
                    AND id in
                    <foreach collection="comEvent.eventIds" item="id" separator="," open="(" close=")">
                        #{id}
                    </foreach>
                </if>
                <if test="comEvent.eventIds == null">
                    AND request_user_community=#{comEvent.communityId}
                </if>
            </if>
            <if test="comEvent.userType == 3">
                AND center_id=#{comEvent.centerId}
            </if>
            <if test="comEvent.userType == 4">
                AND request_user_community=#{comEvent.communityId}
            </if>
            <if test="comEvent.userType == 5">
                AND request_user_community in
                <foreach collection="comEvent.communityIds" item="id" separator="," open="(" close=")">
                    #{id}
                </foreach>
            </if>
            <if test="comEvent.level != null and comEvent.level != ''">
                <if test="comEvent.level == 1">
                    AND current_process_type=4
                </if>
                <if test="comEvent.searchId != null and comEvent.searchId != ''">
                    <if test="comEvent.level == 2">
                        AND center_id=#{comEvent.searchId} AND current_process_type in(1,5)
                    </if>
                    <if test="comEvent.level == 3">
                        AND request_user_community in (select community_id from com_act where street_id=#{comEvent.searchId})
                        AND current_process_type in (3,5)
                    </if>
                    <if test="comEvent.level == 4">
                        AND request_user_community=#{comEvent.searchId} AND current_process_type in (2,5)
                    </if>
                </if>
            </if>
        </where>
    </select>
    <select id="dateAnalysis" resultType="com.panzhihua.common.model.vos.sanshuo.IndexDateVO">
        SELECT
        (SELECT count(id) FROM com_sanshuo_event_info
        where event_process_status in (2,3,5,6)
        AND user_event_status not in(3,4)
        AND app_id='wx0cef797390444b75'
        <if test="dto.type == 2">
            AND current_process_type in (1,5)
            AND center_id is not  null
            <if test="dto.id != null">
                AND center_id=#{dto.id}
            </if>
        </if>
        <if test="dto.type == 3">
            AND current_process_type=3
            <if test="dto.id != null">
                AND request_user_community in (select com_act.community_id from com_act where street_id=#{dto.id})
            </if>
        </if>
        <if test="dto.type == 4">
            AND current_process_type in(2,5)
            AND center_id is null
            <if test="dto.id != null">
                AND request_user_community=#{dto.id}
            </if>
        </if>
        <if test="dto.type == 1">
            AND current_process_type=4
        </if>
        ) as accept,
        (SELECT count(id) FROM com_sanshuo_event_info
        where is_end &lt;> 1
        AND user_event_status not in(3,4)
        AND event_process_status not in (1,9)
        AND app_id='wx0cef797390444b75'
        <if test="dto.type == 2">
            AND current_process_type in (1,5)
            AND center_id is not  null
            <if test="dto.id != null">
                AND center_id=#{dto.id}
            </if>
        </if>
        <if test="dto.type == 3">
            AND current_process_type=3
            <if test="dto.id != null">
                AND request_user_community in (select com_act.community_id from com_act where street_id=#{dto.id})
            </if>
        </if>
        <if test="dto.type == 4">
            AND current_process_type in(2,5)
            AND center_id is null
            <if test="dto.id != null">
                AND request_user_community=#{dto.id}
            </if>
        </if>
        <if test="dto.type == 1">
            AND current_process_type=4
        </if>) as accepting,
        (SELECT count(id) FROM com_sanshuo_event_info
        where event_process_status = 6
        AND is_end=1
        AND user_event_status not in(3)
        AND app_id='wx0cef797390444b75'
        <if test="dto.type == 2">
            AND current_process_type in (1,5)
            AND center_id is not null
            <if test="dto.id != null">
                AND center_id=#{dto.id}
            </if>
        </if>
        <if test="dto.type == 3">
            AND current_process_type=3
            <if test="dto.id != null">
                AND request_user_community in (select com_act.community_id from com_act where street_id=#{dto.id})
            </if>
        </if>
        <if test="dto.type == 4">
            AND current_process_type in(2,5)
            AND center_id is null
            <if test="dto.id != null">
                AND request_user_community=#{dto.id}
            </if>
        </if>
        <if test="dto.type == 1">
            AND current_process_type=4
        </if>) as accepted,
        (SELECT count(t.id) FROM com_sanshuo_event_info as  t
        left join com_sanshuo_event_transfer_record as  t1
        on t.id=t1.event_id
        where t.event_process_status in (6,7)
        AND t.user_event_status not in(3,4)
        AND t1.event_status=7
        AND app_id='wx0cef797390444b75'
        <if test="dto.type == 2">
            AND t.current_process_type in (1,5)
            AND t.center_id is not  null
            <if test="dto.id != null">
                AND t.center_id=#{dto.id}
            </if>
        </if>
        <if test="dto.type == 3">
            AND t.current_process_type=3
            <if test="dto.id != null">
                AND t.request_user_community in (select com_act.community_id from com_act where street_id=#{dto.id})
            </if>
        </if>
        <if test="dto.type == 4">
            AND t.current_process_type in(2,5)
            AND t.center_id is null
            <if test="dto.id != null">
                AND t.request_user_community=#{dto.id}
            </if>
        </if>
        <if test="dto.type == 1">
            AND t.current_process_type=4
        </if>) as expirences,
        (select count(id) FROM com_sanshuo_event_info
        where event_result=2
        AND user_event_status not in(3,4)
        AND app_id='wx0cef797390444b75'
        <if test="dto.type == 2">
            AND current_process_type in (1,5)
            AND center_id is not  null
            <if test="dto.id != null">
                AND center_id=#{dto.id}
            </if>
        </if>
        <if test="dto.type == 3">
            AND current_process_type=3
            <if test="dto.id != null">
                AND request_user_community in (select com_act.community_id from com_act where street_id=#{dto.id})
            </if>
        </if>
        <if test="dto.type == 4">
            AND current_process_type in(2,5)
            AND center_id is null
            <if test="dto.id != null">
                AND request_user_community=#{dto.id}
            </if>
        </if>
        <if test="dto.type == 1">
            AND current_process_type=4
        </if>) as success,
        (select count(id) FROM com_sanshuo_event_info
        where event_result=1
        AND is_end=1
        AND user_event_status not in(3,4)
        AND app_id='wx0cef797390444b75'
        <if test="dto.type == 2">
            AND current_process_type in (1,5)
            AND center_id is not  null
            <if test="dto.id != null">
                AND center_id=#{dto.id}
            </if>
        </if>
        <if test="dto.type == 3">
            AND current_process_type=3
            <if test="dto.id != null">
                AND request_user_community in (select com_act.community_id from com_act where street_id=#{dto.id})
            </if>
        </if>
        <if test="dto.type == 4">
            AND current_process_type in(2,5)
            AND center_id is null
            <if test="dto.id != null">
                AND request_user_community=#{dto.id}
            </if>
        </if>
        <if test="dto.type == 1">
            AND current_process_type=4
        </if>) as fail,
        (select count(id) from com_sanshuo_event_info WHERE
        create_at BETWEEN DATE_FORMAT(#{beginDate}, '%Y-%m-%d 00:00:00') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d 23:59:59')
        AND event_process_status not in (8)
        AND app_id='wx0cef797390444b75'
        <if test="dto.type == 2">
            AND current_process_type in (1,5)
            AND center_id is not  null
            <if test="dto.id != null">
                AND center_id=#{dto.id}
            </if>
        </if>
        <if test="dto.type == 3">
            AND current_process_type=3
            <if test="dto.id != null">
                AND request_user_community in (select com_act.community_id from com_act where street_id=#{dto.id})
            </if>
        </if>
        <if test="dto.type == 4">
            AND current_process_type in(2,5)
            AND center_id is null
            <if test="dto.id != null">
                AND request_user_community=#{dto.id}
            </if>
        </if>
        <if test="dto.type == 1">
            AND current_process_type=4
        </if>) as monthIncrease,
        (select count(id) from com_sanshuo_event_info WHERE
        create_at BETWEEN DATE_FORMAT(#{beginDate}, '%Y-%m-%d 00:00:00') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d 23:59:59')
        AND event_process_status not in (8)
        AND event_process_status = 6
        AND app_id='wx0cef797390444b75'
        <if test="dto.type == 2">
            AND current_process_type in (1,5)
            AND center_id is not  null
            <if test="dto.id != null">
                AND center_id=#{dto.id}
            </if>
        </if>
        <if test="dto.type == 3">
            AND current_process_type=3
            <if test="dto.id != null">
                AND request_user_community in (select com_act.community_id from com_act where street_id=#{dto.id})
            </if>
        </if>
        <if test="dto.type == 4">
            AND current_process_type in(2,5)
            AND center_id is null
            <if test="dto.id != null">
                AND request_user_community=#{dto.id}
            </if>
        </if>
        <if test="dto.type == 1">
            AND current_process_type=4
        </if>) as monthFinish
        FROM com_sanshuo_event_info limit 1
    </select>
    <select id="dateAnalysisY" resultType="java.lang.Integer">
        SELECT COUNT(id) FROM com_sanshuo_event_info
        WHERE create_at BETWEEN DATE_FORMAT(#{beginDate}, '%Y-%m-%d 00:00:00') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d 23:59:59')
        AND event_process_status not in (9)
        AND app_id='wx0cef797390444b75'
        <if test="dto.type == 2">
            AND current_process_type in (1,5)
            AND center_id is not null
            <if test="dto.id != null">
                AND center_id=#{dto.id}
            </if>
        </if>
        <if test="dto.type == 3">
            AND current_process_type=3
            <if test="dto.id != null">
                AND request_user_community in (select com_act.community_id from com_act where street_id=#{dto.id})
            </if>
        </if>
        <if test="dto.type == 4">
            AND current_process_type in(2,5)
            AND center_id is null
            <if test="dto.id != null">
                AND request_user_community=#{dto.id}
            </if>
        </if>
        <if test="dto.type == 1">
            AND current_process_type=4
        </if>
    </select>
    <select id="dateAnalysisYTwo" resultType="java.lang.Integer">
        SELECT COUNT(id) FROM com_sanshuo_event_info
        WHERE create_at BETWEEN DATE_FORMAT(#{beginDate}, '%Y-%m-%d 00:00:00') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d 23:59:59')
        AND event_process_status=6
        AND is_end=1
        AND app_id='wx0cef797390444b75'
        <if test="dto.type == 2">
            AND current_process_type in (1,5)
            AND center_id is not null
            <if test="dto.id != null">
                AND center_id=#{dto.id}
            </if>
        </if>
        <if test="dto.type == 3">
            AND current_process_type=3
            <if test="dto.id != null">
                AND request_user_community in (select com_act.community_id from com_act where street_id=#{dto.id})
            </if>
        </if>
        <if test="dto.type == 4">
            AND current_process_type in(2,5)
            AND center_id is null
            <if test="dto.id != null">
                AND request_user_community=#{dto.id}
            </if>
        </if>
        <if test="dto.type == 1">
            AND current_process_type=4
        </if>
    </select>
    <select id="eventRate" resultType="com.panzhihua.common.model.vos.sanshuo.EventRateVO">
        select count(id) as count,type from com_sanshuo_event_info
        where event_process_status not in(7,8,9)
        AND app_id='wx0cef797390444b75'
        group by type
        having type not in (5)
    </select>
 
    <select id="expertRate" resultType="com.panzhihua.common.model.vos.sanshuo.EventRateVO">
        select count(id) as count,level as type  from com_sanshuo_expert where app_id='wx0cef797390444b75'
        group by level
    </select>
    <select id="mediateTypeRate" resultType="com.panzhihua.common.model.vos.sanshuo.EventRateVO">
        select count(t.id) as count,t1.name from com_sanshuo_event_info t
        left join com_mediate_type t1 on t.event_category=t1.id
        where t.event_process_status not in(7,8,9)
        AND t.app_id='wx0cef797390444b75'
        group by t.event_category
    </select>
 
    <select id="getUserAvatar" resultType="String">
        select  image_url from sys_user where user_id = #{userId}
    </select>
    <select id="insertEventAndExpertRecord">
        insert into com_sanshuo_expert_event values(#{eventId},#{expertId},#{status})
    </select>
    <select id="expertSolveCountCommunity" resultType="java.lang.Integer">
        select count(t.id) from com_sanshuo_event_info t
        left join com_sanshuo_expert t1 on t.specialist_id=t1.id
        where t.event_process_status not in (9)
        AND t.current_process_type=5
        and t1.level=4
        AND t.app_id='wx0cef797390444b75'
    </select>
    <select id="expertSolveCountCenter" resultType="java.lang.Integer">
        select count(t.id) from com_sanshuo_event_info t
        left join com_sanshuo_expert t1 on t.specialist_id=t1.id
        where t.event_process_status not in (9)
        and t1.level=2
        AND t.current_process_type=5
        AND t.app_id='wx0cef797390444b75'
    </select>
    <update id="updateLog">
        update com_sanshuo_expert_event set status = 2
        where event_id=#{eventId} and expert_id=#{expertId} and status=0
    </update>
 
</mapper>