ActivityTemplateMapper.xml
4.71 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?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.yohobuy.platform.dal.cms.IActivityTemplateDao">
<resultMap id="BaseResultMap" type="com.yohobuy.platform.dal.cms.model.ActivityTemplate">
<id column="id" jdbcType="TINYINT" property="id" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="image" jdbcType="VARCHAR" property="image" />
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="share_id" jdbcType="INTEGER" property="shareId" />
<result column="status" jdbcType="TINYINT" property="status" />
<result column="create_time" jdbcType="INTEGER" property="createTime" />
<result column="update_time" jdbcType="INTEGER" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
id, title, image, url, share_id, status, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from activity_template
where id = #{id,jdbcType=TINYINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from activity_template
where id = #{id,jdbcType=TINYINT}
</delete>
<insert id="insert" parameterType="com.yohobuy.platform.dal.cms.model.ActivityTemplate">
insert into activity_template (title, image, url, share_id, status, create_time)
values ( #{title,jdbcType=VARCHAR}, #{image,jdbcType=VARCHAR},
#{url,jdbcType=VARCHAR}, #{shareId,jdbcType=INTEGER}, #{status,jdbcType=TINYINT},UNIX_TIMESTAMP())
</insert>
<insert id="insertSelective" parameterType="com.yohobuy.platform.dal.cms.model.ActivityTemplate">
insert into activity_template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null">
title,
</if>
<if test="image != null">
image,
</if>
<if test="url != null">
url,
</if>
<if test="shareId != null">
share_id,
</if>
<if test="status != null">
status,
</if>
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="image != null">
#{image,jdbcType=VARCHAR},
</if>
<if test="url != null">
#{url,jdbcType=VARCHAR},
</if>
<if test="shareId != null">
#{shareId,jdbcType=INTEGER},
</if>
<if test="status != null">
#{status,jdbcType=TINYINT},
</if>
UNIX_TIMESTAMP()
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yohobuy.platform.dal.cms.model.ActivityTemplate">
update activity_template
<set>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="image != null">
image = #{image,jdbcType=VARCHAR},
</if>
<if test="url != null">
url = #{url,jdbcType=VARCHAR},
</if>
<if test="shareId != null">
share_id = #{shareId,jdbcType=INTEGER},
</if>
<if test="status != null">
status = #{status,jdbcType=TINYINT},
</if>
<if test="updateTime != null">
update_time =UNIX_TIMESTAMP(),
</if>
</set>
where id = #{id,jdbcType=TINYINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.yohobuy.platform.dal.cms.model.ActivityTemplate">
update activity_template
set title = #{title,jdbcType=VARCHAR},
image = #{image,jdbcType=VARCHAR},
url = #{url,jdbcType=VARCHAR},
share_id = #{shareId,jdbcType=INTEGER},
update_time = UNIX_TIMESTAMP()
where id = #{id,jdbcType=TINYINT}
</update>
<select id="selectByStatusAndTitle" parameterType="java.lang.Byte" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from activity_template
<where>
1=1
<if test="status != null and (status == 1 || status == 0)" >
and status = #{status}
</if>
<if test="title != null" >
and title like CONCAT('%',#{title,jdbcType=VARCHAR},'%')
</if>
</where>
order by id DESC
Limit #{startIndex,jdbcType=INTEGER}, #{length,jdbcType=INTEGER}
</select>
<select id="selectByStatusAndTitleCount" resultType="java.lang.Integer" parameterType="java.lang.Byte">
select count(0) from activity_template
<where>
1=1
<if test="status != null and (status == 1 || status == 0)" >
and status = #{status}
</if>
<if test="title != null" >
and title like CONCAT('%',#{title,jdbcType=VARCHAR},'%')
</if>
</where>
</select>
</mapper>