|
@@ -140,9 +140,11 @@
|
|
|
|
|
|
<select id="getPayfeeDetaileBill" resultType="com.bz.smart_city.dto.pay.payfee.PayfeeDetaileBill">
|
|
|
select
|
|
|
- IFNULL(sum(r.debt),0) debt ,
|
|
|
- IFNULL(sum(r.debt),0)-IFNULL(max(remaining ),0) as "receivableFee",
|
|
|
- IFNULL(max(remaining),0)-IFNULL(sum(r.debt),0) as "waterFee"
|
|
|
+ IFNULL(sum(r.debt),0) debt ,
|
|
|
+ case when (IFNULL(sum(r.debt),0)-IFNULL(max(remaining ),0)) <=0 then 0
|
|
|
+ else (IFNULL(sum(r.debt),0)-IFNULL(max(remaining ),0) )end as "receivableFee",
|
|
|
+ case when (IFNULL(max(remaining),0)-IFNULL(sum(r.debt),0)) <=0 then 0
|
|
|
+ else (IFNULL(max(remaining),0)-IFNULL(sum(r.debt),0)) end as "waterFee"
|
|
|
from pay_pay_rechargeaccount a
|
|
|
left join pay_pay_receivable r on a.account_id=r.account_id
|
|
|
where a.account_id = #{accountId}
|
|
@@ -150,17 +152,17 @@
|
|
|
|
|
|
<select id="getPayfeeDetailed" resultType="com.bz.smart_city.dto.pay.payfee.PayfeeDetailed">
|
|
|
select
|
|
|
- account_id as "acountID",
|
|
|
- sum(case when feetype=1 then debt else 0 end) waterFee1,
|
|
|
- sum(case when feetype=2 then debt else 0 end) waterFee2,
|
|
|
- sum(case when feetype=3 then debt else 0 end) waterFee3,
|
|
|
- sum(case when feetype=4 then debt else 0 end) waterFee4,
|
|
|
- sum(case when feetype=5 then debt else 0 end) waterFee5,
|
|
|
- sum(case when feetype=6 then debt else 0 end) waterFee6
|
|
|
- from pay_pay_receivable
|
|
|
- where debt>0
|
|
|
- and account_id=#{accountId}
|
|
|
- group by account_id
|
|
|
+ r.account_id as "acountID",
|
|
|
+ IFNULL(sum(case when r.feetype=1 then r.debt else 0 end),0) waterFee1,
|
|
|
+ IFNULL(sum(case when r.feetype=2 then r.debt else 0 end),0) waterFee2,
|
|
|
+ IFNULL(sum(case when r.feetype=3 then r.debt else 0 end),0) waterFee3,
|
|
|
+ IFNULL(sum(case when r.feetype=4 then r.debt else 0 end),0) waterFee4,
|
|
|
+ IFNULL(sum(case when r.feetype=5 then r.debt else 0 end),0) waterFee5,
|
|
|
+ IFNULL(sum(case when r.feetype=6 then r.debt else 0 end),0) waterFee6
|
|
|
+ from pay_pay_rechargeaccount a
|
|
|
+ left join pay_pay_receivable r on a.account_id=r.account_id
|
|
|
+ where a.account_id=#{accountId}
|
|
|
+ group by a.account_id
|
|
|
</select>
|
|
|
|
|
|
<select id="getPayreceivableDebt" resultType="com.bz.smart_city.dto.pay.payfee.PayfeeReceivableInfo">
|