会员列表返回优惠券数量

This commit is contained in:
张松
2025-03-17 13:43:30 +08:00
parent 42c2a90ec6
commit b2042e4721
6 changed files with 54 additions and 32 deletions

View File

@@ -48,11 +48,23 @@
on c.shop_id = b.shop_id and c.shop_user_id = b.id and c.`status` = 1
where a.id = #{userId}
</select>
<select id="selectPageByKeyAndIsVip" resultType="com.czg.account.entity.ShopUser">
select tb_shop_user.*
from tb_shop_user
left join tb_user_info on tb_user_info.id = tb_shop_user.user_id ${qwSql}
limit ${pageOffset}, ${pageSize}
<select id="selectPageByKeyAndIsVip" resultType="com.czg.account.dto.shopuser.ShopUserDTO">
SELECT
a.*, count(c.id) couponNum
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
where a.shop_id=#{shopId}
<if test="isVip != null">
and a.is_vip=#{isVip}
</if>
<if test="key != null and key != ''">
and (a.nick_name like concat('%', #{key}, '%') or a.phone like concat('%', #{key}, '%'))
</if>
GROUP BY a.id
order by a.create_time desc
</select>
<select id="selectPageByKeyAndIsVip_COUNT" resultType="java.lang.Long">
select count(1)