|
@@ -8,8 +8,8 @@
|
|
cc.`id` AS "couponId",
|
|
cc.`id` AS "couponId",
|
|
cc.`couponAmount`,
|
|
cc.`couponAmount`,
|
|
cc.`touchPrice`,
|
|
cc.`touchPrice`,
|
|
- a.`createDate` as `startDate`,
|
|
|
|
- date_add(a.createDate,interval cc.usePeriod DAY) as `endDate`,
|
|
|
|
|
|
+ if(cc.vipFlag = 1,cc.startDate,a.createDate) as startDate,
|
|
|
|
+ if(cc.vipFlag = 1,cc.endDate,date_add(a.createDate,interval cc.usePeriod day)) as endDate,
|
|
cc.`couponType`,
|
|
cc.`couponType`,
|
|
cc.`userId`,
|
|
cc.`userId`,
|
|
cc.`shopId`,
|
|
cc.`shopId`,
|
|
@@ -24,14 +24,18 @@
|
|
AND a.userId = #{userId}
|
|
AND a.userId = #{userId}
|
|
<if test="status == 1">
|
|
<if test="status == 1">
|
|
AND a.status = 1
|
|
AND a.status = 1
|
|
- AND NOW() <![CDATA[ < ]]> date_add(a.createDate,interval cc.usePeriod DAY)
|
|
|
|
|
|
+ AND if(cc.vipFlag = 1,
|
|
|
|
+ NOW() BETWEEN cc.startDate AND cc.endDate,
|
|
|
|
+ NOW() <![CDATA[ < ]]> date_add(a.createDate,interval cc.usePeriod DAY))
|
|
</if>
|
|
</if>
|
|
<if test="status == 2">
|
|
<if test="status == 2">
|
|
AND a.status = 2
|
|
AND a.status = 2
|
|
</if>
|
|
</if>
|
|
<if test="status == 3">
|
|
<if test="status == 3">
|
|
AND a.status = 1
|
|
AND a.status = 1
|
|
- AND NOW() <![CDATA[ > ]]> date_add(a.createDate,interval cc.usePeriod DAY)
|
|
|
|
|
|
+ AND if(cc.vipFlag = 1,
|
|
|
|
+ NOW() > cc.endDate,
|
|
|
|
+ NOW() <![CDATA[ > ]]> date_add(a.createDate,interval cc.usePeriod DAY))
|
|
</if>
|
|
</if>
|
|
AND cc.status != 2
|
|
AND cc.status != 2
|
|
ORDER BY
|
|
ORDER BY
|
|
@@ -166,7 +170,7 @@
|
|
SELECT `id` AS "couponId",
|
|
SELECT `id` AS "couponId",
|
|
`couponAmount`,
|
|
`couponAmount`,
|
|
`touchPrice`,
|
|
`touchPrice`,
|
|
- if(#{registerTime} <![CDATA[ > ]]> startDate,#{registerTime},startDate),
|
|
|
|
|
|
+ if(#{registerTime} <![CDATA[ > ]]> startDate,#{registerTime},startDate) as startDate,
|
|
if(receiveFlag=1,endDate,date_add(if(#{registerTime} <![CDATA[ > ]]> startDate,#{registerTime},startDate),
|
|
if(receiveFlag=1,endDate,date_add(if(#{registerTime} <![CDATA[ > ]]> startDate,#{registerTime},startDate),
|
|
interval receivePeriod day)) as endDate,
|
|
interval receivePeriod day)) as endDate,
|
|
date_add(NOW(),interval usePeriod day ) as usePeriod,
|
|
date_add(NOW(),interval usePeriod day ) as usePeriod,
|