|
|
@@ -298,7 +298,9 @@
|
|
|
|
|
|
<!-- 查询欠费户数 -->
|
|
|
<select id="getOweRoomCount" parameterType="Map" resultType="Map">
|
|
|
- select count(DISTINCT t.payer_obj_id)
|
|
|
+ select count(1) oweRoomCount
|
|
|
+ from (
|
|
|
+ select t.payer_obj_id
|
|
|
from report_owe_fee t
|
|
|
left join building_room br on t.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'
|
|
|
@@ -335,97 +337,109 @@
|
|
|
<if test="feeTypeCd != null and feeTypeCd != ''">
|
|
|
and pfc.fee_type_cd = #{feeTypeCd}
|
|
|
</if>
|
|
|
+ group by a.payer_obj_id
|
|
|
+ ) a
|
|
|
</select>
|
|
|
|
|
|
<!-- 查询收费户数 -->
|
|
|
<select id="getFeeRoomCount" parameterType="Map" resultType="Map">
|
|
|
- select count(DISTINCT t.payer_obj_id)
|
|
|
- from report_owe_fee t
|
|
|
- left join building_room br on t.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'
|
|
|
- <if test="feeTypeCd != null and feeTypeCd != ''">
|
|
|
- left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
|
|
|
- </if>
|
|
|
- where
|
|
|
- 1=1
|
|
|
- and t.payer_obj_type = '3333'
|
|
|
- and t.community_id= #{communityId}
|
|
|
- and t.end_time < #{endDate}
|
|
|
- <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.payer_obj_name like concat('%',#{objName},'%')
|
|
|
- </if>
|
|
|
- <if test="ownerName != null and ownerName != ''">
|
|
|
- and t.owner_name like concat('%',#{ownerName},'%')
|
|
|
- </if>
|
|
|
- <if test="link != null and link != ''">
|
|
|
- and t.owner_tel = #{link}
|
|
|
- </if>
|
|
|
- <if test="configIds !=null ">
|
|
|
- and t.config_id in
|
|
|
- <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="feeTypeCd != null and feeTypeCd != ''">
|
|
|
- and pfc.fee_type_cd = #{feeTypeCd}
|
|
|
- </if>
|
|
|
+ select count(1) feeRoomCount
|
|
|
+ from (
|
|
|
+ select t.payer_obj_id
|
|
|
+ from report_owe_fee t
|
|
|
+ left join building_room br on t.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'
|
|
|
+ <if test="feeTypeCd != null and feeTypeCd != ''">
|
|
|
+ left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
|
|
|
+ </if>
|
|
|
+ where
|
|
|
+ 1=1
|
|
|
+ and t.payer_obj_type = '3333'
|
|
|
+ and t.community_id= #{communityId}
|
|
|
+ and t.end_time < #{endDate}
|
|
|
+ <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.payer_obj_name like concat('%',#{objName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="ownerName != null and ownerName != ''">
|
|
|
+ and t.owner_name like concat('%',#{ownerName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="link != null and link != ''">
|
|
|
+ and t.owner_tel = #{link}
|
|
|
+ </if>
|
|
|
+ <if test="configIds !=null ">
|
|
|
+ and t.config_id in
|
|
|
+ <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="feeTypeCd != null and feeTypeCd != ''">
|
|
|
+ and pfc.fee_type_cd = #{feeTypeCd}
|
|
|
+ </if>
|
|
|
+ group by t.payer_obj_id
|
|
|
+ ) a
|
|
|
</select>
|
|
|
|
|
|
|
|
|
<select id="getFloorFeeSummary" parameterType="Map" resultType="Map">
|
|
|
select a.floor_id floorId,a.floor_num floorNum,a.name floorName,
|
|
|
(
|
|
|
- select count(DISTINCT t.payer_obj_id)
|
|
|
- from report_owe_fee t
|
|
|
- left join building_room br on t.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'
|
|
|
- <if test="feeTypeCd != null and feeTypeCd != ''">
|
|
|
- left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
|
|
|
- </if>
|
|
|
- where
|
|
|
- 1=1
|
|
|
- and t.payer_obj_type = '3333'
|
|
|
- and t.community_id= a.community_id
|
|
|
- and t.end_time <= #{endDate}
|
|
|
- and t.amount_owed != 0
|
|
|
- <if test="configIds !=null ">
|
|
|
- and t.config_id in
|
|
|
- <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="feeTypeCd != null and feeTypeCd != ''">
|
|
|
- and pfc.fee_type_cd = #{feeTypeCd}
|
|
|
- </if>
|
|
|
- and bu.floor_id = a.floor_id
|
|
|
+ select count(1) from (
|
|
|
+ select bu.floor_id,t.payer_obj_id
|
|
|
+ from report_owe_fee t
|
|
|
+ left join building_room br on t.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'
|
|
|
+ <if test="feeTypeCd != null and feeTypeCd != ''">
|
|
|
+ left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
|
|
|
+ </if>
|
|
|
+ where
|
|
|
+ 1=1
|
|
|
+ and t.payer_obj_type = '3333'
|
|
|
+ and t.community_id= #{communityId}
|
|
|
+ and t.end_time <= #{endDate}
|
|
|
+ and t.amount_owed != 0
|
|
|
+ <if test="configIds !=null ">
|
|
|
+ and t.config_id in
|
|
|
+ <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="feeTypeCd != null and feeTypeCd != ''">
|
|
|
+ and pfc.fee_type_cd = #{feeTypeCd}
|
|
|
+ </if>
|
|
|
+ group by bu.floor_id,t.payer_obj_id
|
|
|
+ ) b
|
|
|
+ where b.floor_id = a.floor_id
|
|
|
) oweRoomCount,
|
|
|
(
|
|
|
- select count(DISTINCT t.payer_obj_id)
|
|
|
- from report_owe_fee t
|
|
|
- inner join pay_fee pf on pf.fee_id = t.fee_id and pf.status_cd = '0' and pf.state = '2008001'
|
|
|
- left join building_room br on t.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 t.payer_obj_type = '3333'
|
|
|
- and t.community_id= a.community_id
|
|
|
- and t.end_time <= #{endDate}
|
|
|
- <if test="configIds !=null ">
|
|
|
- and t.config_id in
|
|
|
- <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="feeTypeCd != null and feeTypeCd != ''">
|
|
|
- and pf.fee_type_cd = #{feeTypeCd}
|
|
|
- </if>
|
|
|
- and bu.floor_id = a.floor_id
|
|
|
+ select count(1) from (
|
|
|
+ select bu.floor_id,t.payer_obj_id
|
|
|
+ from report_owe_fee t
|
|
|
+ inner join pay_fee pf on pf.fee_id = t.fee_id and pf.status_cd = '0' and pf.state = '2008001'
|
|
|
+ left join building_room br on t.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 t.payer_obj_type = '3333'
|
|
|
+ and t.community_id= #{communityId}
|
|
|
+ and t.end_time <= #{endDate}
|
|
|
+ <if test="configIds !=null ">
|
|
|
+ and t.config_id in
|
|
|
+ <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="feeTypeCd != null and feeTypeCd != ''">
|
|
|
+ and pf.fee_type_cd = #{feeTypeCd}
|
|
|
+ </if>
|
|
|
+ group by bu.floor_id,t.payer_obj_id
|
|
|
+ ) b
|
|
|
+ where b.floor_id = a.floor_id
|
|
|
) feeRoomCount,
|
|
|
(
|
|
|
select ifnull(sum(t.received_amount),0.0) receivedFee
|
|
|
@@ -579,30 +593,34 @@
|
|
|
<select id="getConfigFeeSummary" parameterType="Map" resultType="Map">
|
|
|
select a.name,
|
|
|
(
|
|
|
- select count(DISTINCT t.payer_obj_id)
|
|
|
- from report_owe_fee t
|
|
|
- left join building_room br on t.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'
|
|
|
- left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
|
|
|
- where
|
|
|
- 1=1
|
|
|
- and t.payer_obj_type = '3333'
|
|
|
- and t.community_id= a.community_id
|
|
|
- and t.end_time <= #{endDate}
|
|
|
- and t.amount_owed != 0
|
|
|
- <if test="configIds !=null ">
|
|
|
- and t.config_id in
|
|
|
- <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="feeTypeCd != null and feeTypeCd != ''">
|
|
|
- and pfc.fee_type_cd = #{feeTypeCd}
|
|
|
- </if>
|
|
|
- and pfc.fee_type_cd = a.status_cd
|
|
|
+ select count(1) from (
|
|
|
+ select pfc.fee_type_cd,t.payer_obj_id
|
|
|
+ from report_owe_fee t
|
|
|
+ left join building_room br on t.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'
|
|
|
+ left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
|
|
|
+ where
|
|
|
+ 1=1
|
|
|
+ and t.payer_obj_type = '3333'
|
|
|
+ and t.community_id= #{communityId}
|
|
|
+ and t.end_time <= #{endDate}
|
|
|
+ and t.amount_owed != 0
|
|
|
+ <if test="configIds !=null ">
|
|
|
+ and t.config_id in
|
|
|
+ <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="feeTypeCd != null and feeTypeCd != ''">
|
|
|
+ and pfc.fee_type_cd = #{feeTypeCd}
|
|
|
+ </if>
|
|
|
+ group by pfc.fee_type_cd,t.payer_obj_id
|
|
|
+ ) b
|
|
|
+ where b.fee_type_cd = a.status_cd
|
|
|
) oweRoomCount,
|
|
|
(
|
|
|
- select count(DISTINCT t.payer_obj_id)
|
|
|
+ select count(1) from (
|
|
|
+ select pf.fee_type_cd,t.payer_obj_id
|
|
|
from report_owe_fee t
|
|
|
inner join pay_fee pf on pf.fee_id = t.fee_id and pf.status_cd = '0' and pf.state = '2008001'
|
|
|
left join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0'
|
|
|
@@ -610,7 +628,7 @@
|
|
|
where
|
|
|
1=1
|
|
|
and t.payer_obj_type = '3333'
|
|
|
- and t.community_id= a.community_id
|
|
|
+ and t.community_id= #{communityId}
|
|
|
and t.end_time <= #{endDate}
|
|
|
<if test="configIds !=null ">
|
|
|
and t.config_id in
|
|
|
@@ -621,7 +639,9 @@
|
|
|
<if test="feeTypeCd != null and feeTypeCd != ''">
|
|
|
and pf.fee_type_cd = #{feeTypeCd}
|
|
|
</if>
|
|
|
- and pf.fee_type_cd = a.status_cd
|
|
|
+ group by pf.fee_type_cd,t.payer_obj_id
|
|
|
+ ) b
|
|
|
+ where b.fee_type_cd = a.status_cd
|
|
|
) feeRoomCount,
|
|
|
(
|
|
|
select ifnull(sum(t.received_amount),0.0) receivedFee
|
|
|
@@ -785,15 +805,20 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="getObjFeeSummaryCount" parameterType="Map" resultType="Map">
|
|
|
- select count(DISTINCT t.payer_obj_id) feeRoomCount
|
|
|
- from report_owe_fee t
|
|
|
- inner join pay_fee pf on pf.fee_id = t.fee_id and pf.status_cd = '0' and pf.state = '2008001'
|
|
|
- left join building_room br on t.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 t.payer_obj_type = '3333'
|
|
|
- and t.community_id= #{communityId}
|
|
|
+ select count(1) feeRoomCount
|
|
|
+ from
|
|
|
+ (
|
|
|
+ select t.payer_ob_id
|
|
|
+ from report_owe_fee t
|
|
|
+ inner join pay_fee pf on pf.fee_id = t.fee_id and pf.status_cd = '0' and pf.state = '2008001'
|
|
|
+ left join building_room br on t.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 t.payer_obj_type = '3333'
|
|
|
+ and t.community_id= #{communityId}
|
|
|
+ group by a.payer_ob_id
|
|
|
+ ) b
|
|
|
</select>
|
|
|
<!-- 查询房屋费用明细表-->
|
|
|
<select id="getObjFeeSummary" parameterType="Map" resultType="Map">
|
|
|
@@ -1061,31 +1086,37 @@
|
|
|
and bu.floor_id = a.floor_id
|
|
|
) roomCount,
|
|
|
(
|
|
|
- select count(DISTINCT t.payer_obj_id)
|
|
|
- from report_owe_fee t
|
|
|
- inner join pay_fee pf on pf.fee_id = t.fee_id and pf.status_cd = '0' and pf.state = '2008001'
|
|
|
- left join building_room br on t.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 t.payer_obj_type = '3333'
|
|
|
- and t.community_id= #{communityId}
|
|
|
- and t.end_time < #{endDate}
|
|
|
- and bu.floor_id = a.floor_id
|
|
|
+ select count(1) from (
|
|
|
+ select bu.floor_id,br.room_id
|
|
|
+ from report_owe_fee t
|
|
|
+ inner join pay_fee pf on pf.fee_id = t.fee_id and pf.status_cd = '0' and pf.state = '2008001'
|
|
|
+ left join building_room br on t.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 t.payer_obj_type = '3333'
|
|
|
+ and t.community_id= #{communityId}
|
|
|
+ and t.end_time < #{endDate}
|
|
|
+ group by bu.floor_id,br.room_id
|
|
|
+ ) b
|
|
|
+ where b.floor_id = a.floor_id
|
|
|
) feeRoomCount,
|
|
|
(
|
|
|
- select count(DISTINCT t.payer_obj_id)
|
|
|
- from report_owe_fee t
|
|
|
- left join building_room br on t.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'
|
|
|
- left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
|
|
|
- where
|
|
|
- 1=1
|
|
|
- and t.payer_obj_type = '3333'
|
|
|
- and t.community_id= #{communityId}
|
|
|
- and t.end_time < #{endDate}
|
|
|
- and t.amount_owed != 0
|
|
|
- and bu.floor_id = a.floor_id
|
|
|
+ select count(1) from (
|
|
|
+ select bu.floor_id,br.room_id
|
|
|
+ from report_owe_fee t
|
|
|
+ left join building_room br on t.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'
|
|
|
+ left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
|
|
|
+ where
|
|
|
+ 1=1
|
|
|
+ and t.payer_obj_type = '3333'
|
|
|
+ and t.community_id= #{communityId}
|
|
|
+ and t.end_time < #{endDate}
|
|
|
+ and t.amount_owed != 0
|
|
|
+ group by bu.floor_id,br.room_id
|
|
|
+ ) b
|
|
|
+ where b.floor_id = a.floor_id
|
|
|
) oweRoomCount,
|
|
|
(
|
|
|
select ifnull(sum(t.amount_owed),0.0) oweFee
|