mitao
2024-06-06 3d2b51ea4520533de5e78f88dddf5b5c7dce4247
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sinata.rest.modular.member.dao.MyUserCouponMapper">
 
    <select id="getUserCouponList" resultType="com.sinata.rest.modular.member.model.MyCoupon">
        SELECT
        mn.*
        FROM
        my_user_coupon un
        JOIN my_coupon mn on mn.is_delete = 0 and mn.id = un.coupon_id
        where un.user_id = #{userId}
        <if test="type !=null and type == 1">
            and un.end_time > NOW() and  un.is_use = 0
        </if>
        <if test="type !=null and  type == 2">
            and un.is_use = 1
        </if>
        <if test="type !=null and type == 3">
            and un.end_time &lt;= NOW() and  un.is_use = 0
        </if>
        order by id desc
    </select>
 
</mapper>