|
|
|
@@ -619,5 +619,60 @@ |
|
|
|
<if test=" null == sortColumns"> order by totalOwe desc </if> |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="getReceiveAndPayBillAsPage" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> |
|
|
|
select m.id,m.name,ws.shop_number shopNumber,ws.type,m.link_person linkPerson,m.link_line_phone linkPhone, |
|
|
|
|
|
|
|
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) |
|
|
|
union all |
|
|
|
select merchant_id,receive_pay 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) |
|
|
|
union all |
|
|
|
select merchant_id,receive_pay 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) |
|
|
|
union all |
|
|
|
select merchant_id,receive_pay 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) |
|
|
|
) bill where bill.merchant_id = m.id |
|
|
|
)/100,2) receivePay, |
|
|
|
round( |
|
|
|
(select sum(ss.money) from ( |
|
|
|
select ms.subsidy money,mm.id |
|
|
|
from wx_merchant_subsidy ms |
|
|
|
left join wx_coupon_order co on co.id = ms.coupon_order_id |
|
|
|
left join wx_coupon c on c.id = co.coupon_id |
|
|
|
left join wx_merchant mm on mm.id = ms.merchant_id |
|
|
|
left join wx_card_spend cs on cs.order_id = ms.order_id |
|
|
|
left join wx_c_user cu on cu.id = cs.owner_id |
|
|
|
where ms.order_type in(3,0) and ms.status = 0 |
|
|
|
union all |
|
|
|
select ms.subsidy money,mm.id |
|
|
|
from wx_merchant_subsidy ms |
|
|
|
left join wx_coupon_order co on co.id = ms.coupon_order_id |
|
|
|
left join wx_coupon c on c.id = co.coupon_id |
|
|
|
left join wx_merchant mm on mm.id = ms.merchant_id |
|
|
|
left join wx_card_spend cs on cs.order_id = ms.order_id |
|
|
|
left join wx_c_user cu on cu.id = cs.owner_id |
|
|
|
where ms.order_type in(3,0) and ms.status = 0 |
|
|
|
union all |
|
|
|
select pay_amount money,mm.id from wx_profit_sharing_order pso |
|
|
|
left join wx_merchant mm on pso.merchant_id=mm.id |
|
|
|
where pso.sharing_status !=5 |
|
|
|
)ss where ss.id = m.id |
|
|
|
)/100,2) payOut |
|
|
|
|
|
|
|
from wx_merchant m left join wx_merchant_shop wms on wms.merchant_id = m.id left join wx_shop ws on wms.shop_id = ws.id |
|
|
|
where 1=1 |
|
|
|
<if test=" null != tenantId"> and m.tenant_id = #{tenantId} </if> |
|
|
|
|
|
|
|
<if test=" null != sortColumns"> order by ${sortColumns} </if> |
|
|
|
<if test=" null == sortColumns"> order by m.id desc </if> |
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</mapper> |