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
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
<?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.ComActNeighborCircleDAO">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActNeighborCircleDO">
        <id column="id" property="id"/>
        <result column="release_id" property="releaseId"/>
        <result column="release_phone" property="releasePhone"/>
        <result column="community_id" property="communityId"/>
        <result column="release_content" property="releaseContent"/>
        <result column="release_images" property="releaseImages"/>
        <result column="status" property="status"/>
        <result column="refuse_reason" property="refuseReason"/>
        <result column="comment_num" property="commentNum"/>
        <result column="fabulous_num" property="fabulousNum"/>
        <result column="forward_num" property="forwardNum"/>
        <result column="views_num" property="viewsNum"/>
        <result column="is_boutique" property="isBoutique"/>
        <result column="create_at" property="createAt"/>
        <result column="reply_at" property="replyAt"/>
        <result column="last_comment_num" property="lastCommentNum"/>
        <result column="last_fabulous_num" property="lastFabulousNum"/>
        <result column="last_views_num" property="lastViewsNum"/>
        <result column="type" property="type"/>
        <result column="topic_id" property="topicId"/>
        <result column="hot_num" property="hotNum"/>
        <result column="is_del" property="isDel"/>
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, release_id, release_phone, community_id, release_content, release_images, status, refuse_reason, comment_num, fabulous_num, forward_num, views_num, is_boutique, create_at, reply_at, last_comment_num, last_fabulous_num, last_views_num, type, topic_id, hot_num, is_del
    </sql>
 
    <select id="pageNeighborByApp" parameterType="com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleAppDTO"
            resultType="com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAppVO">
        SELECT
        canc.*,
        su.nick_name as name,
        su.community_id,
        ca.`name` as communityName,
        canct.name as topicName,
        su.image_url as headUrl
        FROM
        com_act_neighbor_circle AS canc
        left join sys_user as su on su.user_id = canc.release_id
        left join com_act_neighbor_circle_topic as canct on canct.id = canc.topic_id
        left join com_act as ca on ca.community_id = canc.community_id
        where is_del = 2 and canc.status = 2
        and canc.community_id in
        <foreach collection="neighborCircleAppDTO.communityIds" item="item" index="index" open="(" separator="," close=")">
            ${item}
        </foreach>
        <if test='neighborCircleAppDTO.topicId != null '>
            and canc.topic_id = #{neighborCircleAppDTO.topicId}
        </if>
        <if test='neighborCircleAppDTO.belongType != null '>
            and canc.belong_type = #{neighborCircleAppDTO.belongType}
        </if>
        <if test='neighborCircleAppDTO.keyWord != null and neighborCircleAppDTO.keyWord != &quot;&quot;'>
            and (canct.`name` like concat ('%',#{neighborCircleAppDTO.keyWord},'%') or
            su.nick_name like concat ('%',#{neighborCircleAppDTO.keyWord},'%') or
             canc.release_content like concat ('%',#{neighborCircleAppDTO.keyWord},'%'))
        </if>
        <if test="neighborCircleAppDTO.isHelp ==1">
            and (canc.help_member_content like concat ('%',#{neighborCircleAppDTO.phone},'%') or canc.help_org_content like concat ('%',#{neighborCircleAppDTO.phone},'%') )
        </if>
        <if test="neighborCircleAppDTO.solveStatus !=null">
            <if test="neighborCircleAppDTO.solveStatus ==1">
                and canc.solve_status in (0,1)
            </if>
            <if test="neighborCircleAppDTO.solveStatus ==2">
                and canc.solve_status =2
            </if>
            <if test="neighborCircleAppDTO.solveStatus ==3">
                and canc.solve_status in(3,4)
            </if>
        </if>
        order by canc.create_at desc
    </select>
 
    <update id="addHotNum">
        update com_act_neighbor_circle set hot_num = hot_num + #{hotNum} where id = #{circleId}
    </update>
 
    <update id="addTopicHotNum">
        update com_act_neighbor_circle_topic set hot_num = hot_num + 1 where id = (select topic_id from com_act_neighbor_circle where id = #{circleId})
    </update>
 
    <select id="pageNeighborByAdmin" parameterType="com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleAdminDTO"
            resultType="com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAdminVO">
        SELECT
        nc.*,
        u.`nick_name` AS releaseName,u.image_url,canct.`name` as topicName ,u.`type` as userType
        ,u.name as communityName,nc.solve_status
        FROM
        com_act_neighbor_circle nc
        LEFT JOIN sys_user u ON nc.release_id = u.user_id
        LEFT JOIN com_act_neighbor_circle_topic as canct ON canct.id = nc.topic_id
        <where>
            nc.community_id in
            <foreach collection="neighborCircleAdminDTO.communityIds" item="item" index="index" open="(" separator="," close=")">
                ${item}
            </foreach>
                and is_del = 2
            <if test='neighborCircleAdminDTO.releaseContent != null and neighborCircleAdminDTO.releaseContent != &quot;&quot;'>
                and nc.release_content like concat('%',#{neighborCircleAdminDTO.releaseContent},'%')
            </if>
            <if test='neighborCircleAdminDTO.topicId != null '>
                and canc.topic_id = #{neighborCircleAdminDTO.topicId}
            </if>
            <if test='neighborCircleAdminDTO.topicName != null and neighborCircleAdminDTO.topicName != &quot;&quot;'>
                and canct.`name` = #{neighborCircleAdminDTO.topicName}
            </if>
            <if test='neighborCircleAdminDTO.keyWord != null and neighborCircleAdminDTO.keyWord != &quot;&quot;'>
                and (canct.`name` like concat(#{neighborCircleAdminDTO.keyWord},'%') or
                u.`nick_name` like concat(#{neighborCircleAdminDTO.keyWord},'%') or
                nc.`release_content` like concat(#{neighborCircleAdminDTO.keyWord},'%') )
            </if>
            <if test='neighborCircleAdminDTO.startAt != null and neighborCircleAdminDTO.endAt !=null '>
                and nc.create_at between #{neighborCircleAdminDTO.startAt} and #{neighborCircleAdminDTO.endAt}
            </if>
            <if test='neighborCircleAdminDTO.status != null '>
                and nc.status = #{neighborCircleAdminDTO.status}
            </if>
            <if test='neighborCircleAdminDTO.belongType != null '>
                and nc.belong_type = #{neighborCircleAdminDTO.belongType}
            </if>
            <if test="neighborCircleAdminDTO.solveStatus !=null">
                <if test="neighborCircleAdminDTO.solveStatus ==1">
                    and nc.solve_status in (0,1)
                </if>
                <if test="neighborCircleAdminDTO.solveStatus ==2">
                    and nc.solve_status =2
                </if>
                <if test="neighborCircleAdminDTO.solveStatus ==3">
                    and nc.solve_status in(3,4)
                </if>
            </if>
        </where>
        order by
        case when nc.`status`=1 then 0 else 1 end,
        nc.`status` asc,nc.create_at desc
    </select>
    <select id="getAllImages" resultType="java.lang.String">
        SELECT release_images FROM com_act_neighbor_circle
        WHERE community_id = ${communityId} AND `status` = 2 and belong_type = 1 AND release_images IS NOT NULL AND release_images != ''
        ORDER BY create_at DESC limit #{pageSize}
    </select>
    <select id="getContents" resultType="java.lang.String">
        SELECT release_content FROM com_act_neighbor_circle
        WHERE community_id = ${communityId} AND `status` = 2 and belong_type = 1 AND release_content IS NOT NULL AND release_content != ''
        ORDER BY create_at DESC limit #{pageSize}
    </select>
    <select id="getIndexNeighborBaseData"
            resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
        SELECT filed, num, ROUND(num/total,2) AS percent FROM
        (SELECT IF(t2.`name` IS NULL,'无话题',t2.`name`) AS filed, COUNT(1) AS num FROM com_act_neighbor_circle t1
        LEFT JOIN com_act_neighbor_circle_topic t2 ON t1.topic_id = t2.id
        WHERE t1.community_id = ${communityId} AND t1.`status` IN (2,3) AND t1.is_del = 2 AND (t2.`status` = 1 OR t2.id IS NULL) GROUP BY filed) temp1,
        (SELECT COUNT(t1.id) AS total FROM com_act_neighbor_circle t1
        LEFT JOIN com_act_neighbor_circle_topic t2 ON t1.topic_id = t2.id
        WHERE t1.community_id = ${communityId} AND t1.`status` IN (2,3) AND t1.is_del = 2 AND (t2.`status` = 1 OR t2.id IS NULL)) temp2
    </select>
    <select id="getNeighborAddPolylineData"
            resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
        SELECT filed, SUM(num) AS num FROM (
        SELECT DATE_FORMAT( t1.create_at, '%Y-%m' ) AS filed, COUNT(t1.id) AS num
        FROM com_act_neighbor_circle t1
        LEFT JOIN com_act_neighbor_circle_topic t2 ON t1.topic_id = t2.id
        WHERE t1.community_id = ${communityId} AND t1.`status` IN (2,3) AND t1.is_del = 2 AND (t2.`status` = 1 OR t2.id IS NULL)
        AND DATE_FORMAT( t1.create_at, '%Y-%m' ) &gt; DATE_FORMAT(date_sub(curdate(), interval 12 month),'%Y-%m') GROUP BY filed
        UNION ALL SELECT * FROM
            (
                SELECT DATE_FORMAT(curdate(),'%Y-%m') AS filed, 0 AS num union
                SELECT DATE_FORMAT(date_sub(curdate(), interval 1 month),'%Y-%m') AS filed, 0 AS num union
                SELECT DATE_FORMAT(date_sub(curdate(), interval 2 month),'%Y-%m') AS filed, 0 AS num union
                SELECT DATE_FORMAT(date_sub(curdate(), interval 3 month),'%Y-%m') AS filed, 0 AS num union
                SELECT DATE_FORMAT(date_sub(curdate(), interval 4 month),'%Y-%m') AS filed, 0 AS num union
                SELECT DATE_FORMAT(date_sub(curdate(), interval 5 month),'%Y-%m') AS filed, 0 AS num union
                SELECT DATE_FORMAT(date_sub(curdate(), interval 6 month),'%Y-%m') AS filed, 0 AS num union
                SELECT DATE_FORMAT(date_sub(curdate(), interval 7 month),'%Y-%m') AS filed, 0 AS num union
                SELECT DATE_FORMAT(date_sub(curdate(), interval 8 month),'%Y-%m') AS filed, 0 AS num union
                SELECT DATE_FORMAT(date_sub(curdate(), interval 9 month),'%Y-%m') AS filed, 0 AS num union
                SELECT DATE_FORMAT(date_sub(curdate(), interval 10 month),'%Y-%m') AS filed, 0 AS num union
                SELECT DATE_FORMAT(date_sub(curdate(), interval 11 month),'%Y-%m') AS filed, 0 AS num
            ) temT
        ) temp GROUP BY filed ORDER BY filed ASC
    </select>
    <select id="getNeighborTotalPolylineDate"
            resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
        SELECT COUNT(t1.id) AS num FROM com_act_neighbor_circle t1
        LEFT JOIN com_act_neighbor_circle_topic t2 ON t1.topic_id = t2.id
        WHERE t1.community_id = ${communityId} AND t1.`status` IN (2,3) AND t1.is_del = 2 AND (t2.`status` = 1 OR t2.id IS NULL) AND DATE_FORMAT( t1.create_at, '%Y-%m' ) &lt;= #{date}
    </select>
    <select id="indexNeighborList"
            resultType="com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAdminVO">
        SELECT t1.id, t1.release_content, t1.release_images, t1.comment_num, t1.fabulous_num, t2.`name` AS topicName
        FROM com_act_neighbor_circle t1
        LEFT JOIN com_act_neighbor_circle_topic t2 ON t1.topic_id = t2.id
        WHERE 1=1
        <if test="pageBaseDTO.communityIds != null and pageBaseDTO.communityIds.size > 0">
            AND t1.community_id IN
            <foreach collection="pageBaseDTO.communityIds" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test="pageBaseDTO.communityIds == null">
            AND t1.community_id = ${pageBaseDTO.communityId}
        </if>
        AND t1.`status` IN (2,3) AND t1.is_del = 2 AND (t2.`status` = 1 OR t2.id IS NULL)
        <if test="pageBaseDTO.paramId != null">
            AND t1.topic_id = #{pageBaseDTO.paramId}
        </if>
        ORDER BY t1.id DESC
    </select>
 
    <select id="selectSolve" resultType="com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAppVO">
        select canc.id,canc.release_content,canc.release_images,canc.status,canc.create_at,canct.name as topicName
        ,canc.comment_num,canc.fabulous_num,canc.forward_num,canc.views_num,canc.refuse_reason,su.nick_name as name,su.image_url as headUrl,canc.solve_status,canc.community_id
         from com_act_neighbor_circle as canc  left join sys_user as su on su.user_id = canc.release_id
         left join com_act_neighbor_circle_topic as canct on canct.id = canc.topic_id
        <where>
            <if test="neighborCircleAppDTO.solveId !=null">
                and canc.solve_id =#{neighborCircleAppDTO.solveId}
            </if>
            <if test="neighborCircleAppDTO.solveStatus !=null">
                and canc.solve_status =#{neighborCircleAppDTO.solveStatus}
            </if>
            <if test="neighborCircleAppDTO.belongType !=null">
                and canc.belong_type =#{neighborCircleAppDTO.belongType}
            </if>
            <if test="neighborCircleAppDTO.orderType !=null">
                and canc.order_type =#{neighborCircleAppDTO.orderType}
            </if>
        </where>  order by create_at desc
    </select>
 
 
<!--    SELECT-->
<!--    canc.*,-->
<!--    su.nick_name as name,-->
<!--    su.community_id,-->
<!--    ca.`name` as communityName,-->
<!--    canct.name as topicName,-->
<!--    su.image_url as headUrl-->
<!--    FROM-->
<!--    com_act_neighbor_circle AS canc-->
<!--    left join sys_user as su on su.user_id = canc.release_id-->
<!--    left join com_act_neighbor_circle_topic as canct on canct.id = canc.topic_id-->
<!--    left join com_act as ca on ca.community_id = canc.community_id-->
<!--    where canc.id =${circleId}-->
 
    <select id="neighborDetailByApp" resultType="com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleDetailAppVO">
 
        SELECT
            canc.*,
            su.nick_name as name,
            su.community_id as communityId,
            ca.`name` as communityName,
            canct.name as topicName,
            su.image_url as headUrl
        FROM
            com_act_neighbor_circle AS canc
        left join sys_user as su on su.user_id = canc.release_id
        left join com_act_neighbor_circle_topic as canct on canct.id = canc.topic_id
        left join com_act as ca on ca.community_id = canc.community_id
        where canc.id =${circleId}
 
 
    </select>
 
 
    <select id="selectStatsCheckUnit" resultType="com.panzhihua.common.model.vos.neighbor.ServiceStaticsVO">
         select count(t1.checkId) as times,COALESCE(sum(t1.hours),0) as hours from
         ((select real_service_time as hours,solve_unit_id  as checkId  from com_act_neighbor_circle  where order_type = 1 AND is_del = 2 and solve_status = 4 and solve_unit_id = #{checkUnitId} and order_time between concat(#{date},'-01-01 00:00:00') and concat(#{date},'-12-31 23:59:59'))
          union all
         (select duration as hours,check_unit_id as checkId from com_act_activity  where check_unit_id = #{checkUnitId} AND `status` = 5 and publish_at between concat(#{date},'-01-01 00:00:00') and concat(#{date},'-12-31 23:59:59'))
          union all
         (SELECT a.duration AS hours,s.check_unit_id AS checkId FROM com_act_activity a LEFT JOIN com_act_act_regist s ON a.id = s.activity_id
            WHERE s.end_time IS NOT NULL AND s.check_unit_id = #{checkUnitId} AND s.start_time BETWEEN concat( #{date}, '-01-01 00:00:00' ) AND concat( #{date}, '-12-31 23:59:59' ) GROUP BY a.id)
         ) t1
    </select>
    <select id="selectListByCheckUnitId" resultType="com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAppVO">
        SELECT
            canc.*,
            su.nick_name as name,
            su.community_id,
            ca.`name` as communityName,
            canct.name as topicName,
            su.image_url as headUrl
        FROM
            com_act_neighbor_circle AS canc
                left join sys_user as su on su.user_id = canc.release_id
                left join com_act_neighbor_circle_topic as canct on canct.id = canc.topic_id
                left join com_act as ca on ca.community_id = canc.community_id
        where is_del = 2 and canc.solve_status=4 and   canc.solve_unit_id = #{checkUnitId} and canc.create_at between concat(#{date},'-01-01 00:00:00') and concat(#{date},'-12-31 23:59:59')
    </select>
 
    <select id="selectServiceDetailList" resultType="com.panzhihua.common.model.vos.neighbor.ServiceDetailStaticsVO">
        <if test="serviceType == null">
            SELECT * FROM (
                SELECT
                id AS serviceId,
                order_time AS serviceAt,
                real_service_time AS serviceTime,
                1 AS serviceType
                FROM
                com_act_neighbor_circle
                WHERE
                order_type = 1
                AND is_del = 2
                AND solve_status = 4
                AND solve_unit_id = #{checkUnitId}
                AND order_time BETWEEN concat(#{date}, '-01-01 00:00:00')
                AND concat(#{date}, '-12-31 23:59:59')
                UNION ALL
                SELECT
                a.id AS serviceId,
                a.publish_at AS serviceAt,
                a.duration AS serviceTime,
                2 AS serviceType
                FROM
                com_act_activity a
                LEFT JOIN com_act_act_regist s ON a.id = s.activity_id
                WHERE
                s.end_time IS NOT NULL
                AND s.check_unit_id = #{checkUnitId}
                AND s.start_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
                AND concat( #{date}, '-12-31 23:59:59' )
                GROUP BY
                a.id
                UNION ALL
                SELECT
                id AS serviceId,
                publish_at AS serviceAt,
                duration AS serviceTime,
                3 AS serviceType
                FROM
                com_act_activity
                WHERE
                check_unit_id = #{checkUnitId}
                AND `status` = 5
                AND publish_at BETWEEN concat( #{date}, '-01-01 00:00:00' )
                AND concat( #{date}, '-12-31 23:59:59' )
            ) temp ORDER BY serviceAt
        </if>
        <if test="serviceType == 1">
            SELECT
            id AS serviceId,
            order_time AS serviceAt,
            real_service_time AS serviceTime,
            1 AS serviceType
            FROM
            com_act_neighbor_circle
            WHERE
            order_type = 1
            AND is_del = 2
            AND solve_status = 4
            AND solve_unit_id = #{checkUnitId}
            AND order_time BETWEEN concat(#{date}, '-01-01 00:00:00')
            AND concat(#{date}, '-12-31 23:59:59')
            ORDER BY serviceAt
        </if>
        <if test="serviceType == 2">
            SELECT
            a.id AS serviceId,
            a.publish_at AS serviceAt,
            a.duration AS serviceTime,
            2 AS serviceType
            FROM
            com_act_activity a
            LEFT JOIN com_act_act_regist s ON a.id = s.activity_id
            WHERE
            s.end_time IS NOT NULL
            AND s.check_unit_id = #{checkUnitId}
            AND s.start_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
            AND concat( #{date}, '-12-31 23:59:59' )
            GROUP BY a.id
            ORDER BY serviceAt
        </if>
        <if test="serviceType == 3">
            SELECT
            id AS serviceId,
            publish_at AS serviceAt,
            duration AS serviceTime,
            3 AS serviceType
            FROM
            com_act_activity
            WHERE
            check_unit_id = #{checkUnitId}
            AND `status` = 5
            AND publish_at BETWEEN concat( #{date}, '-01-01 00:00:00' )
            AND concat( #{date}, '-12-31 23:59:59' )
            ORDER BY serviceAt
        </if>
    </select>
 
    <select id="selectServiceDetailListForPersonal" resultType="com.panzhihua.common.model.vos.neighbor.ServiceDetailStaticsVO">
        <if test="serviceType == null">
            SELECT * FROM (
            SELECT
            canc.id AS serviceId,
            canc.order_time AS serviceAt,
            canc.real_service_time AS serviceTime,
            1 AS serviceType
            FROM
            com_act_neighbor_circle AS canc
            LEFT JOIN sys_user su1 ON su1.user_id = canc.solve_id
            WHERE
            canc.order_type = 2
            AND canc.is_del = 2
            AND canc.solve_status = 4
            AND su1.phone = #{phone}
            AND canc.order_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
            AND concat( #{date}, '-12-31 23:59:59' )
            <if test="checkUnitId != null and checkUnitId != '' ">
                UNION ALL
                SELECT
                a.id AS serviceId,
                a.publish_at AS serviceAt,
                ROUND((TIMESTAMPDIFF(SECOND, s.start_time, s.end_time) / 3600), 2) as serviceTime,
                2 AS serviceType
                FROM
                com_act_activity a
                LEFT JOIN com_act_act_regist s ON a.id = s.activity_id
                LEFT JOIN sys_user su ON su.user_id = s.user_id
                WHERE
                s.end_time IS NOT NULL
                AND s.check_unit_id = #{checkUnitId}
                AND su.phone = #{phone}
                AND s.start_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
                AND concat( #{date}, '-12-31 23:59:59' )
                and s.start_time IS NOT NULL
                and s.end_time IS NOT NULL
                GROUP BY
                a.id
            </if>
            UNION ALL
            SELECT
            a.id AS serviceId,
            a.publish_at AS serviceAt,
            ROUND((TIMESTAMPDIFF(SECOND, s.start_time, s.end_time) / 3600), 2)  AS serviceTime,
            3 AS serviceType
            FROM
            com_act_activity a
            LEFT JOIN com_act_act_regist s ON a.id = s.activity_id
            LEFT JOIN sys_user su ON su.user_id = s.user_id
            WHERE
            s.end_time IS NOT NULL
            AND a.check_unit_id IS NOT NULL
            AND su.phone = #{phone}
            AND s.start_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
            AND concat( #{date}, '-12-31 23:59:59' )
            GROUP BY
            a.id
            UNION ALL
            SELECT
            a.id AS serviceId,
            a.publish_at AS serviceAt,
            ROUND((TIMESTAMPDIFF(SECOND, s.start_time, s.end_time) / 3600), 2) AS serviceTime,
            4 AS serviceType
            FROM
            com_act_activity a
            LEFT JOIN com_act_act_regist s ON a.id = s.activity_id
            LEFT JOIN sys_user su ON su.user_id = s.user_id
            WHERE
            s.end_time IS NOT NULL
            AND s.check_unit_id IS NULL
            AND s.sign_identity = 2
            AND su.phone = #{phone}
            AND s.start_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
            AND concat( #{date}, '-12-31 23:59:59' )
            GROUP BY
            a.id
            ) temp ORDER BY serviceAt
        </if>
        <if test="serviceType == 1">
            SELECT
            canc.id AS serviceId,
            canc.order_time AS serviceAt,
            canc.real_service_time AS serviceTime,
            1 AS serviceType
            FROM
            com_act_neighbor_circle AS canc
            LEFT JOIN sys_user su1 ON su1.user_id = canc.solve_id
            WHERE
            canc.order_type = 2
            AND canc.is_del = 2
            AND canc.solve_status = 4
            AND su1.phone = #{phone}
            AND canc.order_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
            AND concat( #{date}, '-12-31 23:59:59' )
            ORDER BY serviceAt
        </if>
        <if test="serviceType == 2 and checkUnitId != null">
            SELECT
            a.id AS serviceId,
            a.publish_at AS serviceAt,
            ROUND((TIMESTAMPDIFF(SECOND, s.start_time, s.end_time) / 3600), 2) AS serviceTime,
            2 AS serviceType
            FROM
            com_act_activity a
            LEFT JOIN com_act_act_regist s ON a.id = s.activity_id
            LEFT JOIN sys_user su ON su.user_id = s.user_id
            WHERE
            s.end_time IS NOT NULL
            AND s.check_unit_id = #{checkUnitId}
            AND su.phone = #{phone}
            AND s.start_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
            AND concat( #{date}, '-12-31 23:59:59' )
            GROUP BY a.id
            ORDER BY serviceAt
        </if>
        <if test="serviceType == 3">
            SELECT
            a.id AS serviceId,
            a.publish_at AS serviceAt,
            ROUND((TIMESTAMPDIFF(SECOND, s.start_time, s.end_time) / 3600), 2) AS serviceTime,
            3 AS serviceType
            FROM
            com_act_activity a
            LEFT JOIN com_act_act_regist s ON a.id = s.activity_id
            LEFT JOIN sys_user su ON su.user_id = s.user_id
            WHERE
            s.end_time IS NOT NULL
            AND a.check_unit_id IS NOT NULL
            AND su.phone = #{phone}
            AND s.start_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
            AND concat( #{date}, '-12-31 23:59:59' )
            GROUP BY a.id
            ORDER BY serviceAt
        </if>
        <if test="serviceType == 4">
            SELECT
            a.id AS serviceId,
            a.publish_at AS serviceAt,
            ROUND((TIMESTAMPDIFF(SECOND, s.start_time, s.end_time) / 3600), 2) AS serviceTime,
            4 AS serviceType
            FROM
            com_act_activity a
            LEFT JOIN com_act_act_regist s ON a.id = s.activity_id
            LEFT JOIN sys_user su ON su.user_id = s.user_id
            WHERE
            s.end_time IS NOT NULL
            AND a.check_unit_id IS NULL
            AND s.sign_identity = 2
            AND su.phone = #{phone}
            AND s.start_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
            AND concat( #{date}, '-12-31 23:59:59' )
            GROUP BY a.id
            ORDER BY serviceAt
        </if>
    </select>
 
 
    <select id="getNewServiceNum" resultType="com.panzhihua.service_community.entity.NewFightNeedProblemClaim">
        SELECT
            id,
            user_id,
            update_time,
            unit_id,
            task_id,
            service_time,
            punch_start_time,
            punch_end_time,
            creation_time
        FROM new_fight_need_problem_claim
        <where>
            service_time is not null
            <if test=" phone != null and phone != '' ">
                and user_id =(SELECT user_id FROM sys_user WHERE phone=#{phone}
                and app_id="wx118de8a734d269f0" and type=1)
            </if>
            <if test=" unitId != null and unitId != '' ">
                and unit_id =#{unitId}
            </if>
        </where>
 
    </select>
 
 
 
    <select id="selectStatsUser" resultType="com.panzhihua.common.model.vos.neighbor.ServiceStaticsVO">
        select
               count(t1.checkId) as times,
               sum(t1.hours) as hours
        from  ((select real_service_time as hours,solve_id  as checkId from com_act_neighbor_circle canc
            left join sys_user su on canc.solve_id = su.user_id  where order_type = 2 AND canc.is_del = 2 and solve_status = 4
                and su.phone = #{phone} and canc.order_time between concat(#{date},'-01-01 00:00:00') and concat(#{date},'-12-31 23:59:59'))
            union all
                (select ROUND((TIMESTAMPDIFF(SECOND, caas.start_time, caas.end_time) / 3600), 2) as hours,caas.user_id as checkId
                from com_act_activity caa LEFT JOIN com_act_act_regist caas on caa.id = caas.activity_id
                left join sys_user su on caas.user_id = su.user_id
                where caas.sign_identity = 2
                    and caas.end_time is not null and su.phone =#{phone}
                    and publish_at between concat(#{date},'-01-01 00:00:00') and concat(#{date},'-12-31 23:59:59')
                    and caas.start_time IS NOT NULL
                    and caas.end_time IS NOT NULL
                    and caas.check_unit_id IS NULL
                group by caa.id)
 
            <if test="checkUnitId != null and checkUnitId!='' ">
                UNION ALL
                (SELECT
                ROUND((TIMESTAMPDIFF(SECOND, s.start_time, s.end_time) / 3600), 2) as hours,
                a.id AS checkId
                FROM
                com_act_activity a
                LEFT JOIN com_act_act_regist s ON a.id = s.activity_id
                LEFT JOIN sys_user su ON su.user_id = s.user_id
                WHERE
                s.end_time IS NOT NULL
                AND s.check_unit_id = #{checkUnitId}
                AND su.phone = #{phone}
                AND s.start_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
                AND concat( #{date}, '-12-31 23:59:59' )
                and s.start_time IS NOT NULL
                and s.end_time IS NOT NULL
                GROUP BY
                a.id)
            </if>
            ) t1
    </select>
 
    <select id="selectListByPhone" resultType="com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAppVO">
        SELECT
            canc.*,
            su.nick_name as name,
            su.community_id,
            ca.`name` as communityName,
            canct.name as topicName,
            su.image_url as headUrl
        FROM
            com_act_neighbor_circle AS canc
                left join sys_user as su on su.user_id = canc.release_id
                left join com_act_neighbor_circle_topic as canct on canct.id = canc.topic_id
                left join com_act as ca on ca.community_id = canc.community_id
                left join sys_user su1 on su1.user_id = canc.solve_id
        where is_del = 2 and canc.solve_status=4 and su1.phone = #{phone} and canc.create_at between concat(#{date},'-01-01 00:00:00') and concat(#{date},'-12-31 23:59:59')
    </select>
    <select id="institutionalUnitServiceAnalysis"
            resultType="com.panzhihua.common.model.vos.neighbor.UnitActivityAnalysisVO">
        select canc.solve_unit_id as unitId,sum(canc.real_service_time) as serviceTime,count(canc.real_service_time) as serviceTimes,canc.community_id as communityId,
               cpcu.belong_to as belongTo,cpcu.org_name as orgName
        from com_act_neighbor_circle as canc
        left join com_pb_check_unit as cpcu on canc.solve_unit_id=cpcu.id
        where
        canc.order_type = 1
        AND is_del = 2
        AND solve_status = 4
        AND canc.solve_unit_id&lt;>''
        <if test="beginTime != null">
            and canc.order_time between #{beginTime} and #{endTime}
        </if>
        <if test="belongTo != null and belongTo != ''">
            and belong_to=#{belongTo}
        </if>
        <if test="communityId != null">
            and canc.community_id=#{communityId}
        </if>
        <if test="unitId != null and unitId != ''">
            and canc.solve_unit_id = #{unitId}
        </if>
        group by(canc.solve_unit_id)
        having serviceTimes&lt;>'' and serviceTime&lt;>''
        order by serviceTime desc
    </select>
 
    <select id="getNewTaskList" resultType="com.panzhihua.common.model.vos.neighbor.UnitActivityAnalysisVO">
        SELECT
            nfnpc.unit_id,
            sum(nfnpc.service_time) as serviceTime,
            count(nfnpc.service_time) as serviceTimes,
            cpcu.belong_to as belongTo,
            cpcu.org_name as orgName,
            cpcu.community_id,
            sum(nfnpi.award) as awardSum
        FROM new_fight_need_problem_claim as nfnpc
        left join com_pb_check_unit as cpcu on nfnpc.unit_id=cpcu.id
        LEFT JOIN new_fight_need_problem_inventory as nfnpi on nfnpc.task_id=nfnpi.id
        WHERE nfnpc.service_time iS NOT NULL AND nfnpc.unit_id IS NOT NULL
        <if test="beginTime != null">
            and nfnpc.creation_time between #{beginTime} and #{endTime}
        </if>
        <if test="belongTo != null and belongTo != ''">
            and cpcu.belong_to=#{belongTo}
        </if>
        <if test="communityId != null">
            and cpcu.community_id=#{communityId}
        </if>
        group by nfnpc.unit_id
        having serviceTimes&lt;>'' and serviceTime&lt;>''
        order by serviceTime desc
    </select>
 
 
 
 
    <select id="institutionalUnitActivityAnalysis"
            resultType="com.panzhihua.common.model.vos.neighbor.UnitActivityAnalysisVO">
        SELECT sum(serviceTimes) AS serviceTimes, sum(serviceTime) as serviceTime, unitId, communityId, belong_to, sum(award) as awardSum
        FROM (
            SELECT count(caa.check_unit_id) as serviceTimes,sum(caa.duration) as serviceTime,caa.check_unit_id as
            unitId,caa.community_id as communityId,cpcu.belong_to,caa.pb_reward_integral as award
            FROM com_act_activity as caa
            left join com_pb_check_unit as cpcu on caa.check_unit_id=cpcu.id
            where caa.`status` = 5 AND caa.check_unit_id&lt;>''
            and caa.type=5
            <if test="beginTime != null">
                and caa.publish_at between #{beginTime} and #{endTime}
            </if>
            <if test="belongTo != null and belongTo != ''">
                and belong_to=#{belongTo}
            </if>
            <if test="communityId != null">
                and caa.community_id=#{communityId}
            </if>
            <if test="unitId != null and unitId != ''">
                and caa.check_unit_id = #{unitId}
            </if>
            GROUP BY (caa.check_unit_id)
            UNION ALL
            SELECT count(id) as serviceTimes, sum(duration) as serviceTime, check_unit_id as unitId, community_id as
            communityId, belong_to,award
            FROM(
                SELECT caa.id, caa.duration, s.check_unit_id , cpcu.community_id , cpcu.belong_to,caa.pb_reward_integral as award
                FROM com_act_activity caa
                LEFT JOIN com_act_act_regist s ON caa.id = s.activity_id
                left join com_pb_check_unit as cpcu on s.check_unit_id = cpcu.id
                WHERE s.end_time IS NOT NULL AND s.check_unit_id IS NOT NULL
                <if test="beginTime != null">
                  AND s.start_time BETWEEN #{beginTime} and #{endTime}
                </if>
                <if test="belongTo != null and belongTo != ''">
                  and belong_to=#{belongTo}
                </if>
                <if test="communityId != null">
                    and caa.community_id=#{communityId}
                </if>
                <if test="unitId != null and unitId != ''">
                    and caa.check_unit_id = #{unitId}
                </if>
                GROUP BY caa.id,s.check_unit_id
            ) temp
            GROUP BY check_unit_id
        ) temp2 GROUP BY unitId
        having serviceTimes&lt;>'' and serviceTime&lt;>''
        order by serviceTime desc
    </select>
 
 
    <select id="getNewPartyMemberTaskList" resultType="com.panzhihua.common.model.vos.neighbor.PartyMemberAnalysisVO">
        SELECT
        nfnpc.unit_id,
        sum(nfnpc.service_time) as serviceTime,
        count(nfnpc.service_time) as serviceTimes,
        cpcu.belong_to as belongTo,
        cpcu.org_name as orgName,
        nfnpi.community_id,
        sum(nfnpi.award) as partyCount,
        cpcu.name as unitName,
        cpcu.org_name as orgName,
        nfnpc.user_id as memberId,
        su.name as memberName,
        cpcu.name as belongUnit,
        ca.name as belongCommunity
        FROM new_fight_need_problem_claim as nfnpc
        left join sys_user as su on nfnpc.user_id=su.user_id
        left join com_pb_check_unit as cpcu on nfnpc.unit_id=cpcu.id
        LEFT JOIN new_fight_need_problem_inventory as nfnpi on nfnpc.task_id=nfnpi.id
        left join com_act as ca on nfnpi.community_id=ca.community_id
        WHERE nfnpc.service_time iS NOT NULL
        <if test="beginTime != null">
            and nfnpc.creation_time between #{beginTime} and #{endTime}
        </if>
        <if test="belongTo != null and belongTo != ''">
            and cpcu.belong_to=#{belongTo}
        </if>
        <if test="communityId != null">
            and nfnpi.community_id=#{communityId}
        </if>
        <if test="unitId != null">
            and cpcu.id=#{unitId}
        </if>
        <if test="searchContent != null and searchContent != ''">
            and (su.name like concat('%',#{searchContent},'%')
            or su.phone like concat('%',#{searchContent},'%')
            or ca.name like concat('%',#{searchContent},'%')
            or cpcu.name like concat('%',#{searchContent},'%'))
        </if>
        group by nfnpc.user_id
        having serviceTimes&lt;>'' and serviceTime&lt;>''
        order by serviceTime desc
    </select>
 
 
 
    <select id="institutionalPartyMemberServiceAnalysis"
            resultType="com.panzhihua.common.model.vos.neighbor.PartyMemberAnalysisVO">
        SELECT count(id) as serviceTimes, sum(duration) as serviceTime, unitId,unitName,orgName,
        communityId, memberId, memberName, belongUnit, belongCommunity, belongTo,sum(award) as partyCount
        FROM (
            SELECT caa.id, ROUND((TIMESTAMPDIFF(SECOND, caar.start_time, caar.end_time) / 3600), 2) as duration, cpcu.id as unitId,cpcu.name as unitName,cpcu.org_name as orgName, cpcu.community_id as communityId, su.user_id as
            memberId, su.name as memberName, cpcu.name as belongUnit, ca.name as belongCommunity, cpcu.belong_to belongTo,caa.pb_reward_integral as award
            FROM `com_act_activity` as caa
            left join com_act_act_regist as caar on caa.id=caar.activity_id
            left join sys_user as su on caar.user_id=su.user_id
            left join com_pb_member as cpm on su.phone=cpm.phone
            left join com_pb_check_unit as cpcu on cpm.check_unit_id=cpcu.id
            left join com_act as ca on cpcu.community_id=ca.community_id
            where caar.sign_identity = 2
                AND cpcu.id IS NOT NULL
                and caar.start_time IS NOT NULL
                and caar.end_time IS NOT NULL
            <if test="beginTime != null">
                and caar.start_time between #{beginTime} and #{endTime}
            </if>
            <if test="belongTo != null and belongTo != ''">
                and cpcu.belong_to=#{belongTo}
            </if>
            <if test="communityId != null">
                and cpcu.community_id=#{communityId}
            </if>
            <if test="unitId != null">
                and cpcu.id=#{unitId}
            </if>
            <if test="searchContent != null and searchContent != ''">
                and (su.name like concat('%',#{searchContent},'%')
                         or su.phone like concat('%',#{searchContent},'%')
                         or ca.name like concat('%',#{searchContent},'%')
                         or cpcu.name like concat('%',#{searchContent},'%'))
            </if>
            GROUP BY caa.id,caar.user_id
        ) temp GROUP BY memberId
        having serviceTimes&lt;>'' and serviceTime&lt;>'' and memberName&lt;>''
        order by serviceTime desc
    </select>
    <select id="institutionalPartyMemberActAnalysis"
            resultType="com.panzhihua.common.model.vos.neighbor.PartyMemberAnalysisVO">
        SELECT count(canc.solve_id) as serviceTimes,sum(canc.real_service_time) as serviceTime
        ,cpcu.community_id as communityId,canc.solve_id as memberId,su.name as memberName,cpcu.name  as belongUnit,
               ca.name as belongCommunity,cpcu.belong_to
        FROM `com_act_neighbor_circle` as canc
        left join sys_user as su on canc.solve_id=su.user_id
        left join com_pb_member as cpm on su.phone=cpm.phone
        left join com_pb_check_unit as cpcu on cpm.check_unit_id=cpcu.id
        left join com_act as ca on cpcu.community_id=ca.community_id
        where cpcu.id IS NOT NULL
        <if test="beginTime != null">
            and canc.order_time between #{beginTime} and #{endTime}
        </if>
        <if test="belongTo != null and belongTo != ''">
            and cpcu.belong_to=#{belongTo}
        </if>
        <if test="communityId != null">
            and cpcu.community_id=#{communityId}
        </if>
        <if test="unitId != null">
            and cpcu.id=#{unitId}
        </if>
        <if test="searchContent != null and searchContent != ''">
            and (su.name like concat('%',#{searchContent},'%')
            or su.phone like concat('%',#{searchContent},'%')
            or ca.name like concat('%',#{searchContent},'%')
            or cpcu.name like concat('%',#{searchContent},'%'))
        </if>
        GROUP BY (canc.solve_id)
        having serviceTimes&lt;>'' and serviceTime&lt;>'' and memberName&lt;>''
        order by serviceTime desc
    </select>
    <select id="institutionalPartyMemberServiceAnalysisByServicesTimes"
            resultType="com.panzhihua.common.model.vos.neighbor.PartyMemberAnalysisVO">
        SELECT count(caa.check_unit_id) as serviceTimes,sum(caa.duration) as serviceTime,caa.check_unit_id as unitId,
               caa.community_id as communityId,cpcu.belong_to
        FROM com_act_activity as caa
        left join com_pb_check_unit as cpcu on caa.check_unit_id=cpcu.id
        where caa.check_unit_id&lt;>''
        and caa.type=5
        <if test="beginTime != null">
            and caa.create_at between #{beginTime} and #{endTime}
        </if>
        <if test="belongTo != null and belongTo != ''">
            and belong_to=#{belongTo}
        </if>
        GROUP BY (caa.check_unit_id)
        having serviceTimes&lt;>'' and serviceTime&lt;>''
        order by serviceTimes desc
    </select>
     <select id="selectCount" resultType="Integer">
        select count(id)  from com_act_neighbor_circle
        <where>
            <if test="type!=null">
                and belong_type = #{type}
            </if>
            <if test="phone!=null and phone !=''">
                and (help_member_content like concat('%',#{phone},'%') or help_org_content like concat('%',#{phone},'%') )
            </if>
            <if test="communityId!=null">
                and community_id = #{communityId}
            </if>
        </where>
    </select>
    <select id="pageRelationList"
            resultType="com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAppVO">
        SELECT
        canc.*,
        su.nick_name as name,
        su.community_id,
        ca.`name` as communityName,
        canct.name as topicName,
        su.image_url as headUrl
        FROM
        com_act_neighbor_circle AS canc
        left join sys_user as su on su.user_id = canc.release_id
        left join com_act_neighbor_circle_topic as canct on canct.id = canc.topic_id
        left join com_act as ca on ca.community_id = canc.community_id
        LEFT JOIN com_act_activity t ON canc.id = t.relation_id
        where is_del = 2 and canc.status = 2 AND canc.order_type = 1 and canc.solve_status in (2,3,4) and canc.community_id = ${neighborCircleAppDTO.communityId} AND t.id IS NULL
        <if test='neighborCircleAppDTO.topicId != null '>
            and canc.topic_id = #{neighborCircleAppDTO.topicId}
        </if>
        <if test='neighborCircleAppDTO.checkUnitId != null '>
            and canc.solve_unit_id = #{neighborCircleAppDTO.checkUnitId}
        </if>
        <if test='neighborCircleAppDTO.belongType != null '>
            and canc.belong_type = #{neighborCircleAppDTO.belongType}
        </if>
        <if test='neighborCircleAppDTO.keyWord != null and neighborCircleAppDTO.keyWord != &quot;&quot;'>
            and (canct.`name` like concat ('%',#{neighborCircleAppDTO.keyWord},'%') or
            su.nick_name like concat ('%',#{neighborCircleAppDTO.keyWord},'%') or
            canc.release_content like concat ('%',#{neighborCircleAppDTO.keyWord},'%'))
        </if>
        <if test="neighborCircleAppDTO.isHelp ==1">
            and (canc.help_member_content like concat ('%',#{neighborCircleAppDTO.phone},'%') or canc.help_org_content like concat ('%',#{neighborCircleAppDTO.phone},'%') )
        </if>
        order by canc.create_at desc
    </select>
 
    <select id="pageNeighborByBigScreen" parameterType="com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleAdminDTO"
            resultType="com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAdminVO">
        SELECT
        nc.*,
        u.`nick_name` AS releaseName,u.image_url,canct.`name` as topicName ,u.`type` as userType
        ,u.name as communityName,nc.solve_status
        FROM
        com_act_neighbor_circle nc
        LEFT JOIN sys_user u ON nc.release_id = u.user_id
        LEFT JOIN com_act_neighbor_circle_topic as canct ON canct.id = nc.topic_id
        <where>
            nc.belong_type in (2,3) and is_del = 2
 
            <if test='neighborCircleAdminDTO.keyWord != null and neighborCircleAdminDTO.keyWord != &quot;&quot;'>
                and (canct.`name` like concat(#{neighborCircleAdminDTO.keyWord},'%') or
                u.`nick_name` like concat(#{neighborCircleAdminDTO.keyWord},'%') or
                nc.`release_content` like concat(#{neighborCircleAdminDTO.keyWord},'%') )
            </if>
 
            <if test='neighborCircleAdminDTO.status != null '>
                and nc.status = #{neighborCircleAdminDTO.status}
            </if>
<!--            <if test='neighborCircleAdminDTO.belongType != null '>-->
<!--                and nc.belong_type = #{neighborCircleAdminDTO.belongType}-->
<!--            </if>-->
            <if test="neighborCircleAdminDTO.solveStatus !=null">
                <if test="neighborCircleAdminDTO.solveStatus ==1">
                    and nc.solve_status in (0,1)
                </if>
                <if test="neighborCircleAdminDTO.solveStatus ==2">
                    and nc.solve_status =2
                </if>
                <if test="neighborCircleAdminDTO.solveStatus ==3">
                    and nc.solve_status in(3,4)
                </if>
            </if>
        </where>
        order by nc.create_at desc
    </select>
</mapper>