会员列表
This commit is contained in:
parent
c309e73575
commit
4120d463d2
|
|
@ -40,38 +40,31 @@
|
||||||
|
|
||||||
<select id="selectAssetsSummary" resultType="com.czg.account.dto.user.userinfo.UserInfoAssetsSummaryDTO">
|
<select id="selectAssetsSummary" resultType="com.czg.account.dto.user.userinfo.UserInfoAssetsSummaryDTO">
|
||||||
SELECT
|
SELECT
|
||||||
SUM(amount) AS amount,
|
IFNULL(SUM(b.amount), 0) AS amount,
|
||||||
SUM(points) AS points,
|
IFNULL(SUM(b.account_points), 0) AS points,
|
||||||
COUNT(DISTINCT c.id) AS couponNum
|
COUNT(DISTINCT c.id) AS couponNum
|
||||||
FROM (
|
|
||||||
SELECT
|
|
||||||
b.id,
|
|
||||||
IFNULL(b.amount, 0) AS amount,
|
|
||||||
IFNULL(b.account_points, 0) AS points
|
|
||||||
FROM tb_shop_user AS b
|
FROM tb_shop_user AS b
|
||||||
WHERE b.user_id = #{userId}
|
|
||||||
) AS sub_b
|
|
||||||
LEFT JOIN tb_shop_activate_coupon_record AS c
|
LEFT JOIN tb_shop_activate_coupon_record AS c
|
||||||
ON c.shop_id = sub_b.id
|
ON c.shop_id = b.shop_id
|
||||||
AND c.shop_user_id = sub_b.id
|
AND c.shop_user_id = b.id
|
||||||
AND c.`status` = 1
|
AND c.`status` = 1
|
||||||
AND c.use_start_time < NOW()
|
AND c.use_start_time < NOW()
|
||||||
AND c.use_end_time > NOW();
|
AND c.use_end_time > NOW()
|
||||||
|
WHERE b.user_id = #{userId};
|
||||||
|
|
||||||
|
|
||||||
</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 c.id) AS couponNum,
|
||||||
COUNT(DISTINCT d.id) AS orderNumber,
|
COUNT(DISTINCT d.id) AS orderNumber,
|
||||||
IFNULL(SUM(DISTINCT f.amount), 0) AS rechargeAmount
|
IFNULL(SUM(DISTINCT f.amount), 0) AS rechargeAmount
|
||||||
FROM
|
FROM
|
||||||
tb_shop_user a
|
tb_shop_user a
|
||||||
left JOIN tb_user_info b ON b.id = a.user_id
|
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 <
|
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()
|
||||||
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_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',
|
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')
|
||||||
'wechatIn', 'alipayIn')
|
|
||||||
|
|
||||||
where a.shop_id=#{shopId}
|
where a.shop_id=#{shopId}
|
||||||
<if test="isVip != null">
|
<if test="isVip != null">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue