UserCouponMapper.xml
2.55 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?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.yoho.ufo.dal.UserCouponMapper">
<resultMap id="BaseResultMap" type="com.yoho.ufo.model.coupon.UserCoupon">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="uid" property="uid" jdbcType="INTEGER" />
<result column="coupon_id" property="couponId" jdbcType="INTEGER" />
<result column="coupon_type" property="couponType" jdbcType="INTEGER" />
<result column="coupon_code" property="couponCode" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="order_code" property="orderCode" jdbcType="BIGINT" />
<result column="use_time" property="useTime" jdbcType="INTEGER" />
<result column="start_time" property="startTime" jdbcType="INTEGER" />
<result column="end_time" property="endTime" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="coupon_token" property="couponToken" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List">
id,uid,coupon_id,coupon_type,coupon_code,status,order_code,use_time,start_time,end_time,create_time,coupon_token
</sql>
<select id="selectByCondition" resultType="com.yoho.ufo.model.coupon.UserCoupon">
select <include refid="Base_Column_List"/> from user_coupon
where 1=1
<if test="param.couponId != null">
and coupon_Id=#{param.couponId}
</if>
<if test="param.couponCode != null">
and coupon_code=#{param.couponCode}
</if>
<if test="param.uid != null">
and uid=#{param.uid}
</if>
<if test="param.status != null">
and status=#{param.status}
</if>
order by id desc
<if test="param.size > 0">
limit #{param.start},#{param.size}
</if>
</select>
<select id="selectTotalByCondition" resultType="java.lang.Integer">
select count(1) from user_coupon
where 1=1
<if test="param.couponId != null">
and coupon_Id=#{param.couponId}
</if>
<if test="param.couponCode != null">
and coupon_code=#{param.couponCode}
</if>
<if test="param.uid != null">
and uid=#{param.uid}
</if>
<if test="param.status != null">
and status=#{param.status}
</if>
</select>
</mapper>