puzhibing
2023-07-06 ac6a07af9baba0e0fc8d181aae904da679ae8f5a
cloud-server-activity/src/main/resources/mapper/UserCouponMapper.xml
@@ -5,4 +5,20 @@
    <!-- 开启二级缓存 -->
    <cache type="org.mybatis.caches.ehcache.LoggingEhcache"/>
    <select id="queryAvailableCouponList" resultType="map">
        select
        a.id,
        b.`name`,
        b.type,
        b.content,
        DATE_FORMAT('%y-%M-%d', b.startTime) as startTime,
        DATE_FORMAT('%y-%M-%d', b.endTime) 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 (
        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>
</mapper>