|
@@ -458,6 +458,7 @@
|
458
|
458
|
IFNULL( uu.uv_num, 0 ) AS uv_num,
|
459
|
459
|
IFNULL( aa.sk_num, 0 ) AS sk_num,
|
460
|
460
|
IFNULL( bbb.gk_num, 0 ) AS gk_num,
|
|
461
|
+ IFNULL( s.cj_num, 0 ) AS cj_num,
|
461
|
462
|
IFNULL( aa.sk_num, 0 ) + IFNULL( bbb.gk_num, 0 ) AS kh_num
|
462
|
463
|
FROM
|
463
|
464
|
ta_building t
|
|
@@ -528,6 +529,18 @@
|
528
|
529
|
GROUP BY
|
529
|
530
|
u.be_uv
|
530
|
531
|
) uu ON uu.building_id = t.building_id
|
|
532
|
+ LEFT JOIN (
|
|
533
|
+ SELECT count( * ) AS cj_num,
|
|
534
|
+ building_id
|
|
535
|
+ FROM
|
|
536
|
+ xlk_customer_signatory WHERE type = 'signatory' AND org_id = #{orgId}
|
|
537
|
+ <if test="startDate != null">
|
|
538
|
+ and TO_DAYS(create_date) >= TO_DAYS(#{startDate})
|
|
539
|
+ </if>
|
|
540
|
+ <if test="endDate != null">
|
|
541
|
+ and TO_DAYS(create_date) <= TO_DAYS(#{endDate})
|
|
542
|
+ </if>
|
|
543
|
+ GROUP BY building_id ) s ON s.building_id = t.building_id
|
531
|
544
|
WHERE
|
532
|
545
|
t.org_id = #{orgId}
|
533
|
546
|
<if test="personBuildingList != null and personBuildingList.size > 0">
|
|
@@ -557,6 +570,7 @@
|
557
|
570
|
IFNULL( uu.uv_num, 0 ) AS uv_num,
|
558
|
571
|
IFNULL( aa.sk_num, 0 ) AS sk_num,
|
559
|
572
|
IFNULL( bbb.gk_num, 0 ) AS gk_num,
|
|
573
|
+ IFNULL( s.cj_num, 0 ) AS cj_num,
|
560
|
574
|
IFNULL( aa.sk_num, 0 ) + IFNULL( bbb.gk_num, 0 ) AS kh_num
|
561
|
575
|
FROM
|
562
|
576
|
ta_building t
|
|
@@ -627,6 +641,18 @@
|
627
|
641
|
GROUP BY
|
628
|
642
|
u.be_uv
|
629
|
643
|
) uu ON uu.building_id = t.building_id
|
|
644
|
+ LEFT JOIN (
|
|
645
|
+ SELECT count( * ) AS cj_num,
|
|
646
|
+ building_id
|
|
647
|
+ FROM
|
|
648
|
+ xlk_customer_signatory WHERE type = 'signatory' AND org_id = #{orgId}
|
|
649
|
+ <if test="startDate != null">
|
|
650
|
+ and TO_DAYS(create_date) >= TO_DAYS(#{startDate})
|
|
651
|
+ </if>
|
|
652
|
+ <if test="endDate != null">
|
|
653
|
+ and TO_DAYS(create_date) <= TO_DAYS(#{endDate})
|
|
654
|
+ </if>
|
|
655
|
+ GROUP BY building_id ) s ON s.building_id = t.building_id
|
630
|
656
|
WHERE
|
631
|
657
|
t.org_id = #{orgId}
|
632
|
658
|
<if test="personBuildingList != null and personBuildingList.size > 0">
|
|
@@ -635,6 +661,12 @@
|
635
|
661
|
#{personBuilding.buildingId}
|
636
|
662
|
</foreach>
|
637
|
663
|
</if>
|
|
664
|
+ <if test="institutionIds != null and institutionIds.size > 0">
|
|
665
|
+ AND t.institution_id in
|
|
666
|
+ <foreach collection="institutionIds" item="item" open="(" close=")" separator=",">
|
|
667
|
+ #{item}
|
|
668
|
+ </foreach>
|
|
669
|
+ </if>
|
638
|
670
|
<if test="buildingId != null and buildingId != '' ">
|
639
|
671
|
AND t.building_id = #{buildingId}
|
640
|
672
|
</if>
|