| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="reportFeeStatisticsServiceDaoImpl">
- <!-- 查询历史欠费 -->
- <select id="getHisMonthOweFee" parameterType="Map" resultType="Map">
- 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>
- <if test="ownerName != null and ownerName != ''">
- and t.owner_name like concat('%',#{ownerName},'%')
- </if>
- <if test="link != null and link != ''">
- and t.link = #{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 pf.fee_type_cd = #{feeTypeCd}
- </if>
- and t.status_cd = '0'
- and t.community_id= #{communityId}
- and t.cur_month_time < #{startDate}
- </select>
- <!-- 查询单月欠费 -->
- <select id="getCurMonthOweFee" parameterType="Map" resultType="Map">
- 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>
- <if test="ownerName != null and ownerName != ''">
- and t.owner_name like concat('%',#{ownerName},'%')
- </if>
- <if test="link != null and link != ''">
- and t.link = #{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 pf.fee_type_cd = #{feeTypeCd}
- </if>
- and t.status_cd = '0'
- and t.community_id= #{communityId}
- and t.cur_month_time > #{startDate}
- and t.cur_month_time < #{endDate}
- </select>
- <!-- 查询当月应收 -->
- <select id="getCurReceivableFee" parameterType="Map" resultType="Map">
- select ifnull(sum(t.receivable_amount),0.0) curReceivableFee
- 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>
- <if test="ownerName != null and ownerName != ''">
- and t.owner_name like concat('%',#{ownerName},'%')
- </if>
- <if test="link != null and link != ''">
- and t.link = #{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 pf.fee_type_cd = #{feeTypeCd}
- </if>
- and t.status_cd = '0'
- and t.community_id= #{communityId}
- and t.cur_month_time > #{startDate}
- and t.cur_month_time < #{endDate}
- </select>
- <!-- 查询欠费追回 -->
- <select id="getHisReceivedFee" parameterType="Map" resultType="Map">
- 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'
- <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>
- <if test="ownerName != null and ownerName != ''">
- and t.owner_name like concat('%',#{ownerName},'%')
- </if>
- <if test="link != null and link != ''">
- and t.link = #{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 pf.fee_type_cd = #{feeTypeCd}
- </if>
- and t.status_cd = '0'
- and t.community_id= #{communityId}
- and t.pay_fee_time > #{startDate}
- and t.pay_fee_time < #{endDate}
- and t.cur_month_time < #{startDate}
- </select>
- <!-- 查询 预交费用 -->
- <select id="getPreReceivedFee" parameterType="Map" resultType="Map">
- 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'
- <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>
- <if test="ownerName != null and ownerName != ''">
- and t.owner_name like concat('%',#{ownerName},'%')
- </if>
- <if test="link != null and link != ''">
- and t.link = #{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 pf.fee_type_cd = #{feeTypeCd}
- </if>
- and t.status_cd = '0'
- and t.community_id= #{communityId}
- and t.pay_fee_time > #{startDate}
- and t.pay_fee_time < #{endDate}
- and t.cur_month_time > #{endDate}
- </select>
- <!-- 查询实收费用 -->
- <select id="getReceivedFee" parameterType="Map" resultType="Map">
- 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'
- <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>
- <if test="ownerName != null and ownerName != ''">
- and t.owner_name like concat('%',#{ownerName},'%')
- </if>
- <if test="link != null and link != ''">
- and t.link = #{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 pf.fee_type_cd = #{feeTypeCd}
- </if>
- and t.status_cd = '0'
- and t.community_id= #{communityId}
- and t.pay_fee_time > #{startDate}
- and t.pay_fee_time < #{endDate}
- </select>
- <!-- 查询欠费户数 -->
- <select id="getOweRoomCount" parameterType="Map" resultType="Map">
- select count(1) oweRoomCount
- from
- (
- 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'
- <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>
- <if test="ownerName != null and ownerName != ''">
- and t.owner_name like concat('%',#{ownerName},'%')
- </if>
- <if test="link != null and link != ''">
- and t.link = #{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 pf.fee_type_cd = #{feeTypeCd}
- </if>
- and t.status_cd = '0'
- and pf.payer_obj_type = '3333'
- and t.community_id= #{communityId}
- and t.cur_month_time < #{endDate}
- and (t.receivable_amount - t.received_amount - t.discount_amount) > 0
- group by t.obj_id
- ) a
- </select>
- </mapper>
|