Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
2024-10-30 09:39:10 +08:00
7 changed files with 58 additions and 44 deletions

View File

@@ -51,10 +51,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()
@@ -72,30 +80,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>

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>