增加可用优惠券数量

This commit is contained in:
wangguocheng
2024-05-23 09:27:18 +08:00
parent 75b451cdda
commit 7c5e40cd38
6 changed files with 30 additions and 1 deletions

View File

@@ -30,7 +30,10 @@
<select id="selectByOrderId" resultType="com.chaozhanggui.system.cashierservice.entity.TbUserCoupons">
select * from tb_user_coupons where order_id = #{orderId}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<select id="selectByUserIdAndAmount" resultType="java.lang.Integer">
select ifnull(count(*),0) from tb_user_coupons where user_id = #{userId} and status = '0' and coupons_amount >= #{orderNum}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_user_coupons
where id = #{id,jdbcType=INTEGER}
</delete>