From 979ddae1450771e1546e7adca7ad9916f51215be Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期三, 05 二月 2025 19:10:30 +0800
Subject: [PATCH] 优化报表支持按时间段
---
java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml | 142 ++++++++++++++++++----------------------------
1 files changed, 56 insertions(+), 86 deletions(-)
diff --git a/java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml
index 48c3528..91032be 100755
--- a/java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml
@@ -1440,26 +1440,26 @@
<select id="queryOweFeeDetailCount" parameterType="Map" resultType="Map">
select count(1) count
from (
- select t.payer_obj_name objName,t.fee_name feeName,pf.end_time feeCreateTime,t.create_time
- createTime,SUM(t.amount_owed) oweAmount,max(t.deadline_time) deadlineTime
- from report_owe_fee t
- inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
- left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
- left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
- left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
- inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
+ select t.obj_name objName,t.fee_name feeName,t.owner_name ownerName,t.link ownerTel,br.built_up_area builtUpArea,
+ MIN(t.cur_month_time) startTime,MAX(t.cur_month_time) endTime,max(t.deadline_time) deadlineTime,SUM(t.receivable_amount) oweAmount
+ from pay_fee_detail_month t
+ left join building_room br on t.obj_id = br.room_id and br.status_cd = '0'
where 1=1
- <if test="roomNum !=null and roomNum != ''">
- and br.room_num= #{roomNum}
+ and t.detail_id = '-1'
+ <if test="communityId !=null and communityId != ''">
+ and t.community_id= #{communityId}
</if>
- <if test="unitId !=null and unitId != ''">
- and bu.unit_id= #{unitId}
+ <if test="startTime !=null and startTime != ''">
+ and t.cur_month_time >= #{startTime}
</if>
- <if test="floorId !=null and floorId != ''">
- and f.floor_id = #{floorId}
+ <if test="endTime !=null and endTime != ''">
+ and t.cur_month_time < #{endTime}
</if>
<if test="objName !=null and objName != ''">
- and t.payer_obj_name= #{objName}
+ and t.obj_name= #{objName}
+ </if>
+ <if test="floorId !=null and floorId != ''">
+ and t.obj_fpc_id = #{floorId}
</if>
<if test="feeId !=null and feeId != ''">
and t.fee_id= #{feeId}
@@ -1468,56 +1468,40 @@
and t.config_id= #{configId}
</if>
<if test="objId !=null and objId != ''">
- and t.payer_obj_id= #{objId}
+ and t.obj_id= #{objId}
</if>
<if test="feeName !=null and feeName != ''">
and t.fee_name= #{feeName}
</if>
- <if test="communityId !=null and communityId != ''">
- and t.community_id= #{communityId}
+ <if test="feeTypeCd != null and feeTypeCd != ''">
+ and t.fee_type_cd = #{feeTypeCd}
</if>
- <if test="startTime !=null and startTime != ''">
- and t.end_time >= #{startTime}
- </if>
- <if test="endTime !=null and endTime != ''">
- and t.end_time <= #{endTime}
- </if>
- and t.amount_owed != 0 and pf.end_time < now()
- group by t.payer_obj_name ,t.fee_name ,pf.end_time ,t.create_time
- HAVING oweAmount != 0
+ group by t.obj_name ,t.fee_name ,t.owner_name ,t.link ,br.built_up_area
) t
</select>
<!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
<select id="queryOweFeeDetail" parameterType="Map" resultType="Map">
- select t.payer_obj_name objName,t.fee_name feeName,pf.end_time feeCreateTime,t.update_time updateTime,
- t.owner_name ownerName,t.owner_tel ownerTel,br.built_up_area builtUpArea ,SUM(t.amount_owed) oweAmount,max(t.deadline_time)
- deadlineTime
- from report_owe_fee t
- inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
- left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
- left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
- left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
- inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
- left join pay_fee_attrs pfa on pf.fee_id = pfa.fee_id and pfa.spec_cd = '390008' and pfa.status_cd ='0'
+ select t.obj_name objName,t.fee_name feeName,t.owner_name ownerName,t.link ownerTel,br.built_up_area builtUpArea,
+ MIN(t.cur_month_time) startTime,MAX(t.cur_month_time) endTime,max(t.deadline_time) deadlineTime,SUM(t.receivable_amount) oweAmount
+ from pay_fee_detail_month t
+ left join building_room br on t.obj_id = br.room_id and br.status_cd = '0'
where 1=1
- <if test="roomNum !=null and roomNum != ''">
- and br.room_num= #{roomNum}
+ and t.detail_id = '-1'
+ <if test="communityId !=null and communityId != ''">
+ and t.community_id= #{communityId}
</if>
- <if test="unitId !=null and unitId != ''">
- and bu.unit_id= #{unitId}
+ <if test="startTime !=null and startTime != ''">
+ and t.cur_month_time >= #{startTime}
</if>
- <if test="unitNum !=null and unitNum != ''">
- and bu.unit_num= #{unitNum}
- </if>
- <if test="floorId !=null and floorId != ''">
- and f.floor_id = #{floorId}
- </if>
- <if test="floorNum !=null and floorNum != ''">
- and f.floor_num = #{floorNum}
+ <if test="endTime !=null and endTime != ''">
+ and t.cur_month_time < #{endTime}
</if>
<if test="objName !=null and objName != ''">
- and t.payer_obj_name= #{objName}
+ and t.obj_name= #{objName}
+ </if>
+ <if test="floorId !=null and floorId != ''">
+ and t.obj_fpc_id = #{floorId}
</if>
<if test="feeId !=null and feeId != ''">
and t.fee_id= #{feeId}
@@ -1526,24 +1510,16 @@
and t.config_id= #{configId}
</if>
<if test="objId !=null and objId != ''">
- and t.payer_obj_id= #{objId}
+ and t.obj_id= #{objId}
</if>
<if test="feeName !=null and feeName != ''">
and t.fee_name= #{feeName}
</if>
- <if test="communityId !=null and communityId != ''">
- and t.community_id= #{communityId}
+ <if test="feeTypeCd != null and feeTypeCd != ''">
+ and t.fee_type_cd = #{feeTypeCd}
</if>
- <if test="startTime !=null and startTime != ''">
- and t.end_time >= #{startTime}
- </if>
- <if test="endTime !=null and endTime != ''">
- and t.end_time <= #{endTime}
- </if>
- and t.amount_owed != 0 and pf.end_time < now()
- group by t.payer_obj_name ,t.fee_name ,pf.end_time ,t.update_time, t.owner_name ,t.owner_tel ,br.built_up_area
- HAVING oweAmount != 0
- order by t.payer_obj_name
+ group by t.obj_name ,t.fee_name ,t.owner_name ,t.link ,br.built_up_area
+ order by t.obj_name
<if test="page != -1 and page != null ">
limit #{page}, #{row}
</if>
@@ -1551,25 +1527,25 @@
<!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
<select id="queryOweFeeDetailMajor" parameterType="Map" resultType="Map">
- select SUM(t.amount_owed) oweAmount
- from report_owe_fee t
- inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
- left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
- left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
- left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
- inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
+ select SUM(t.receivable_amount) oweAmount
+ from pay_fee_detail_month t
+ left join building_room br on t.obj_id = br.room_id and br.status_cd = '0'
where 1=1
- <if test="roomNum !=null and roomNum != ''">
- and br.room_num= #{roomNum}
+ and t.detail_id = '-1'
+ <if test="communityId !=null and communityId != ''">
+ and t.community_id= #{communityId}
</if>
- <if test="unitId !=null and unitId != ''">
- and bu.unit_id= #{unitId}
+ <if test="startTime !=null and startTime != ''">
+ and t.cur_month_time >= #{startTime}
</if>
- <if test="floorId !=null and floorId != ''">
- and f.floor_id = #{floorId}
+ <if test="endTime !=null and endTime != ''">
+ and t.cur_month_time < #{endTime}
</if>
<if test="objName !=null and objName != ''">
- and t.payer_obj_name= #{objName}
+ and t.obj_name= #{objName}
+ </if>
+ <if test="floorId !=null and floorId != ''">
+ and t.obj_fpc_id = #{floorId}
</if>
<if test="feeId !=null and feeId != ''">
and t.fee_id= #{feeId}
@@ -1578,19 +1554,13 @@
and t.config_id= #{configId}
</if>
<if test="objId !=null and objId != ''">
- and t.payer_obj_id= #{objId}
+ and t.obj_id= #{objId}
</if>
<if test="feeName !=null and feeName != ''">
and t.fee_name= #{feeName}
</if>
- <if test="communityId !=null and communityId != ''">
- and t.community_id= #{communityId}
- </if>
- <if test="startTime !=null and startTime != ''">
- and t.end_time >= #{startTime}
- </if>
- <if test="endTime !=null and endTime != ''">
- and t.end_time <= #{endTime}
+ <if test="feeTypeCd != null and feeTypeCd != ''">
+ and t.fee_type_cd = #{feeTypeCd}
</if>
</select>
--
Gitblit v1.8.0