挂账需求

This commit is contained in:
Tankaikai
2025-03-05 14:49:06 +08:00
parent b9a795b549
commit 4e2d114f95

View File

@@ -5,12 +5,13 @@
<sql id="view_credit_buyer_order_count">
(SELECT
credit_buyer_id AS credit_buyer_id,
status AS status,
tb.credit_buyer_id AS credit_buyer_id,
tb.status AS status,
count( 0 ) AS count
FROM
<include refid="view_credit_buyer_order"/>
GROUP BY credit_buyer_id,status)
tb
GROUP BY tb.credit_buyer_id,tb.status)
</sql>
<sql id="view_credit_buyer_order">
@@ -35,11 +36,12 @@
x3.owed_amount,
x3.accumulate_amount
from tb_credit_buyer x1
left join tb_shop_info t2 on x1.shop_id = x2.id
left join (select credit_buyer_id,ifnull(sum(unpaid_amount),0) as owed_amount,ifnull(sum(pay_amount),0) as
left join tb_shop_info x2 on x1.shop_id = x2.id
left join (select t.credit_buyer_id,ifnull(sum(t.unpaid_amount),0) as owed_amount,ifnull(sum(t.pay_amount),0) as
accumulate_amount from
<include refid="view_credit_buyer_order"/>
group by credit_buyer_id) x3 on x1.id = x3.credit_buyer_id
t
group by t.credit_buyer_id) x3 on x1.id = x3.credit_buyer_id
<where>
and x1.is_del = 0
and x1.shop_id = #{shopId}