会员查询修改
This commit is contained in:
@@ -56,29 +56,47 @@
|
|||||||
</select>
|
</select>
|
||||||
<select id="selectPageByKeyAndIsVip" resultType="com.czg.account.dto.shopuser.ShopUserDTO">
|
<select id="selectPageByKeyAndIsVip" resultType="com.czg.account.dto.shopuser.ShopUserDTO">
|
||||||
SELECT
|
SELECT
|
||||||
a.*, COUNT(DISTINCT c.id) AS couponNum,
|
a.*,
|
||||||
COUNT(DISTINCT d.id) AS orderNumber,
|
(SELECT COUNT(*)
|
||||||
IFNULL(SUM(DISTINCT f.amount), 0) AS rechargeAmount
|
FROM tb_shop_activate_coupon_record c
|
||||||
FROM
|
WHERE c.shop_user_id = a.id
|
||||||
tb_shop_user a
|
AND c.status = 0
|
||||||
LEFT JOIN tb_user_info b ON b.id = a.user_id
|
AND c.use_start_time < NOW()
|
||||||
left join tb_shop_activate_coupon_record c on c.shop_user_id=a.id and c.`status`=0 and c.use_start_time < now() and c.use_end_time > 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
|
) AS couponNum,
|
||||||
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')
|
|
||||||
|
(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">
|
<if test="isVip != null">
|
||||||
and a.is_vip=#{isVip}
|
AND a.is_vip = #{isVip}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="key != null and key != ''">
|
<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>
|
||||||
|
|
||||||
<if test="amount != null">
|
<if test="amount != null">
|
||||||
and a.amount >= #{amount}
|
AND a.amount >= #{amount}
|
||||||
</if>
|
</if>
|
||||||
GROUP BY a.id
|
|
||||||
order by a.create_time desc
|
ORDER BY a.create_time DESC;
|
||||||
</select>
|
</select>
|
||||||
<select id="selectVipCard_COUNT" resultType="java.lang.Long">
|
<select id="selectVipCard_COUNT" resultType="java.lang.Long">
|
||||||
select count(1)
|
select count(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user