|
|
|
@@ -40,10 +40,13 @@ |
|
|
|
<result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/> |
|
|
|
|
|
|
|
<result column="freeze" property="freeze"/> |
|
|
|
<result column="late_pay_price" property="latePayPrice"/> |
|
|
|
|
|
|
|
</resultMap> |
|
|
|
|
|
|
|
|
|
|
|
<select id="list" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap"> |
|
|
|
|
|
|
|
select |
|
|
|
bill.id,bill.tenant_id tenantId,bill.merchant_id merchantId,bill.shop_id shopId, |
|
|
|
bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay, |
|
|
|
@@ -51,46 +54,46 @@ |
|
|
|
bill.pay_date payDate,expired_day expiredDay,bill.status,bill.starttime, |
|
|
|
bill.endtime,bill.name,bill.rent_shop_type rentShopType,m.name merchantName, |
|
|
|
s.shop_number shopNumber, s.manager, s.manager_phone managerPhone,bill.shop_info |
|
|
|
shopInfo,bill.comments,bill.price_detail,updatetime,bill.freeze |
|
|
|
shopInfo,bill.comments,bill.price_detail,updatetime,bill.freeze,bill.late_pay_price |
|
|
|
from ( |
|
|
|
select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' |
|
|
|
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime, |
|
|
|
endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments,'' |
|
|
|
price_detail,updatetime,freeze |
|
|
|
price_detail,updatetime,freeze,late_pay_price |
|
|
|
from wx_bill_rent where tenant_id=#{tenantId} and is_preview = 0 |
|
|
|
union all |
|
|
|
select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' |
|
|
|
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime, |
|
|
|
endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime,freeze from wx_bill_rent_deposit where |
|
|
|
endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime,freeze,'' late_pay_price from wx_bill_rent_deposit where |
|
|
|
tenant_id=#{tenantId} |
|
|
|
union all |
|
|
|
select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' |
|
|
|
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime, |
|
|
|
endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments,'' |
|
|
|
price_detail,updatetime,freeze |
|
|
|
price_detail,updatetime,freeze,late_pay_price |
|
|
|
from wx_bill_property where tenant_id=#{tenantId} and is_preview = 0 |
|
|
|
union all |
|
|
|
select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' |
|
|
|
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime, |
|
|
|
endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime,freeze from wx_bill_property_deposit where |
|
|
|
endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime,freeze,'' late_pay_price from wx_bill_property_deposit where |
|
|
|
tenant_id=#{tenantId} |
|
|
|
union all |
|
|
|
select id,merchant_id,shop_id,tenant_id,case when type=1 then '水费' when type=2 then '电费' else '空调费' end name, |
|
|
|
case when type=1 then 5 when type=2 then 6 else 9 end bill_type_value, |
|
|
|
case when type=1 then '水费' when type=2 then '电费' else '空调费' end bill_type,0 as |
|
|
|
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime, |
|
|
|
rent_shop_type,'[]' shop_info, NULL comments,price_detail,updatetime,freeze |
|
|
|
rent_shop_type,'[]' shop_info, NULL comments,price_detail,updatetime,freeze,'' late_pay_price |
|
|
|
from wx_bill_daily where tenant_id=#{tenantId} |
|
|
|
union all |
|
|
|
select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,concat('其他费用-',name) as bill_type,0 as |
|
|
|
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime, |
|
|
|
rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze |
|
|
|
rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze,'' late_pay_price |
|
|
|
from wx_bill_other where tenant_id=#{tenantId} |
|
|
|
union all |
|
|
|
select id,merchant_id,shop_id,tenant_id,comments as name,8 bill_type_value,concat('其他押金-',comments) as |
|
|
|
bill_type,0 as |
|
|
|
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime, |
|
|
|
rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze |
|
|
|
rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze,'' late_pay_price |
|
|
|
from wx_bill_other_deposit where tenant_id=#{tenantId} |
|
|
|
) bill |
|
|
|
left join wx_merchant m on bill.merchant_id=m.id |
|
|
|
@@ -642,6 +645,7 @@ |
|
|
|
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.rentLatePay+bill.propertyLatePay+bill.depositLatePay+bill.otherLatePay |
|
|
|
-bill.rentPay-bill.propertyPay-bill.depositPay-bill.otherPay)/100,2) totalReceivePay |
|
|
|
</when> |
|
|
|
<otherwise> |
|
|
|
@@ -649,7 +653,7 @@ |
|
|
|
round(bill.propertyReceivePay/100,2) propertyReceivePay, |
|
|
|
round(bill.depositReceivePay/100,2) depositReceivePay, |
|
|
|
round(bill.otherReceivePay/100,2) otherReceivePay, |
|
|
|
round((bill.rentReceivePay+bill.propertyReceivePay+bill.depositReceivePay+bill.otherReceivePay)/100,2) totalReceivePay |
|
|
|
round((bill.rentReceivePay+bill.propertyReceivePay+bill.depositReceivePay+bill.otherReceivePay+bill.rentLatePay+bill.propertyLatePay+bill.depositLatePay+bill.otherLatePay )/100,2) totalReceivePay |
|
|
|
</otherwise> |
|
|
|
</choose> |
|
|
|
|
|
|
|
@@ -669,22 +673,28 @@ |
|
|
|
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 |
|
|
|
max(case oweList.bill_type when '其他费用' then oweList.pay else 0 end) otherPay, |
|
|
|
|
|
|
|
max(case oweList.bill_type when '租金' then oweList.latePayPrice else 0 end) rentLatePay, |
|
|
|
max(case oweList.bill_type when '物业费' then oweList.latePayPrice else 0 end) propertyLatePay, |
|
|
|
max(case oweList.bill_type when '欠缴押金' then oweList.latePayPrice else 0 end) depositLatePay, |
|
|
|
max(case oweList.bill_type when '其他费用' then oweList.latePayPrice else 0 end) otherLatePay |
|
|
|
|
|
|
|
from( |
|
|
|
select bill.tenant_id,bill.merchant_id,bill.bill_type,sum(owe) owe,bill.receive_date,bill.expired_day,sum(bill.receive_pay) receive_pay,sum(bill.pay) pay from ( |
|
|
|
select bill.tenant_id,bill.merchant_id,bill.bill_type,sum(owe) owe,bill.receive_date,bill.expired_day,sum(bill.receive_pay) receive_pay,sum(bill.pay) pay,sum(bill.late_pay_price) latePayPrice from ( |
|
|
|
|
|
|
|
select id,merchant_id,shop_id,tenant_id,'租金' name,1 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 where tenant_id = #{tenantId} and is_preview = 0 |
|
|
|
endtime,rent_shop_type,late_pay_price from wx_bill_rent where tenant_id = #{tenantId} and is_preview = 0 |
|
|
|
<include refid="getOweBillAsPageConditions"/> |
|
|
|
union all |
|
|
|
select id,merchant_id,shop_id,tenant_id,'物业费' name,3 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 where tenant_id = #{tenantId} and is_preview = 0 |
|
|
|
endtime,rent_shop_type,late_pay_price from wx_bill_property where tenant_id = #{tenantId} and is_preview = 0 |
|
|
|
<include refid="getOweBillAsPageConditions"/> |
|
|
|
union all |
|
|
|
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,0 late_pay_price from( |
|
|
|
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 tenant_id = #{tenantId} |
|
|
|
@@ -702,7 +712,7 @@ |
|
|
|
) res |
|
|
|
union all |
|
|
|
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,0 late_pay_price 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 tenant_id = #{tenantId} and type in(1,2,3) |
|
|
|
|