用户列表返回订单数量

This commit is contained in:
张松 2025-03-20 10:14:54 +08:00
parent 1f23043b12
commit 43d9b5f661
2 changed files with 3 additions and 1 deletions

View File

@ -11,4 +11,5 @@ import lombok.EqualsAndHashCode;
@Data
public class ShopUserDTO extends ShopUser {
private Long couponNum;
private Long orderNumber;
}

View File

@ -50,11 +50,12 @@
</select>
<select id="selectPageByKeyAndIsVip" resultType="com.czg.account.dto.shopuser.ShopUserDTO">
SELECT
a.*, count(c.id) couponNum
a.*, count(c.id) couponNum, count(d.id) orderNumber
FROM
tb_shop_user a
LEFT JOIN tb_user_info b ON b.id = a.user_id
left join tb_shop_activate_coupon_record c on c.shop_user_id=a.id and c.`status`=0
left join tb_order_info as d on d.user_id=a.user_id
where a.shop_id=#{shopId}
<if test="isVip != null">