CouponActivityMapper.xml
5.04 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?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.coupon.dal.ICouponActivityDAO">
<resultMap id="BaseResultMap" type="com.yoho.coupon.dal.model.CouponActivity">
<id column="id" property="id" jdbcType="INTEGER" />
<result column="activity_name" property="activityName"
jdbcType="VARCHAR" />
<result column="activity_title" property="activityTitle"
jdbcType="VARCHAR" />
<result column="activity_pic" property="activityPic" jdbcType="VARCHAR" />
<result column="activity_bgcolor" property="activityBgcolor"
jdbcType="VARCHAR" />
<result column="activity_desc" property="activityDesc"
jdbcType="VARCHAR" />
<result column="coupon_pic" property="couponPic" jdbcType="VARCHAR" />
<result column="share_img_url" property="shareImgUrl" jdbcType="VARCHAR" />
<result column="share_title1" property="shareTitle1" jdbcType="VARCHAR" />
<result column="share_title2" property="shareTitle2" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="coupon_event_code" property="couponEventCode" jdbcType="VARCHAR" />
<result column="activity_code" property="activityCode" jdbcType="VARCHAR" />
<result column="begin_time" property="beginTime" jdbcType="INTEGER" />
<result column="end_time" property="endTime" jdbcType="INTEGER" />
<result column="coupon_name" property="couponName" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List">
id, activity_name, activity_title, activity_pic, activity_bgcolor,
activity_desc,
coupon_pic, share_img_url, share_title1, share_title2, status, create_time, coupon_event_code, activity_code, begin_time, end_time, coupon_name
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
parameterType="java.lang.Integer">
select
<include refid="Base_Column_List" />
from coupon_activity
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByCode" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from coupon_activity
where activity_code = #{activityCode} and status=1 and begin_time<=UNIX_TIMESTAMP() and end_time>=UNIX_TIMESTAMP()
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from coupon_activity
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.coupon.dal.model.CouponActivity">
insert into coupon_activity (id, activity_name, activity_title,
activity_pic, activity_bgcolor, activity_desc,
coupon_pic, share_img_url, share_title1,
share_title2, status, create_time
)
values (#{id,jdbcType=INTEGER}, #{activityName,jdbcType=VARCHAR},
#{activityTitle,jdbcType=VARCHAR},
#{activityPic,jdbcType=VARCHAR}, #{activityBgcolor,jdbcType=VARCHAR},
#{activityDesc,jdbcType=VARCHAR},
#{couponPic,jdbcType=VARCHAR}, #{shareImgUrl,jdbcType=VARCHAR}, #{shareTitle1,jdbcType=VARCHAR},
#{shareTitle2,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT},
#{createTime,jdbcType=INTEGER}
)
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.coupon.dal.model.CouponActivity">
update coupon_activity
<set>
<if test="activityName != null">
activity_name = #{activityName,jdbcType=VARCHAR},
</if>
<if test="activityTitle != null">
activity_title = #{activityTitle,jdbcType=VARCHAR},
</if>
<if test="activityPic != null">
activity_pic = #{activityPic,jdbcType=VARCHAR},
</if>
<if test="activityBgcolor != null">
activity_bgcolor = #{activityBgcolor,jdbcType=VARCHAR},
</if>
<if test="activityDesc != null">
activity_desc = #{activityDesc,jdbcType=VARCHAR},
</if>
<if test="couponPic != null">
coupon_pic = #{couponPic,jdbcType=VARCHAR},
</if>
<if test="shareImgUrl != null">
share_img_url = #{shareImgUrl,jdbcType=VARCHAR},
</if>
<if test="shareTitle1 != null">
share_title1 = #{shareTitle1,jdbcType=VARCHAR},
</if>
<if test="shareTitle2 != null">
share_title2 = #{shareTitle2,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=TINYINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.coupon.dal.model.CouponActivity">
update coupon_activity
set activity_name = #{activityName,jdbcType=VARCHAR},
activity_title = #{activityTitle,jdbcType=VARCHAR},
activity_pic = #{activityPic,jdbcType=VARCHAR},
activity_bgcolor = #{activityBgcolor,jdbcType=VARCHAR},
activity_desc = #{activityDesc,jdbcType=VARCHAR},
coupon_pic = #{couponPic,jdbcType=VARCHAR},
share_img_url = #{shareImgUrl,jdbcType=VARCHAR},
share_title1 = #{shareTitle1,jdbcType=VARCHAR},
share_title2 = #{shareTitle2,jdbcType=VARCHAR},
status = #{status,jdbcType=TINYINT},
create_time = #{createTime,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>