<?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 <= NOW() and un.is_use = 0
|
</if>
|
order by id desc
|
</select>
|
|
</mapper>
|