优惠券 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

@@ -49,10 +49,18 @@ id, vip_user_id, coupon_id, name, type, pro_id, full_amount, discount_amount, nu
inRecord.use_end_time as endTime
FROM
tb_activate_in_record inRecord
LEFT JOIN tb_product pro ON inRecord.pro_id = pro.id and pro.shop_id = #{shopId}
LEFT JOIN tb_product pro ON inRecord.pro_id = pro.id
<if test="shopId != null and shopId != ''">
and pro.shop_id = #{shopId}
</if>
WHERE
inRecord.vip_user_id = #{vipUserId}
and inRecord.shop_id = #{shopId}
inRecord.vip_user_id in
<foreach item="item" index="index" collection="vipUserIds" open="(" separator="," close=")">
#{item}
</foreach>
<if test="shopId != null and shopId != ''">
and inRecord.shop_id = #{shopId}
</if>
and inRecord.over_num != 0
and inRecord.use_start_time &lt; now()
and inRecord.use_end_time &gt; now()
@@ -70,30 +78,20 @@ id, vip_user_id, coupon_id, name, type, pro_id, full_amount, discount_amount, nu
inRecord.use_end_time as endTime
FROM
tb_activate_in_record inRecord
LEFT JOIN tb_product pro ON inRecord.pro_id = pro.id and pro.shop_id = #{shopId}
LEFT JOIN tb_product pro ON inRecord.pro_id = pro.id
<if test="shopId != null and shopId != ''">
and pro.shop_id = #{shopId}
</if>
WHERE
inRecord.vip_user_id = #{vipUserId}
and inRecord.shop_id = #{shopId}
and inRecord.over_num != 0
and inRecord.use_end_time &lt; now()
order by inRecord.use_end_time asc
</select>
<select id="queryByVipIdAndShopIdIn" resultMap="TbActivateInRecordMap">
SELECT
<include refid="Base_Column_List"/>,
CASE
WHEN inRecord.type = 1 THEN inRecord.NAME
WHEN inRecord.type = 2 THEN pro.NAME
END AS `name`
FROM
tb_activate_in_record inRecord
LEFT JOIN tb_product pro ON inRecord.pro_id = pro.id and pro.shop_id = #{shopId}
WHERE
inRecord.vip_user_id = #{vipUserId}
and inRecord.shop_id = #{shopId}
and inRecord.over_num != 0
and inRecord.use_end_time &lt; now()
inRecord.vip_user_id in
<foreach item="item" index="index" collection="vipUserIds" open="(" separator="," close=")">
#{item}
</foreach>
<if test="shopId != null and shopId != ''">
and inRecord.shop_id = #{shopId}
</if>
and inRecord.over_num != 0
and inRecord.use_end_time &lt; now()
order by inRecord.use_end_time asc
</select>