优惠券 find接口

This commit is contained in:
2024-10-29 18:25:51 +08:00
parent 270c274d63
commit a296718232
7 changed files with 58 additions and 44 deletions

View File

@@ -41,15 +41,24 @@
tb_activate_out_record outRecord
INNER JOIN tb_activate_in_record inRecord
on outRecord.give_id = inRecord.id
and inRecord.shop_id = #{shopId}
and inRecord.vip_user_id = #{vipUserId}
<if test="shopId != null and shopId != ''">
and inRecord.shop_id = #{shopId}
</if>
LEFT JOIN tb_product pro
ON inRecord.pro_id = pro.id and pro.shop_id = #{shopId}
ON inRecord.pro_id = pro.id
<if test="shopId != null and shopId != ''">
and pro.shop_id = #{shopId}
</if>
WHERE
outRecord.vip_user_id = #{vipUserId}
and outRecord.shop_id = #{shopId}
and outRecord.status = 'closed'
and outRecord.use_num-outRecord.ref_num >0
outRecord.vip_user_id in
<foreach item="item" index="index" collection="vipUserIds" open="(" separator="," close=")">
#{item}
</foreach>
<if test="shopId != null and shopId != ''">
and outRecord.shop_id = #{shopId}
</if>
and outRecord.status = 'closed'
and outRecord.use_num-outRecord.ref_num >0
order by outRecord.create_time desc
</select>