From b87cfce785e4c177ce9956a19e94e2f49dd9c995 Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: 星期二, 16 五月 2023 00:53:16 +0800
Subject: [PATCH] 优化定时任务手工测试

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

diff --git a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml
index 073be24..02c359f 100644
--- a/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml
@@ -9,8 +9,21 @@
         select ifnull(sum(t.receivable_amount - t.received_amount - t.discount_amount),0.0) hisOweFee
         from pay_fee_detail_month t
         INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        <if test="floorId != null and floorId != ''">
+            LEFT JOIN building_room br on t.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'
+        </if>
         where
         1=1
+        <if test="floorId != null and floorId != ''">
+            and bu.floor_id = #{floorId}
+        </if>
+        <if test="configId != null and configId != ''">
+            and t.config_id = #{configId}
+        </if>
+        <if test="objName != null and objName != ''">
+            and t.obj_name like concat('%',#{objName},'%')
+        </if>
         and t.status_cd = '0'
         and t.community_id= #{communityId}
         and t.cur_month_time &lt; #{startDate}
@@ -21,8 +34,21 @@
         select ifnull(sum(t.receivable_amount - t.received_amount - t.discount_amount),0.0) curOweFee
         from pay_fee_detail_month t
         INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        <if test="floorId != null and floorId != ''">
+            LEFT JOIN building_room br on t.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'
+        </if>
         where
         1=1
+        <if test="floorId != null and floorId != ''">
+            and bu.floor_id = #{floorId}
+        </if>
+        <if test="configId != null and configId != ''">
+            and t.config_id = #{configId}
+        </if>
+        <if test="objName != null and objName != ''">
+            and t.obj_name like concat('%',#{objName},'%')
+        </if>
         and t.status_cd = '0'
         and t.community_id= #{communityId}
         and t.cur_month_time &gt; #{startDate}
@@ -34,7 +60,22 @@
         select ifnull(sum(t.received_amount),0.0) hisReceivedFee
         from pay_fee_detail_month t
         INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
-        where t.status_cd = '0'
+        <if test="floorId != null and floorId != ''">
+            LEFT JOIN building_room br on t.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'
+        </if>
+        where
+        1=1
+        <if test="floorId != null and floorId != ''">
+            and bu.floor_id = #{floorId}
+        </if>
+        <if test="configId != null and configId != ''">
+            and t.config_id = #{configId}
+        </if>
+        <if test="objName != null and objName != ''">
+            and t.obj_name like concat('%',#{objName},'%')
+        </if>
+        and t.status_cd = '0'
         and t.community_id= #{communityId}
         and t.pay_fee_time &gt;  #{startDate}
         and t.pay_fee_time &lt; #{endDate}
@@ -46,7 +87,22 @@
         select ifnull(sum(t.received_amount),0.0) preReceivedFee
         from pay_fee_detail_month t
         INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
-        where t.status_cd = '0'
+        <if test="floorId != null and floorId != ''">
+            LEFT JOIN building_room br on t.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'
+        </if>
+        where
+        1=1
+        <if test="floorId != null and floorId != ''">
+            and bu.floor_id = #{floorId}
+        </if>
+        <if test="configId != null and configId != ''">
+            and t.config_id = #{configId}
+        </if>
+        <if test="objName != null and objName != ''">
+            and t.obj_name like concat('%',#{objName},'%')
+        </if>
+        and t.status_cd = '0'
         and t.community_id= #{communityId}
         and t.pay_fee_time &gt;  #{startDate}
         and t.pay_fee_time &lt; #{endDate}
@@ -58,7 +114,22 @@
         select ifnull(sum(t.received_amount),0.0) receivedFee
         from pay_fee_detail_month t
         INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
-        where t.status_cd = '0'
+        <if test="floorId != null and floorId != ''">
+            LEFT JOIN building_room br on t.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'
+        </if>
+        where
+        1=1
+        <if test="floorId != null and floorId != ''">
+            and bu.floor_id = #{floorId}
+        </if>
+        <if test="configId != null and configId != ''">
+            and t.config_id = #{configId}
+        </if>
+        <if test="objName != null and objName != ''">
+            and t.obj_name like concat('%',#{objName},'%')
+        </if>
+        and t.status_cd = '0'
         and t.community_id= #{communityId}
         and t.pay_fee_time &gt;  #{startDate}
         and t.pay_fee_time &lt; #{endDate}
@@ -71,7 +142,22 @@
         (
         select t.obj_id from pay_fee_detail_month t
         INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
-        where t.status_cd = '0'
+        <if test="floorId != null and floorId != ''">
+            LEFT JOIN building_room br on t.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'
+        </if>
+        where
+        1=1
+        <if test="floorId != null and floorId != ''">
+            and bu.floor_id = #{floorId}
+        </if>
+        <if test="configId != null and configId != ''">
+            and t.config_id = #{configId}
+        </if>
+        <if test="objName != null and objName != ''">
+            and t.obj_name like concat('%',#{objName},'%')
+        </if>
+        and t.status_cd = '0'
         and pf.payer_obj_type = '3333'
         and t.community_id= #{communityId}
         and t.cur_month_time &lt; #{endDate}

--
Gitblit v1.8.0