优惠券领取 来源字段 区分是充值活动还是邀请或者奖励

优惠券 使用数量
This commit is contained in:
2024-11-14 10:00:57 +08:00
parent e19550fc28
commit f947e2d608
7 changed files with 61 additions and 7 deletions

View File

@@ -36,6 +36,22 @@ id, vip_user_id, coupon_id, name, type, pro_id, full_amount, discount_amount, nu
where id = #{id}
</select>
<select id="isUseCoupon" resultType="int">
SELECT count(1)
FROM `tb_activate_in_record`
WHERE source != 'invited-reward'
and vip_user_id = #{vipUserId}
and coupon_id = #{couponId}
and source_flow_id = #{sourceFlowId}
GROUP BY
vip_user_id,
coupon_id,
source_flow_id
HAVING
sum (num) != sum (over_num)
</select>
<select id="queryByVipIdAndShopId" resultType="com.chaozhanggui.system.cashierservice.entity.vo.TbUserCouponVo">
SELECT
inRecord.shop_id as shopId,

View File

@@ -147,6 +147,16 @@
</foreach>
</insert>
<update id="upUseNumber">
update tb_shop_coupon
set
use_number = use_number+1,
where `id` in
<foreach collection="ids" item="id" separator=",">
(#{id})
</foreach>
</update>
<!--通过主键修改数据-->
<update id="update">
update tb_shop_coupon