会员查询修改

This commit is contained in:
张松
2025-04-02 14:18:48 +08:00
parent 0fe7eeaf70
commit 3e3269e8bc

View File

@@ -56,29 +56,47 @@
</select>
<select id="selectPageByKeyAndIsVip" resultType="com.czg.account.dto.shopuser.ShopUserDTO">
SELECT
a.*, COUNT(DISTINCT c.id) AS couponNum,
COUNT(DISTINCT d.id) AS orderNumber,
IFNULL(SUM(DISTINCT f.amount), 0) AS rechargeAmount
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 and c.use_start_time &lt; now() and c.use_end_time > now()
left join tb_order_info as d on d.user_id=a.user_id and d.shop_id=a.shop_id
left join tb_shop_user_flow as f on f.user_id=a.user_id and f.shop_id=a.shop_id and f.biz_code in ('cashIn', 'wechatIn', 'alipayIn')
a.*,
(SELECT COUNT(*)
FROM tb_shop_activate_coupon_record c
WHERE c.shop_user_id = a.id
AND c.status = 0
AND c.use_start_time &lt; NOW()
AND c.use_end_time > NOW()
) AS couponNum,
(SELECT COUNT(*)
FROM tb_order_info d
WHERE d.user_id = a.user_id
AND d.shop_id = a.shop_id
) AS orderNumber,
(SELECT IFNULL(SUM(f.amount), 0)
FROM tb_shop_user_flow f
WHERE f.user_id = a.user_id
AND f.shop_id = a.shop_id
AND f.biz_code IN ('cashIn', 'wechatIn', 'alipayIn')
) AS rechargeAmount
FROM tb_shop_user a
LEFT JOIN tb_user_info b ON b.id = a.user_id
WHERE a.shop_id = #{shopId}
where a.shop_id=#{shopId}
<if test="isVip != null">
and a.is_vip=#{isVip}
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}, '%'))
AND (a.nick_name LIKE CONCAT('%', #{key}, '%')
OR a.phone LIKE CONCAT('%', #{key}, '%'))
</if>
<if test="amount != null">
and a.amount >= #{amount}
AND a.amount >= #{amount}
</if>
GROUP BY a.id
order by a.create_time desc
ORDER BY a.create_time DESC;
</select>
<select id="selectVipCard_COUNT" resultType="java.lang.Long">
select count(1)