From 48c5afcf5ef7a2c1f73851104d904884952da755 Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: 星期四, 01 六月 2023 13:36:42 +0800
Subject: [PATCH] 优化 欠费明细表

---
 java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml |   80 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 80 insertions(+), 0 deletions(-)

diff --git a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml
index 0ec113b..3e9ce4b 100644
--- a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml
@@ -964,4 +964,84 @@
         and t.create_time &lt; #{endDate}
         group by td.status_cd,td.`name`
     </select>
+
+    <!-- 鎸夋ゼ鏍嬬粺璁℃瑺璐� -->
+    <select id="getOweFeeByFloor" parameterType="Map" resultType="Map">
+        select a.floor_id floorId,a.floor_num floorNum,a.name floorName,td.status_cd feeTypeCd,
+        (
+        select count(1)
+        from building_room br
+        left join building_unit bu on bu.unit_id = br.unit_id and bu.status_cd = '0'
+        where
+        1=1
+        and a.status_cd = '0'
+        and br.status_cd = '0'
+        and bu.floor_id = a.floor_id
+        ) roomCount,
+        (
+        select count(1) from (
+        select bu.floor_id,br.room_id
+        from building_room br
+        INNER JOIN pay_fee pf on br.room_id = pf.payer_obj_id and pf.payer_obj_type = '3333' and pf.status_cd = '0'
+        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+        where
+        1=1
+        and br.status_cd = '0'
+        and br.community_id= #{communityId}
+        group by bu.floor_id,br.room_id
+        ) b
+        where b.floor_id = a.floor_id
+        ) feeRoomCount,
+        (
+        select count(1) from (
+        select bu.floor_id,br.room_id
+        from building_room br
+        INNER JOIN pay_fee_detail_month pf on br.room_id = pf.obj_id and pf.status_cd = '0'
+        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+        where
+        1=1
+        and br.status_cd = '0'
+        and br.community_id= #{communityId}
+        and pf.detail_id = '-1'
+        and pf.cur_month_time &lt; #{endDate}
+        group by bu.floor_id,br.room_id
+        ) b
+        where b.floor_id = a.floor_id
+        ) oweRoomCount,
+        (
+        select ifnull(sum(t.received_amount),0.0) oweFee
+        from pay_fee_detail_month t
+        INNER JOIN pay_fee pf1 on t.fee_id = pf1.fee_id and pf1.payer_obj_type='3333' and pf1.status_cd = '0'
+        LEFT JOIN building_room br on pf1.payer_obj_id = br.room_id and br.status_cd = '0'
+        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+        where
+        1=1
+        and bu.floor_id = a.floor_id
+        and t.status_cd = '0'
+        and t.community_id = #{communityId}
+        and t.detail_id = '-1'
+        and t.cur_month_time &lt; #{endDate}
+        and pf1.fee_type_cd = td.status_cd
+        ) oweFee
+        from f_floor a
+        left join t_dict td on td.table_name='pay_fee_config' and td.table_columns = 'fee_type_cd_show'
+        where 1=1
+        and a.status_cd = '0'
+        and a.community_id = #{communityId}
+        order by a.seq
+    </select>
+
+    <!-- 瀵硅薄娆犺垂 -->
+    <select id="getObjOweFee" parameterType="Map" resultType="Map">
+        select t.payer_obj_id payerObjId, pf.fee_type_cd feeTypeCd,t.fee_name feeName,t.end_time endTime,t.deadline_time deadlineTime,t.amount_owed amountOwed
+        from report_owe_fee t
+        left join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        where t.amount_owed > 0
+        and t.payer_obj_type = '3333'
+        and t.community_id = #{communityId}
+        and t.payer_obj_id in
+        <foreach collection="objIds" item="item" index="index" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+    </select>
 </mapper>

--
Gitblit v1.8.0