| | |
| | | DATE_FORMAT(b.endTime, '%Y-%m-%d') as endTime |
| | | from t_user_coupon a |
| | | left join t_coupon b on (a.couponId = b.id) |
| | | where a.`status` = 1 and b.type != 3 and a.userId = #{uid} and |
| | | where a.`status` = 1 and b.type != 3 and (now() between b.startTime and b.endTime) and a.userId = #{uid} and |
| | | ( |
| | | b.useScope = 1 or (b.useScope = 2 and b.id IN (SELECT couponId FROM t_coupon_city where provinceCode = #{provinceCode} and cityCode = #{cityCode}) ) |
| | | or (b.useScope = 3 and b.id in (select couponId from t_coupon_store where storeId = #{storeId}))) |