Pu Zhibing
4 天以前 4c4dc127cdc9c41f2bfb3c138108529856e031b8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?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() &lt; a.expireTime
        </if>
        <if test="null != state and 2 == state">
            and a.state=2
        </if>
        <if test="null != state and 3 == state">
            and now() &gt;= 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>