|
@@ -295,7 +295,7 @@
|
|
|
cu.valid_end_time,
|
|
cu.valid_end_time,
|
|
|
if(type = 'discount', sku.price * (1 - c.discount), c.reduce_money) as couponMoney
|
|
if(type = 'discount', sku.price * (1 - c.discount), c.reduce_money) as couponMoney
|
|
|
from (select * from coupon_user where user_id = #{userId} and status = 'unused' and valid_start_time < now() and valid_end_time > now()) cu
|
|
from (select * from coupon_user where user_id = #{userId} and status = 'unused' and valid_start_time < now() and valid_end_time > now()) cu
|
|
|
- inner join coupon c on c.id = cu.coupon_id
|
|
|
|
|
|
|
+ inner join coupon c on c.id = cu.coupon_id and c.use_scope != 'renew'
|
|
|
inner join coupon_sku cs on cs.coupon_id = c.id and cs.goods_id = #{goodsId}
|
|
inner join coupon_sku cs on cs.coupon_id = c.id and cs.goods_id = #{goodsId}
|
|
|
inner join goods_don_sku sku on sku.id = cs.sku_id and sku.status is true and sku.price = #{price}
|
|
inner join goods_don_sku sku on sku.id = cs.sku_id and sku.status is true and sku.price = #{price}
|
|
|
order by couponMoney desc limit 1
|
|
order by couponMoney desc limit 1
|
|
@@ -312,6 +312,7 @@
|
|
|
inner join coupon c on c.id = cu.coupon_id
|
|
inner join coupon c on c.id = cu.coupon_id
|
|
|
inner join coupon_sku cs on cs.coupon_id = c.id and cs.sku_id = #{skuId}
|
|
inner join coupon_sku cs on cs.coupon_id = c.id and cs.sku_id = #{skuId}
|
|
|
inner join goods_don_sku sku on sku.id = cs.sku_id and sku.status is true
|
|
inner join goods_don_sku sku on sku.id = cs.sku_id and sku.status is true
|
|
|
|
|
+ and c.use_scope != 'renew'
|
|
|
order by couponMoney desc limit 1
|
|
order by couponMoney desc limit 1
|
|
|
</select>
|
|
</select>
|
|
|
</mapper>
|
|
</mapper>
|