| | |
| | | b.useScope = 1 or (b.useScope = 2 and provinceCode = #{provinceCode} and cityCode = #{cityCode}) |
| | | or (b.useScope = 3 and b.id in (select couponId from t_coupon_store where storeId = #{storeId}))) |
| | | </select> |
| | | <select id="queryCanuseConponIds" resultType="com.dsh.activity.entity.UserCoupon"> |
| | | SELECT * |
| | | FROM t_user_coupon |
| | | UNION ALL |
| | | SELECT * |
| | | FROM t_user_coupon1 |
| | | UNION ALL |
| | | SELECT * |
| | | FROM t_user_coupon2 |
| | | UNION ALL |
| | | SELECT * |
| | | FROM t_user_coupon3 |
| | | UNION ALL |
| | | SELECT * |
| | | FROM t_user_coupon4 |
| | | UNION ALL |
| | | SELECT * |
| | | FROM t_user_coupon5 |
| | | WHERE 1=1 |
| | | <if test="userId != null "> |
| | | and userId = #{userId} |
| | | </if> |
| | | <if test="couponIds.size > 0"> |
| | | and couponId in |
| | | <foreach collection="couponIds" close=")" index="index" open="(" separator="," item="item"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | order by insertTime desc |
| | | </select> |
| | | </mapper> |