|
@@ -79,15 +79,17 @@
|
|
|
(couponType = 1
|
|
|
or (couponType = 2 and chc.id in (select distinct couponId from cm_hehe_coupon_user where userId = #{userId}))
|
|
|
or (couponType = 3 and #{registerTime} <![CDATA[ >= ]]> startTime)
|
|
|
- or (couponType = 4 and chc.id in (select group_concat(shareCouponIds) from cm_hehe_coupon_share where shareUserId = #{userId}))
|
|
|
- or (couponType = 5 and chc.id in (select group_concat(consumeCouponIds) from cm_hehe_coupon_share where shareUserId = #{userId} and consumeFlag = 1))
|
|
|
+ or (couponType = 4 and FIND_IN_SET(chc.id , (select group_concat(shareCouponIds) from cm_hehe_coupon_share where shareUserId = #{userId})))
|
|
|
+ or (couponType = 5 and FIND_IN_SET(chc.id , (select group_concat(consumeCouponIds) from cm_hehe_coupon_share where shareUserId = #{userId} and consumeFlag = 1)))
|
|
|
)
|
|
|
and if(receiveFlag = 1,
|
|
|
if(permanentFlag = 1,true,NOW() <![CDATA[ < ]]> endTime),
|
|
|
- NOW() <![CDATA[ < ]]> date_add(if(#{registerTime} <![CDATA[ >= ]]>
|
|
|
- startTime,#{registerTime},startTime),interval receivePeriod DAY)
|
|
|
+ NOW() <![CDATA[ < ]]> date_add(
|
|
|
+ if(couponType <![CDATA[ <= ]]> 3,
|
|
|
+ if(#{registerTime} <![CDATA[ >= ]]> startTime,#{registerTime},startTime),
|
|
|
+ (select if(couponType = 4,createTime,updateTime) from cm_hehe_coupon_share where FIND_IN_SET(chc.id,if(couponType = 4,shareCouponIds,consumeCouponIds)))),
|
|
|
+ interval receivePeriod DAY)
|
|
|
)
|
|
|
- )
|
|
|
</if>
|
|
|
<if test="couponType != null">
|
|
|
and couponType = #{couponType}
|