|
|
@@ -496,116 +496,82 @@ |
|
|
select bill.tenant_id tenantId,bill.merchant_id merchantId,m.name merchantName,bill.bill_type billType, |
|
|
select bill.tenant_id tenantId,bill.merchant_id merchantId,m.name merchantName,bill.bill_type billType, |
|
|
m.link_phone managerPhone,m.`link_person` manager,m.email, |
|
|
m.link_phone managerPhone,m.`link_person` manager,m.email, |
|
|
bill.receive_date receiveDate,DATEDIFF(now(),bill.receive_date) expiredDay,ws.building,ws.floor, |
|
|
bill.receive_date receiveDate,DATEDIFF(now(),bill.receive_date) expiredDay,ws.building,ws.floor, |
|
|
round(bill.rentOwe/100,2) rentOwe,round(bill.propertyOwe/100,2) propertyOwe, |
|
|
|
|
|
round(bill.depositOwe/100,2) depositOwe,round(bill.otherOwe/100,2) otherOwe, |
|
|
|
|
|
round((bill.rentOwe+bill.propertyOwe+bill.depositOwe+bill.otherOwe)/100,2) totalOwe |
|
|
|
|
|
|
|
|
round(bill.rentOwe/100,2) rentOwe, |
|
|
|
|
|
round(bill.propertyOwe/100,2) propertyOwe, |
|
|
|
|
|
round(bill.depositOwe/100,2) depositOwe, |
|
|
|
|
|
round(bill.otherOwe/100,2) otherOwe, |
|
|
|
|
|
round((bill.rentOwe+bill.propertyOwe+bill.depositOwe+bill.otherOwe)/100,2) totalOwe, |
|
|
|
|
|
|
|
|
|
|
|
<choose> |
|
|
|
|
|
<when test="1==filterHasPay"> |
|
|
|
|
|
round((bill.rentReceivePay-bill.rentPay)/100,2) rentReceivePay, |
|
|
|
|
|
round((bill.propertyReceivePay-bill.propertyPay)/100,2) propertyReceivePay, |
|
|
|
|
|
round((bill.depositReceivePay-bill.depositPay)/100,2) depositReceivePay, |
|
|
|
|
|
round((bill.otherReceivePay-bill.otherPay)/100,2) otherReceivePay, |
|
|
|
|
|
round((bill.rentReceivePay+bill.propertyReceivePay+bill.depositReceivePay+bill.otherReceivePay |
|
|
|
|
|
-bill.rentPay-bill.propertyPay-bill.depositPay-bill.otherPay)/100,2) totalReceivePay |
|
|
|
|
|
</when> |
|
|
|
|
|
<otherwise> |
|
|
|
|
|
round(bill.rentReceivePay/100,2) rentReceivePay, |
|
|
|
|
|
round(bill.propertyReceivePay/100,2) propertyReceivePay, |
|
|
|
|
|
round(bill.depositReceivePay/100,2) depositReceivePay, |
|
|
|
|
|
round(bill.otherReceivePay/100,2) otherReceivePay, |
|
|
|
|
|
round((bill.rentOwe+bill.propertyOwe+bill.depositOwe+bill.otherOwe)/100,2) totalReceivePay |
|
|
|
|
|
</otherwise> |
|
|
|
|
|
</choose> |
|
|
|
|
|
|
|
|
from ( |
|
|
from ( |
|
|
|
|
|
|
|
|
select oweList.*, |
|
|
select oweList.*, |
|
|
max(case oweList.bill_type when '租金' then oweList.owe else 0 end) rentOwe, |
|
|
max(case oweList.bill_type when '租金' then oweList.owe else 0 end) rentOwe, |
|
|
max(case oweList.bill_type when '物业费' then oweList.owe else 0 end) propertyOwe, |
|
|
max(case oweList.bill_type when '物业费' then oweList.owe else 0 end) propertyOwe, |
|
|
max(case oweList.bill_type when '欠缴押金' then oweList.owe else 0 end) depositOwe, |
|
|
max(case oweList.bill_type when '欠缴押金' then oweList.owe else 0 end) depositOwe, |
|
|
max(case oweList.bill_type when '其他费用' then oweList.owe else 0 end) otherOwe |
|
|
|
|
|
|
|
|
max(case oweList.bill_type when '其他费用' then oweList.owe else 0 end) otherOwe, |
|
|
|
|
|
|
|
|
|
|
|
max(case oweList.bill_type when '租金' then oweList.receive_pay else 0 end) rentReceivePay, |
|
|
|
|
|
max(case oweList.bill_type when '物业费' then oweList.receive_pay else 0 end) propertyReceivePay, |
|
|
|
|
|
max(case oweList.bill_type when '欠缴押金' then oweList.receive_pay else 0 end) depositReceivePay, |
|
|
|
|
|
max(case oweList.bill_type when '其他费用' then oweList.receive_pay else 0 end) otherReceivePay, |
|
|
|
|
|
|
|
|
|
|
|
max(case oweList.bill_type when '租金' then oweList.pay else 0 end) rentPay, |
|
|
|
|
|
max(case oweList.bill_type when '物业费' then oweList.pay else 0 end) propertyPay, |
|
|
|
|
|
max(case oweList.bill_type when '欠缴押金' then oweList.pay else 0 end) depositPay, |
|
|
|
|
|
max(case oweList.bill_type when '其他费用' then oweList.pay else 0 end) otherPay |
|
|
from( |
|
|
from( |
|
|
select bill.tenant_id,bill.merchant_id,bill.bill_type,sum(owe) owe,bill.receive_date,bill.expired_day from ( |
|
|
|
|
|
|
|
|
select bill.tenant_id,bill.merchant_id,bill.bill_type,sum(owe) owe,bill.receive_date,bill.expired_day,bill.receive_pay,bill.pay from ( |
|
|
|
|
|
|
|
|
select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' |
|
|
select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' |
|
|
bill_type,need_pay,receive_pay,pay, |
|
|
|
|
|
<choose> |
|
|
|
|
|
<when test="1==filterHasPay"> |
|
|
|
|
|
(receive_pay-pay) owe |
|
|
|
|
|
</when> |
|
|
|
|
|
<otherwise> |
|
|
|
|
|
owe |
|
|
|
|
|
</otherwise> |
|
|
|
|
|
</choose> |
|
|
|
|
|
,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' |
|
|
|
|
|
|
|
|
bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' |
|
|
endtime,rent_shop_type from wx_bill_rent where is_preview = 0 and status = #{status} and tenant_id = #{tenantId} |
|
|
endtime,rent_shop_type from wx_bill_rent where is_preview = 0 and status = #{status} and tenant_id = #{tenantId} |
|
|
union |
|
|
union |
|
|
select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' |
|
|
select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' |
|
|
bill_type,need_pay,receive_pay,pay, |
|
|
|
|
|
<choose> |
|
|
|
|
|
<when test="1==filterHasPay"> |
|
|
|
|
|
(receive_pay-pay) owe |
|
|
|
|
|
</when> |
|
|
|
|
|
<otherwise> |
|
|
|
|
|
owe |
|
|
|
|
|
</otherwise> |
|
|
|
|
|
</choose> |
|
|
|
|
|
,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' |
|
|
|
|
|
|
|
|
bill_type,need_pay,receive_pay,pay,(need_pay-pay),DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' |
|
|
endtime,rent_shop_type from wx_bill_property where is_preview = 0 and status = #{status} and tenant_id = #{tenantId} |
|
|
endtime,rent_shop_type from wx_bill_property where is_preview = 0 and status = #{status} and tenant_id = #{tenantId} |
|
|
union |
|
|
union |
|
|
select res.id,res.merchant_id,res.shop_id,res.tenant_id,res.name,res.bill_type_value,res.bill_type,res.need_pay, |
|
|
select res.id,res.merchant_id,res.shop_id,res.tenant_id,res.name,res.bill_type_value,res.bill_type,res.need_pay, |
|
|
res.receive_pay,res.pay,res.owe owe,res.receive_date,res.pay_date,res.expired_day,res.status,res.starttime,res.endtime,res.rent_shop_type from( |
|
|
res.receive_pay,res.pay,res.owe owe,res.receive_date,res.pay_date,res.expired_day,res.status,res.starttime,res.endtime,res.rent_shop_type from( |
|
|
select id,merchant_id,shop_id,tenant_id,'欠缴押金' name,2 bill_type_value,'欠缴押金' |
|
|
|
|
|
bill_type,need_pay,receive_pay,pay, |
|
|
|
|
|
<choose> |
|
|
|
|
|
<when test="1==filterHasPay"> |
|
|
|
|
|
(receive_pay-pay) owe |
|
|
|
|
|
</when> |
|
|
|
|
|
<otherwise> |
|
|
|
|
|
owe |
|
|
|
|
|
</otherwise> |
|
|
|
|
|
</choose> |
|
|
|
|
|
,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' |
|
|
|
|
|
endtime,rent_shop_type from wx_bill_rent_deposit where status = #{status} and tenant_id = #{tenantId} |
|
|
|
|
|
union |
|
|
|
|
|
select id,merchant_id,shop_id,tenant_id,'欠缴押金' name,4 bill_type_value,'欠缴押金' |
|
|
|
|
|
bill_type,need_pay,receive_pay,pay, |
|
|
|
|
|
<choose> |
|
|
|
|
|
<when test="1==filterHasPay"> |
|
|
|
|
|
(receive_pay-pay) owe |
|
|
|
|
|
</when> |
|
|
|
|
|
<otherwise> |
|
|
|
|
|
owe |
|
|
|
|
|
</otherwise> |
|
|
|
|
|
</choose> |
|
|
|
|
|
,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' |
|
|
|
|
|
endtime,rent_shop_type from wx_bill_property_deposit where status = #{status} and tenant_id = #{tenantId} |
|
|
|
|
|
union |
|
|
|
|
|
select id,merchant_id,shop_id,tenant_id,'欠缴押金' name,8 bill_type_value,'欠缴押金' bill_type,0 as |
|
|
|
|
|
need_pay,receive_pay,pay, |
|
|
|
|
|
<choose> |
|
|
|
|
|
<when test="1==filterHasPay"> |
|
|
|
|
|
(receive_pay-pay) owe |
|
|
|
|
|
</when> |
|
|
|
|
|
<otherwise> |
|
|
|
|
|
owe |
|
|
|
|
|
</otherwise> |
|
|
|
|
|
</choose> |
|
|
|
|
|
,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type |
|
|
|
|
|
from wx_bill_other_deposit where status = #{status} and tenant_id = #{tenantId} |
|
|
|
|
|
|
|
|
select id,merchant_id,shop_id,tenant_id,'欠缴押金' name,2 bill_type_value,'欠缴押金' |
|
|
|
|
|
bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' |
|
|
|
|
|
endtime,rent_shop_type from wx_bill_rent_deposit where status = #{status} and tenant_id = #{tenantId} |
|
|
|
|
|
union |
|
|
|
|
|
select id,merchant_id,shop_id,tenant_id,'欠缴押金' name,4 bill_type_value,'欠缴押金' |
|
|
|
|
|
bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' |
|
|
|
|
|
endtime,rent_shop_type from wx_bill_property_deposit where status = #{status} and tenant_id = #{tenantId} |
|
|
|
|
|
union |
|
|
|
|
|
select id,merchant_id,shop_id,tenant_id,'欠缴押金' name,8 bill_type_value,'欠缴押金' bill_type,0 as |
|
|
|
|
|
need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type |
|
|
|
|
|
from wx_bill_other_deposit where status = #{status} and tenant_id = #{tenantId} |
|
|
) res |
|
|
) res |
|
|
union |
|
|
union |
|
|
select res.id,res.merchant_id,res.shop_id,res.tenant_id,res.name,res.bill_type_value,res.bill_type,res.need_pay, |
|
|
select res.id,res.merchant_id,res.shop_id,res.tenant_id,res.name,res.bill_type_value,res.bill_type,res.need_pay, |
|
|
res.receive_pay,res.pay, |
|
|
|
|
|
owe |
|
|
|
|
|
,res.receive_date,res.pay_date,res.expired_day,res.status,res.starttime,res.endtime,res.rent_shop_type from( |
|
|
|
|
|
select id,merchant_id,shop_id,tenant_id,'其他费用' name,5 bill_type_value,'其他费用' bill_type,0 as |
|
|
|
|
|
need_pay,receive_pay,pay, |
|
|
|
|
|
<choose> |
|
|
|
|
|
<when test="1==filterHasPay"> |
|
|
|
|
|
(receive_pay-pay) owe |
|
|
|
|
|
</when> |
|
|
|
|
|
<otherwise> |
|
|
|
|
|
owe |
|
|
|
|
|
</otherwise> |
|
|
|
|
|
</choose> |
|
|
|
|
|
,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type |
|
|
|
|
|
from wx_bill_daily where type in(1,2) and status = #{status} and tenant_id = #{tenantId} |
|
|
|
|
|
union |
|
|
|
|
|
select id,merchant_id,shop_id,tenant_id,'其他费用' name,7 bill_type_value,'其他费用' bill_type,0 as |
|
|
|
|
|
need_pay,receive_pay,pay, |
|
|
|
|
|
<choose> |
|
|
|
|
|
<when test="1==filterHasPay"> |
|
|
|
|
|
(receive_pay-pay) owe |
|
|
|
|
|
</when> |
|
|
|
|
|
<otherwise> |
|
|
|
|
|
owe |
|
|
|
|
|
</otherwise> |
|
|
|
|
|
</choose> |
|
|
|
|
|
,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type |
|
|
|
|
|
from wx_bill_other where status = #{status} and tenant_id = #{tenantId} |
|
|
|
|
|
|
|
|
res.receive_pay,res.pay,res.owe owe,res.receive_date,res.pay_date,res.expired_day,res.status,res.starttime,res.endtime,res.rent_shop_type from( |
|
|
|
|
|
select id,merchant_id,shop_id,tenant_id,'其他费用' name,5 bill_type_value,'其他费用' bill_type,0 as |
|
|
|
|
|
need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type |
|
|
|
|
|
from wx_bill_daily where type in(1,2) and status = #{status} and tenant_id = #{tenantId} |
|
|
|
|
|
union |
|
|
|
|
|
select id,merchant_id,shop_id,tenant_id,'其他费用' name,7 bill_type_value,'其他费用' bill_type,0 as |
|
|
|
|
|
need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type |
|
|
|
|
|
from wx_bill_other where status = #{status} and tenant_id = #{tenantId} |
|
|
) res |
|
|
) res |
|
|
|
|
|
|
|
|
) bill |
|
|
) bill |
|
|
@@ -622,7 +588,6 @@ |
|
|
<if test=" null != month and ''!=month"> |
|
|
<if test=" null != month and ''!=month"> |
|
|
and date_format(bill.receive_date,'%Y-%m')=#{month} |
|
|
and date_format(bill.receive_date,'%Y-%m')=#{month} |
|
|
</if> |
|
|
</if> |
|
|
|
|
|
|
|
|
<if test=" null != sortColumns"> order by ${sortColumns} </if> |
|
|
<if test=" null != sortColumns"> order by ${sortColumns} </if> |
|
|
<if test=" null == sortColumns"> order by totalOwe desc </if> |
|
|
<if test=" null == sortColumns"> order by totalOwe desc </if> |
|
|
</select> |
|
|
</select> |
|
|
|