chengf
2025-12-10 ee89a5cfa50980f1f2f2fa84bb69741b161670b5
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
<?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="communityServiceDaoImpl">
 
    <!-- 保存小区信息 add by wuxw 2018-07-03 -->
    <insert id="saveBusinessCommunityInfo" parameterType="Map">
        insert into business_community(community_id, b_id, name, address, city_code,
                                       nearby_landmarks, map_x, map_y, month, state, operate, community_area, tel)
        values (#{communityId}, #{bId}, #{name}, #{address}, #{cityCode},
                #{nearbyLandmarks}, #{mapX}, #{mapY}, #{month}, #{state}, #{operate}, #{communityArea}, #{tel})
    </insert>
 
    <!-- 保存小区属性信息  add by wuxw 2018-07-03 -->
    <insert id="saveCommunityAttr" parameterType="Map">
        insert into s_community_attr(b_id, attr_id, community_id, spec_cd, value, month, status_cd)
        values (#{bId}, #{attrId}, #{communityId}, #{specCd}, #{value}, #{month}, #{statusCd})
    </insert>
 
    <!-- 保存小区属性信息  add by wuxw 2018-07-03 -->
    <insert id="saveBusinessCommunityAttr" parameterType="Map">
        insert into business_community_attr(b_id, attr_id, community_id, spec_cd, value, month, operate)
        values (#{bId}, #{attrId}, #{communityId}, #{specCd}, #{value}, #{month}, #{operate})
    </insert>
 
    <!-- 保存小区照片信息 add by wuxw 2018-07-03 -->
    <insert id="saveBusinessCommunityPhoto" parameterType="Map">
        insert into business_community_photo(community_photo_id, b_id, community_id, community_photo_type_cd, photo,
                                             month, operate)
        values (#{communityPhotoId}, #{bId}, #{communityId}, #{communityPhotoTypeCd}, #{photo}, #{month}, #{operate})
    </insert>
 
    <!-- 查询小区信息(Business) add by wuxw 2018-07-03 -->
    <select id="getBusinessCommunityInfo" parameterType="Map" resultType="Map">
        select s.community_id,s.b_id,s.name,s.address,s.city_code,s.nearby_landmarks,
        s.map_x,s.map_y,s.operate,s.state,s.community_area communityArea,s.community_area,s.tel
        from business_community s where 1 = 1
        <if test="operate != null and operate != ''">
            and s.operate = #{operate}
        </if>
        <if test="bId != null and bId !=''">
            and s.b_id = #{bId}
        </if>
        <if test="communityId != null and communityId != ''">
            and s.community_id = #{communityId}
        </if>
    </select>
 
    <!-- 查询小区属性信息(Business) add by wuxw 2018-07-03 -->
    <select id="getBusinessCommunityAttrs" parameterType="Map" resultType="Map">
        select sa.b_id,sa.attr_id,sa.community_id,sa.spec_cd,sa.value,sa.operate
        from business_community_attr sa where 1=1
        <if test="operate != null and operate != ''">
            and sa.operate = #{operate}
        </if>
        <if test="bId != null and bId !=''">
            and sa.b_id = #{bId}
        </if>
        <if test="communityId != null and communityId != ''">
            and sa.community_id = #{communityId}
        </if>
        <if test="attrId != null and attrId != ''">
            and sa.attr_id = #{attrId}
        </if>
    </select>
 
    <!-- 查询小区照片信息 add by wuxw 2018-07-03 -->
    <select id="getBusinessCommunityPhoto" parameterType="Map" resultType="Map">
        select sp.community_photo_id,sp.b_id,sp.community_id,sp.community_photo_type_cd,sp.photo,sp.operate
        from business_community_photo sp where 1=1
        <if test="bId != null and bId !=''">
            and sp.b_id = #{bId}
        </if>
        <if test="operate != null and operate != ''">
            and sp.operate = #{operate}
        </if>
        <if test="communityId != null and communityId != ''">
            and sp.community_id = #{communityId}
        </if>
    </select>
 
    <!-- 保存小区信息至 instance表中 add by wuxw 2018-07-03 -->
    <insert id="saveCommunityInfoInstance" parameterType="Map">
        insert into s_community(community_id, b_id, name, address, city_code, nearby_landmarks, map_x, map_y, status_cd,
                                state, community_area, tel, take_time)
        values (#{community_id}, #{b_id}, #{name}, #{address}, #{city_code}, #{nearby_landmarks}, #{map_x}, #{map_y},
                '0', #{state}, #{communityArea}, #{tel}, #{takeTime})
    </insert>
 
    <!-- 保存小区属性信息到 instance add by wuxw 2018-07-03 -->
    <insert id="saveCommunityAttrsInstance" parameterType="Map">
        insert into s_community_attr(b_id,attr_id,community_id,spec_cd,value,status_cd)
        select sa.b_id,sa.attr_id,sa.community_id,sa.spec_cd,sa.value,'0'
        from business_community_attr sa
        where sa.operate = 'ADD' and sa.b_id=#{bId}
        <if test="communityId != null and communityId != ''">
            and sa.community_id = #{communityId}
        </if>
    </insert>
 
    <!-- 保存 小区照片信息 instance add by wuxw 2018-07-03 -->
    <insert id="saveCommunityPhotoInstance" parameterType="Map">
        insert into s_community_photo(community_photo_id,b_id,community_id,community_photo_type_cd,photo,status_cd)
        select sp.community_photo_id,sp.b_id,sp.community_id,sp.community_photo_type_cd,sp.photo,'0'
        from business_community_photo sp
        where sp.operate = 'ADD' and sp.b_id=#{bId}
        <if test="communityId != null and communityId != ''">
            and sp.community_id = #{communityId}
        </if>
    </insert>
 
    <!-- 查询小区信息 add by wuxw 2018-07-03 -->
    <select id="getCommunityInfo" parameterType="Map" resultType="Map">
        select s.community_id,s.b_id,s.name,s.address,s.city_code,s.nearby_landmarks,s.map_x,s.map_y,s.status_cd,
        s.state, s.take_time, s.out_time,s.community_code,s.community_code communityCode
        from s_community s
        where 1=1
        <if test="statusCd != null and statusCd != ''">
            and s.status_cd = #{statusCd}
        </if>
        <if test="bId != null and bId !=''">
            and s.b_id = #{bId}
        </if>
        <if test="communityId != null and communityId !=''">
            and s.community_id = #{communityId}
        </if>
    </select>
 
    <!-- 查询小区属性信息 add by wuxw 2018-07-03 -->
    <select id="getCommunityAttrs" parameterType="Map" resultType="Map">
        select sa.b_id,sa.attr_id,sa.community_id,sa.spec_cd,sa.value,sa.status_cd,
        sa.b_id bId,sa.attr_id attrId,sa.community_id communityId,sa.spec_cd specCd,
        s.spec_name specName,
        v.value_name valueName,
        s.list_show listShow
        from s_community_attr sa
        left join attr_spec s on sa.spec_cd = s.spec_cd and s.status_cd = '0' and s.table_name =
        'building_community_attr' and sa.spec_cd = s.spec_cd
        left join attr_value v on sa.`value` = v.`value` and s.spec_id = v.spec_id and v.status_cd = '0'
        where
        1=1
        <if test="statusCd != null and statusCd != ''">
            and sa.status_cd = #{statusCd}
        </if>
        <if test="bId != null and bId !=''">
            and sa.b_id = #{bId}
        </if>
        <if test="communityId != null and communityId !=''">
            and sa.community_id = #{communityId}
        </if>
        <if test="specCd != null and specCd !=''">
            and sa.spec_cd = #{specCd}
        </if>
        <if test="value != null and value !=''">
            and sa.value = #{value}
        </if>
        <if test="communityIds != null ">
            and sa.community_id in
            <foreach collection="communityIds" item="item" index="index" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="attrId != null and attrId != ''">
            and sa.attr_id = #{attrId}
        </if>
    </select>
 
    <!-- 查询小区照片信息 add by wuxw 2018-07-03 -->
    <select id="getCommunityPhoto" parameterType="Map" resultType="Map">
        select sp.community_photo_id,sp.b_id,sp.community_id,sp.community_photo_type_cd,sp.photo,sp.status_cd
        from s_community_photo sp
        where 1=1
        <if test="statusCd != null and statusCd != ''">
            and sp.status_cd = #{statusCd}
        </if>
        <if test="bId != null and bId !=''">
            and sp.b_id = #{bId}
        </if>
        <if test="communityId != null and communityId !=''">
            and sp.community_id = #{communityId}
        </if>
    </select>
 
    <!-- 修改小区信息 add by wuxw 2018-07-03 -->
    <update id="updateCommunityInfoInstance" parameterType="Map">
        update s_community s set s.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,s.b_id = #{newBId}
        </if>
        <if test="name != null and name != ''">
            ,s.name = #{name}
        </if>
        <if test="address != null and address != ''">
            ,s.address = #{address}
        </if>
        <if test="cityCode != null and cityCode != ''">
            ,s.city_code = #{cityCode}
        </if>
        <if test="nearbyLandmarks != null and nearbyLandmarks != ''">
            ,s.nearby_landmarks = #{nearbyLandmarks}
        </if>
        <if test="mapX != null and mapX != ''">
            ,s.map_x = #{mapX}
        </if>
        <if test="mapY != null and mapY != ''">
            ,s.map_y = #{mapY}
        </if>
        <if test="state != null and state != ''">
            ,s.state = #{state}
        </if>
        <if test="tel != null and tel != ''">
            ,s.tel = #{tel}
        </if>
        <if test="communityCode !=null and communityCode != ''">
            , t.community_code= #{communityCode}
        </if>
        <if test="takeTime !=null and takeTime != ''">
            , t.take_time= #{takeTime}
        </if>
        <if test="outTime !=null and outTime != ''">
            , t.out_time= #{outTime}
        </if>
        <if test="communityArea != null and communityArea != ''">
            ,s.community_area = #{communityArea}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
            and s.b_id = #{bId}
        </if>
        <if test="communityId != null and communityId !=''">
            and s.community_id = #{communityId}
        </if>
    </update>
 
    <!-- 修改小区属性信息 add by wuxw 2018-07-03 -->
    <update id="updateCommunityAttrInstance" parameterType="Map">
        update s_community_attr sa set sa.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,sa.b_id = #{newBId}
        </if>
        <if test="value != null and value != ''">
            ,sa.value = #{value}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
            and sa.b_id = #{bId}
        </if>
        <if test="communityId != null and communityId !=''">
            and sa.community_id = #{communityId}
        </if>
        <if test="specCd != null and specCd !=''">
            and sa.spec_cd = #{specCd}
        </if>
        <if test="attrId != null and attrId !=''">
            and sa.attr_id = #{attrId}
        </if>
    </update>
 
    <!-- 修改小区照片信息 add by wuxw 2018-07-03 -->
    <update id="updateCommunityPhotoInstance" parameterType="Map">
        update s_community_photo sp set sp.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,sp.b_id = #{newBId}
        </if>
        <if test="communityPhotoTypeCd != null and communityPhotoTypeCd != ''">
            ,sp.community_photo_type_cd = #{communityPhotoTypeCd}
        </if>
        <if test="photo != null and photo != ''">
            ,sp.photo = #{photo}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
            and sp.b_id = #{bId}
        </if>
        <if test="communityId != null and communityId !=''">
            and sp.community_id = #{communityId}
        </if>
        <if test="communityPhotoId != null and communityPhotoId !=''">
            and sp.community_photo_id = #{communityPhotoId}
        </if>
    </update>
 
    <!--小区成员加入 add by wuxw 2018-10-27 saveBusinessCommunityMember-->
    <insert id="saveBusinessCommunityMember" parameterType="Map">
        insert into business_community_member(community_member_id, b_id, community_id, member_id, member_type_cd, month,
                                              operate, audit_status_cd, start_time, end_time)
        values (#{communityMemberId}, #{bId}, #{communityId}, #{memberId}, #{memberTypeCd}, #{month}, #{operate},
                #{auditStatusCd}, #{startTime}, #{endTime})
    </insert>
 
    <!-- 小区成员加入 instance表中 add by wuxw 2018-10-27 -->
    <insert id="saveCommunityMemberInstance" parameterType="Map">
        insert into
        s_community_member(community_member_id,b_id,community_id,member_id,member_type_cd,status_cd,audit_status_cd,start_time,end_time)
        select
        ms.community_member_id,ms.b_id,ms.community_id,ms.member_id,ms.member_type_cd,'0',ms.audit_status_cd,ms.start_time,ms.end_time
        from business_community_member ms where
        ms.operate = 'ADD' and ms.b_id=#{bId}
        <if test="communityId != null and communityId != ''">
            and ms.community_id = #{communityId}
        </if>
    </insert>
 
    <!-- 查询小区成员 add by wuxw 2018-10-27 getBusinessCommunityMember-->
    <select id="getBusinessCommunityMember" parameterType="Map" resultType="Map">
        select
        ms.community_member_id,ms.b_id,ms.community_id,ms.member_id,ms.member_type_cd,ms.operate,ms.audit_status_cd,ms.start_time,ms.end_time
        from business_community_member ms where 1 = 1
        <if test="operate != null and operate != ''">
            and ms.operate = #{operate}
        </if>
        <if test="bId != null and bId !=''">
            and ms.b_id = #{bId}
        </if>
        <if test="communityId != null and communityId != ''">
            and ms.community_id = #{communityId}
        </if>
    </select>
 
    <!-- 查询小区成员  add by wuxw 2018-07-03 -->
    <select id="getCommunityMember" parameterType="Map" resultType="Map">
        select ms.community_member_id ,
        ms.b_id,ms.community_id,ms.member_id,ms.member_type_cd,ms.status_cd,ms.audit_status_cd,
        ms.community_member_id communityMemberId ,ms.b_id bId,ms.community_id communityId,ms.member_id
        memberId,ms.member_type_cd memberTypeCd,ms.status_cd statusCd,
        ms.audit_status_cd auditStatusCd,
        ms.start_time,ms.end_time,ms.start_time startTime,ms.end_time endTime,
        ms.create_time createTime,
        (CASE
        WHEN ms.audit_status_cd='1000'
        THEN '待审核'
        WHEN ms.audit_status_cd = '1100'
        THEN '审核完成'
        ELSE
        '审核拒绝'
        END) stateName
        <if test="needCommunityInfo == true">
            ,sc.name
        </if>
        from s_community_member ms
        <if test="needCommunityInfo == true">
            ,s_community sc
        </if>
        where 1=1
        <if test="needCommunityInfo == true">
            and sc.`community_id` = ms.`community_id`
            AND sc.`status_cd` = '0'
            and sc.state in ('1100','1400')
        </if>
        <if test="statusCd != null and statusCd != ''">
            and ms.status_cd = #{statusCd}
        </if>
 
        <if test="bId != null and bId !=''">
            and ms.b_id = #{bId}
        </if>
        <if test="communityMemberId != null and communityMemberId !=''">
            and ms.community_member_id = #{communityMemberId}
        </if>
        <if test="memberId != null and memberId != '' and needCommunityInfo == true">
            AND ms.`community_id` = msc.`community_id`
            and msc.member_id = #{memberId}
            and msc.status_cd = '0'
        </if>
        <if test="memberId != null and memberId != '' and needCommunityInfo == false">
            and ms.member_id = #{memberId}
        </if>
        <if test="subMemberId != null and subMemberId != ''">
            and ms.member_id = #{subMemberId}
        </if>
        <if test="noAuditEnterCommunity == true">
            and ms.member_type_cd not in ('390001200003','390001200005','390001200000')
        </if>
        <if test="memberTypeCd != null and memberTypeCd != ''">
            and ms.member_type_cd = #{memberTypeCd}
        </if>
        <if test="auditStatusCd != null and auditStatusCd != ''">
            and ms.audit_status_cd = #{auditStatusCd}
        </if>
 
        <if test="communityId != null and communityId != ''">
            and ms.community_id = #{communityId}
        </if>
        <if test="communityName != null and communityName != '' and needCommunityInfo == true">
            and sc.name like concat('%',#{communityName},'%')
        </if>
        <!--<if test="needCommunityInfo == true">
            group by ms.community_id
        </if>-->
        order by ms.create_time desc
        <if test="page != -1 and page != null">
            limit #{page},#{row}
        </if>
    </select>
 
    <!-- 修改小区成员 add by wuxw 2018-07-03 -->
    <update id="updateCommunityMemberInstance" parameterType="Map">
        update s_community_member ms set ms.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,ms.b_id = #{newBId}
        </if>
        <if test="auditStatusCd !=null and auditStatusCd !=''">
            ,ms.audit_status_cd = #{auditStatusCd}
        </if>
        <if test="startTime !=null ">
            ,ms.start_time = #{startTime}
        </if>
        <if test="endTime !=null ">
            ,ms.end_time = #{endTime}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
            and ms.b_id = #{bId}
        </if>
        <if test="communityMemberId != null and communityMemberId !=''">
            and ms.community_member_id = #{communityMemberId}
        </if>
    </update>
 
    <!-- 查询小区成员  add by wuxw 2018-07-03 -->
    <select id="getCommunityMemberCount" parameterType="Map" resultType="Map">
        select ms.community_id,count(1) count
        from s_community_member ms
        <if test="needCommunityInfo == true">
            ,s_community sc
        </if>
        where 1=1
        <if test="needCommunityInfo == true">
            and sc.`community_id` = ms.`community_id`
            AND sc.`status_cd` = '0'
            and sc.state in ('1100','1400')
        </if>
        <if test="statusCd != null and statusCd != ''">
            and ms.status_cd = #{statusCd}
        </if>
        <if test="bId != null and bId !=''">
            and ms.b_id = #{bId}
        </if>
        <if test="communityMemberId != null and communityMemberId !=''">
            and ms.community_member_id = #{communityMemberId}
        </if>
        <if test="memberId != null and memberId != '' and needCommunityInfo == true">
            AND ms.`community_id` = msc.`community_id`
            and msc.member_id = #{memberId}
            and msc.status_cd = '0'
        </if>
        <if test="memberId != null and memberId != '' and needCommunityInfo == false">
            and ms.member_id = #{memberId}
        </if>
        <if test="subMemberId != null and subMemberId != ''">
            and ms.member_id = #{subMemberId}
        </if>
        <if test="noAuditEnterCommunity == true">
            and ms.member_type_cd not in ('390001200003','390001200005','390001200000')
        </if>
        <if test="memberTypeCd != null and memberTypeCd != ''">
            and ms.member_type_cd = #{memberTypeCd}
        </if>
        <if test="auditStatusCd != null and auditStatusCd != ''">
            and ms.audit_status_cd = #{auditStatusCd}
        </if>
        <if test="auditStatusCds != null and auditStatusCds != null">
            and ms.audit_status_cd in
            <foreach collection="auditStatusCds" item="item" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="communityId != null and communityId != ''">
            and ms.community_id = #{communityId}
        </if>
        <if test="communityName != null and communityName != '' and needCommunityInfo == true">
            and sc.name like concat('%',#{communityName},'%')
        </if>
        <!--<if test="needCommunityInfo == true">
            group by ms.community_id
        </if>-->
    </select>
 
    <!-- 查询小区信息 add by wuxw 2018-07-03 -->
    <select id="getCommunityInfoNew" parameterType="Map" resultType="Map">
        select t.address,t.nearby_landmarks,t.nearby_landmarks nearbyLandmarks,
        t.city_code,t.city_code cityCode,t.name,t.status_cd,t.status_cd statusCd,t.tel,
        t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.map_y,t.map_y mapY,
        t.map_x,t.map_x mapX,t.state,td.name stateName,ca.area_code areaCode,ca.area_name areaName,
        ca.parent_area_code parentAreaCode,ca.parent_area_name parentAreaName,
        t.community_area communityArea,t.pay_fee_month,t.pay_fee_month payFeeMonth,t.fee_price,t.fee_price
        feePrice,t.qr_code qrCode,t.create_time createTime,s.name storeName,s.store_id storeId, t.take_time, t.take_time takeTime,t.out_time outTime
        from s_community t
        left join city_area ca on t.city_code = ca.area_code and ca.status_cd = '0'
        left join s_community_member cm on t.community_id = cm.community_id and cm.member_type_cd = '390001200002' and cm.status_cd = '0'
        left join s_store s on cm.member_id = s.store_id and s.status_cd = '0'
        left join t_dict td on t.state = td.status_cd and td.table_name = 's_community' and td.table_columns = 'state'
        where t.status_cd = '0'
        <if test="address !=null and address != ''">
            and t.address= #{address}
        </if>
        <if test="nearbyLandmarks !=null and nearbyLandmarks != ''">
            and t.nearby_landmarks= #{nearbyLandmarks}
        </if>
        <if test="cityCode !=null and cityCode != ''">
            and t.city_code= #{cityCode}
        </if>
        <if test="name !=null and name != ''">
            and t.name like concat('%',#{name},'%')
        </if>
        <!--<if test="nameLike !=null and nameLike != ''">
            and t.name like concat('%',#{nameLike},'%')
        </if>-->
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="communityIds !=null">
            and t.community_id in
            <foreach collection="communityIds" item="item" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="bId !=null and bId != ''">
            and t.b_id= #{bId}
        </if>
        <if test="mapY !=null and mapY != ''">
            and t.map_y= #{mapY}
        </if>
        <if test="mapX !=null and mapX != ''">
            and t.map_x= #{mapX}
        </if>
        <if test="state !=null and state != ''">
            and t.state= #{state}
        </if>
        <if test="memberId !=null and memberId !=''">
            and cm.community_id = t.community_id
            and cm.member_id = #{memberId}
            and cm.status_cd = '0'
        </if>
        <if test="memberId !=null and memberId !='' and auditStatusCd != null and auditStatusCd !=''">
            and cm.audit_status_cd = #{auditStatusCd}
        </if>
        <if test="notInCommunityId != null ">
            and t.community_id not in
            <foreach collection="notInCommunityId" item="item" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <!--group by t.community_id-->
        order by t.create_time desc
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>
    </select>
 
 
 
    <!-- 查询小区信息 add by wuxw 2018-07-03 -->
    <select id="getCommunityInfoNewMessage" parameterType="Map" resultType="Map">
        select t.address,t.nearby_landmarks,t.nearby_landmarks nearbyLandmarks,
        t.city_code,t.city_code cityCode,t.name,t.status_cd,t.status_cd statusCd,t.tel,t.community_code, t.community_code communityCode,
        t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.map_y,t.map_y mapY,
        t.map_x,t.map_x mapX,t.state,td.name stateName,ca.area_code areaCode,ca.area_name areaName,
        ca.parent_area_code parentAreaCode,ca.parent_area_name parentAreaName,
        t.community_area communityArea,t.pay_fee_month,t.pay_fee_month payFeeMonth,t.fee_price,t.fee_price
        feePrice,t.qr_code qrCode,t.create_time createTime,s.name storeName,s.store_id storeId, t.take_time, t.take_time takeTime,t.out_time outTime,
 
        t.project_address_province,
        t.project_address_province projectAddressProvince,
        t.project_address_city,
        t.project_address_city projectAddressCity,
        t.project_address_district,
        t.project_address_district projectAddressDistrict,
        t.project_address_town,
        t.project_address_town projectAddressTown,
        t.project_address_road,
        t.project_address_road projectAddressRoad,
        t.house_completion_date,
        t.house_completion_date houseCompletionDate,
        t.project_nature,
        t.project_nature projectNature,
        t.project_type,
        t.project_type projectType,
        t.project_land_area,
        t.project_land_area projectLandArea,
        t.total_construction_area,
        t.total_construction_area totalConstructionArea,
        t.chargeable_total_area,
        t.chargeable_total_area chargeableTotalArea,
        t.chargeable_area_multilayer,
        t.chargeable_area_multilayer chargeableAreaMultilayer,
        t.chargeable_area_high_rise1,
        t.chargeable_area_high_rise1 chargeableAreaHighRise1,
        t.chargeable_area_high_rise_up,
        t.chargeable_area_high_rise_up chargeableAreaHighRiseUp,
        t.chargeable_area_shop,
        t.chargeable_area_shop chargeableAreaShop,
        t.chargeable_area_villa,
        t.chargeable_area_villa chargeableAreaVilla,
        t.chargeable_area_office,
        t.chargeable_area_office chargeableAreaOffice,
        t.chargeable_area_commercial_house,
        t.chargeable_area_commercial_house chargeableAreaCommercialHouse,
        t.green_area,
        t.green_area greenArea,
        t.area_details,
        t.area_details areaDetails,
        t.property_management_address,
        t.property_management_address propertyManagementAddress,
        t.property_manager_name,
        t.property_manager_name propertyManagerName,
        t.property_manager_phone,
        t.property_manager_phone propertyManagerPhone,
        t.day_repair_phone,
        t.day_repair_phone dayRepairPhone,
        t.night_repair_phone,
        t.night_repair_phone nightRepairPhone,
        t.project_manager,
        t.project_manager projectManager,
        t.has_manager_certificate,
        t.has_manager_certificate hasManagerCertificate,
        t.certificate_name,
        t.certificate_name certificateName,
        t.manager_certificate_no,
        t.manager_certificate_no managerCertificateNo,
        t.manager_phone,
        t.manager_phone managerPhone,
        t.neighborhood_committee_name,
        t.neighborhood_committee_name neighborhoodCommitteeName,
        t.neighborhood_committee_address,
        t.neighborhood_committee_address neighborhoodCommitteeAddress,
        t.neighborhood_secretary,
        t.neighborhood_secretary neighborhoodSecretary,
        t.neighborhood_office_phone,
        t.neighborhood_office_phone neighborhoodOfficePhone,
        t.secretary_phone,
        t.secretary_phone secretaryPhone,
        t.owners_committee_address,
        t.owners_committee_address ownersCommitteeAddress,
        t.owners_committee_chairman,
        t.owners_committee_chairman ownersCommitteeChairman,
        t.chairman_phone,
        t.chairman_phone chairmanPhone,
        t.fire_hydrant_count,
        t.fire_hydrant_count fireHydrantCount,
        t.fire_channel_count,
        t.fire_channel_count fireChannelCount,
        t.water_tank_count,
        t.water_tank_count waterTankCount,
        t.reservoir_count,
        t.reservoir_count reservoirCount,
        t.total_motor_vehicle_spaces,
        t.total_motor_vehicle_spaces totalMotorVehicleSpaces,
        t.ground_motor_vehicle_spaces,
        t.ground_motor_vehicle_spaces groundMotorVehicleSpaces,
        t.underground_motor_vehicle_spaces,
        t.underground_motor_vehicle_spaces undergroundMotorVehicleSpaces,
        t.new_energy_charging_piles,
        t.new_energy_charging_piles newEnergyChargingPiles,
        t.non_motor_vehicle_charging_points,
        t.non_motor_vehicle_charging_points nonMotorVehicleChargingPoints,
        t.ground_non_motor_vehicle_area,
        t.ground_non_motor_vehicle_area groundNonMotorVehicleArea,
        t.underground_non_motor_vehicle_area,
        t.underground_non_motor_vehicle_area undergroundNonMotorVehicleArea,
        t.clubhouse_area,
        t.clubhouse_area clubhouseArea,
        t.has_decoration_rubbish_point,
        t.has_decoration_rubbish_point hasDecorationRubbishPoint,
        t.security_entrance_count,
        t.security_entrance_count securityEntranceCount,
        t.elevator_count,
        t.elevator_count elevatorCount,
        t.elevator_type,
        t.elevator_type elevatorType,
        t.elevator_install_date,
        t.elevator_install_date elevatorInstallDate,
        t.elevator_service_life,
        t.elevator_service_life elevatorServiceLife,
        t.elevator_brand1,
        t.elevator_brand1 elevatorBrand1,
        t.elevator_brand2,
        t.elevator_brand2 elevatorBrand2,
        t.monitor_count,
        t.monitor_count monitorCount,
        t.monitor_maintenance_company,
        t.monitor_maintenance_company monitorMaintenanceCompany,
        t.barrier_gate_count,
        t.barrier_gate_count barrierGateCount,
        t.barrier_gate_brand,
        t.barrier_gate_brand barrierGateBrand,
        t.barrier_supplier_contact,
        t.barrier_supplier_contact barrierSupplierContact,
        t.barrier_supplier_phone,
        t.barrier_supplier_phone barrierSupplierPhone,
        t.water_pump_count,
        t.water_pump_count waterPumpCount,
        t.ground_parking_spaces,
        t.ground_parking_spaces groundParkingSpaces,
        t.underground_parking_spaces,
        t.underground_parking_spaces undergroundParkingSpaces,
        t.ground_non_mechanical_fee,
        t.ground_non_mechanical_fee groundNonMechanicalFee,
        t.garage_non_mechanical_fee,
        t.garage_non_mechanical_fee garageNonMechanicalFee,
        t.temporary_hourly_fee,
        t.temporary_hourly_fee temporaryHourlyFee,
        t.temporary_daily_fee,
        t.temporary_daily_fee temporaryDailyFee,
        t.temporary_per_time_fee,
        t.temporary_per_time_fee temporaryPerTimeFee,
        t.total_building_count,
        t.total_building_count totalBuildingCount,
        t.building_unit_count,
        t.building_unit_count buildingUnitCount,
        t.high_rise_building_count,
        t.high_rise_building_count highRiseBuildingCount,
        t.multilayer_villa_building_count,
        t.multilayer_villa_building_count multilayerVillaBuildingCount,
        t.residential_household_count,
        t.residential_household_count residentialHouseholdCount,
        t.shop_household_count,
        t.shop_household_count shopHouseholdCount
 
        from s_community t
        left join city_area ca on t.city_code = ca.area_code and ca.status_cd = '0'
        left join s_community_member cm on t.community_id = cm.community_id and cm.member_type_cd = '390001200002' and cm.status_cd = '0'
        left join s_store s on cm.member_id = s.store_id and s.status_cd = '0'
        left join t_dict td on t.state = td.status_cd and td.table_name = 's_community' and td.table_columns = 'state'
        where t.status_cd = '0'
        <if test="address !=null and address != ''">
            and t.address= #{address}
        </if>
        <if test="nearbyLandmarks !=null and nearbyLandmarks != ''">
            and t.nearby_landmarks= #{nearbyLandmarks}
        </if>
        <if test="cityCode !=null and cityCode != ''">
            and t.city_code= #{cityCode}
        </if>
        <if test="name !=null and name != ''">
            and t.name like concat('%',#{name},'%')
        </if>
        <!--<if test="nameLike !=null and nameLike != ''">
            and t.name like concat('%',#{nameLike},'%')
        </if>-->
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="communityIds !=null">
            and t.community_id in
            <foreach collection="communityIds" item="item" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="bId !=null and bId != ''">
            and t.b_id= #{bId}
        </if>
        <if test="mapY !=null and mapY != ''">
            and t.map_y= #{mapY}
        </if>
        <if test="mapX !=null and mapX != ''">
            and t.map_x= #{mapX}
        </if>
        <if test="state !=null and state != ''">
            and t.state= #{state}
        </if>
        <if test="memberId !=null and memberId !=''">
            and cm.community_id = t.community_id
            and cm.member_id = #{memberId}
            and cm.status_cd = '0'
        </if>
        <if test="memberId !=null and memberId !='' and auditStatusCd != null and auditStatusCd !=''">
            and cm.audit_status_cd = #{auditStatusCd}
        </if>
        <if test="notInCommunityId != null ">
            and t.community_id not in
            <foreach collection="notInCommunityId" item="item" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <!--group by t.community_id-->
        order by t.create_time desc
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>
    </select>
 
    <!-- 查询小区数量 add by wuxw 2018-07-03 -->
    <select id="queryCommunitysCount" parameterType="Map" resultType="Map">
        select count(1) count
        from s_community t
        left join city_area ca on t.city_code = ca.area_code and ca.status_cd = '0'
        left join s_community_member cm on t.community_id = cm.community_id and cm.member_type_cd = '390001200002' and cm.status_cd = '0'
        left join s_store s on cm.member_id = s.store_id and s.status_cd = '0'
        left join t_dict td on t.state = td.status_cd and td.table_name = 's_community' and td.table_columns = 'state'
        where t.status_cd = '0'
        <if test="address !=null and address != ''">
            and t.address= #{address}
        </if>
        <if test="nearbyLandmarks !=null and nearbyLandmarks != ''">
            and t.nearby_landmarks= #{nearbyLandmarks}
        </if>
        <if test="cityCode !=null and cityCode != ''">
            and t.city_code= #{cityCode}
        </if>
        <if test="name !=null and name != ''">
            and t.name like concat('%',#{name},'%')
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="communityIds !=null">
            and t.community_id in
            <foreach collection="communityIds" item="item" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="bId !=null and bId != ''">
            and t.b_id= #{bId}
        </if>
        <if test="mapY !=null and mapY != ''">
            and t.map_y= #{mapY}
        </if>
        <if test="mapX !=null and mapX != ''">
            and t.map_x= #{mapX}
        </if>
        <if test="state !=null and state != ''">
            and t.state= #{state}
        </if>
        <if test="memberId !=null and memberId !=''">
            and cm.community_id = t.community_id
            and cm.member_id = #{memberId}
            and cm.status_cd = '0'
        </if>
        <if test="memberId !=null and memberId !='' and auditStatusCd != null and auditStatusCd !=''">
            and cm.audit_status_cd = #{auditStatusCd}
        </if>
        <if test="notInCommunityId != null ">
            and t.community_id not in
            <foreach collection="notInCommunityId" item="item" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
    </select>
 
    <!-- 查询商户小区 -->
    <select id="getStoreCommunitys" parameterType="Map" resultType="Map">
        SELECT
        sc.`community_id` communityId,
        sc.`name`,
        sc.`address`,
        sc.`nearby_landmarks` nearbyLandmarks,
        sc.`city_code` cityCode,
        sc.`map_x` mapX,
        sc.`map_y` mapY,
        sc.tel,
        scm.`community_member_id` communityMemberId,
        scm.`member_id` memberId,
        scm.`member_type_cd` memberTypeCd,
        scm.audit_status_cd auditStatusCd,
        scm.`status_cd` statusCd,
        scm.`start_time` startTime,
        scm.`end_time` endTime,
        ca.area_name areaName,
        ca.parent_area_name cityName,
        ca1.parent_area_name provName,
        sc.community_area communityArea,
        sc.qr_code qrCode,
        sc.take_time takeTime,
        sc.out_time outTime
        FROM
        s_community sc,
        s_community_member scm,
        city_area ca,
        city_area ca1
        WHERE
        sc.`community_id` = scm.`community_id`
        AND sc.`status_cd` = '0'
        and sc.city_code = ca.area_code
        and ca.parent_area_code = ca1.area_code
        AND scm.`member_id` = #{memberId}
        AND scm.`member_type_cd` = #{memberTypeCd}
        AND scm.`status_cd` = '0'
        <if test="auditStatusCd ==null or auditStatusCd ==''">
            and scm.audit_status_cd in ('1000', '1100','1200')
        </if>
        <if test="auditStatusCd !=null and auditStatusCd !=''">
            and scm.audit_status_cd = #{auditStatusCd}
        </if>
        <if test="communityId != null and communityId != ''">
            and sc.community_id = #{communityId}
        </if>
    </select>
    <select id="getCommunitys" resultType="com.java110.dto.community.CommunityDto">
        select `name` from s_community where status_cd = 0
    </select>
</mapper>