<?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.supersavedriving.user.modular.system.dao.TUserCouponMapper">
|
|
|
<select id="queryMyCoupons" resultType="com.supersavedriving.user.modular.system.warpper.CheckCouponsWarpper">
|
select
|
a.id,
|
a.couponName as `name`,
|
a.money as discountAmount,
|
UNIX_TIMESTAMP(a.expireTime) * 1000 as endTime
|
from t_user_coupon a
|
where a.userId = #{uid}
|
<if test="null != state and 1 == state">
|
and a.state=1 and now() < a.expireTime
|
</if>
|
<if test="null != state and 2 == state">
|
and a.state=2
|
</if>
|
<if test="null != state and 3 == state">
|
and now() >= a.expireTime and a.state=1
|
</if>
|
order by a.createTime desc limit #{pageNum}, #{pageSize}
|
</select>
|
<select id="queryUsedCouponNum" resultType="java.lang.Integer" parameterType="java.lang.Integer">
|
select count(1) from t_user_coupon where userId=#{uid} and state=2
|
</select>
|
</mapper>
|