select merchant_id,receive_pay from wx_bill_rent where is_preview = 0 and status not in(3,6)
(select sum(bill.receive_pay)+sum(bill.late_pay_price)+bill.receivePay from (
select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,late_pay_price from wx_bill_rent where is_preview = 0 and status not in(3,6)
union all
select merchant_id,receive_pay from wx_bill_rent_deposit where status not in(3,6)
select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,0 late_pay_price from wx_bill_rent_deposit where status not in(3,6)
union all
select merchant_id,receive_pay from wx_bill_property where is_preview = 0 and status not in(3,6)
select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,late_pay_price from wx_bill_property where is_preview = 0 and status not in(3,6)
union all
select merchant_id,receive_pay from wx_bill_property_deposit where status not in(3,6)
select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,0 late_pay_price from wx_bill_property_deposit where status not in(3,6)
union all
select merchant_id,receive_pay from wx_bill_daily where type in(1,2,3) and status not in(3,6)
select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,0 late_pay_price from wx_bill_daily where type in(1,2,3) and status not in(3,6)
union all
select merchant_id,receive_pay from wx_bill_other where status not in(3,6)
select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,0 late_pay_price from wx_bill_other where status not in(3,6)
union all
select merchant_id,receive_pay from wx_bill_other_deposit where status not in(3,6)
select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,0 late_pay_price from wx_bill_other_deposit where status not in(3,6)
) bill where bill.merchant_id = m.id
)/100,2),0) receivePay,
ifnull(round(
(select sum(ss.money) from (
select ms.subsidy money,mm.id
@@ -777,7 +779,7 @@
select receive_pay money,merchant_id id from wx_bill_other_deposit where status = 3
)ss where ss.id = m.id
)/100,2),0) payOut,
(ifnull(round(
(select sum(bill.receive_pay) from (
select merchant_id,receive_pay from wx_bill_rent where is_preview = 0 and status not in(3,6)
@@ -813,7 +815,7 @@
select receive_pay money,merchant_id id from wx_bill_other_deposit where status = 3
)ss where ss.id = m.id
)/100,2),0)) balance
from wx_merchant m
left join (select ms.merchant_id,s.type,GROUP_CONCAT(s.shop_number) as shop_number
from wx_merchant_shop ms inner join wx_shop s on ms.shop_id=s.id where ms.is_del=0
@@ -822,6 +824,7 @@
left join wx_rent_contract rc on(rc.merchant_id = m.id)
where m.status=1
) tt where 1=1
<if test=" null != tenantId"> and tt.tenant_id = #{tenantId} </if>
<if test=" null != merchantId"> and tt.id = #{merchantId} </if>
<if test=" null != merchantName and ''!=merchantName">and tt.name like concat('%', #{merchantName},'%')</if>
@@ -829,6 +832,10 @@
and (receivePay >0 or payOut>0)
<if test=" null != sortColumns"> order by ${sortColumns} </if>
<if test=" null == sortColumns"> order by tt.id desc </if>
<if test="null != limitStart and null != limitEnd">