|
|
@@ -20,7 +20,7 @@
|
|
|
cp.is_renew,
|
|
|
cu.status as couponUserStatus,
|
|
|
if(ck.id is null, 0, 1) as 'isAvailable',
|
|
|
- if(ca.id is not null and ca.status = 0,false,true) flag
|
|
|
+ if(ca.id is not null and ca.expiry_status = 0,false,true) flag
|
|
|
from `coupon_user` cu
|
|
|
left join `coupon` cp on cp.id = cu.coupon_id
|
|
|
left join `coupon_active` ca on ca.id = cu.coupon_active_id
|
|
|
@@ -47,9 +47,11 @@
|
|
|
|
|
|
<select id="countAvailableCouponList" resultType="java.lang.Integer">
|
|
|
select count(distinct cu.id)
|
|
|
+ (select cu.id,ca.expiry_status as flag from (
|
|
|
from `coupon_user` cu
|
|
|
left join `coupon` cp on cp.id = cu.coupon_id
|
|
|
left join `coupon_sku` ck on ck.coupon_id = cp.id
|
|
|
+ left join `coupon_active` ca on ca.id = cu.coupon_active_id
|
|
|
where
|
|
|
<if test="goodsId != null">
|
|
|
ck.goods_id = #{goodsId}
|
|
|
@@ -63,8 +65,8 @@
|
|
|
and cu.valid_start_time < now()
|
|
|
and cu.valid_end_time > now()
|
|
|
<if test="isRenew != null and isRenew">
|
|
|
- and cp.is_renew = ${isRenew}
|
|
|
- </if>
|
|
|
+ and cp.is_renew = #{isRenew}
|
|
|
+ </if>))s where flag != 0 or flag is null
|
|
|
</select>
|
|
|
|
|
|
<select id="couponCenterList" resultType="com.cyksj.model.views.CouponActiveView">
|
|
|
@@ -134,13 +136,13 @@
|
|
|
(case
|
|
|
when cu.status = 'used' then 'used'
|
|
|
when cu.valid_end_time < now() then 'expired'
|
|
|
- when ca.id is not null and ca.status = 0 then 'invalid'
|
|
|
+ when ca.id is not null and ca.expiry_status = 0 then 'invalid'
|
|
|
when cu.valid_start_time > now() then 'notEffective'
|
|
|
else cu.status end) as couponUserStatus,
|
|
|
(case
|
|
|
when cu.status = 'used' then 4
|
|
|
when cu.valid_end_time < now() then 2
|
|
|
- when ca.id is not null and ca.status = 0 then 3
|
|
|
+ when ca.id is not null and ca.expiry_status = 0 then 3
|
|
|
when cu.valid_start_time > now() then 1
|
|
|
when cu.status = 'unused' then 0
|
|
|
end) as orderby
|