BrandMapper.xml
7.15 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<?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.search.dal.BrandMapper">
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.Brand">
<id column="id" property="id" jdbcType="INTEGER" />
<result column="brand_name" property="brandName" jdbcType="VARCHAR" />
<result column="brand_domain" property="brandDomain" jdbcType="VARCHAR" />
<result column="brand_alif" property="brandAlif" jdbcType="VARCHAR" />
<result column="brand_ico" property="brandIco" jdbcType="VARCHAR" />
<result column="is_hot" property="isHot" jdbcType="CHAR" />
<result column="brand_name_cn" jdbcType="VARCHAR" property="brandNameCn" />
<result column="brand_name_en" jdbcType="VARCHAR" property="brandNameEn" />
<result column="brand_keyword" jdbcType="VARCHAR" property="brandKeyword" />
<result column="hot_keyword" jdbcType="VARCHAR" property="hotKeyword" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="country_id" property="countryId" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
id, brand_name, brand_domain, brand_alif, brand_ico,
is_hot,
brand_name_cn, brand_name_en,
brand_keyword, hot_keyword,status,country_id
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
parameterType="java.lang.Integer" timeout="20000">
select
<include refid="Base_Column_List" />
from brand
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"
timeout="20000">
delete from brand
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.search.dal.model.Brand"
timeout="20000">
insert ignore into brand (id, brand_name, brand_domain,
brand_alif,
brand_ico, is_hot,
brand_name_cn, brand_name_en, brand_keyword,
hot_keyword,status,country_id)
values (#{id,jdbcType=INTEGER},
#{brandName,jdbcType=VARCHAR},
#{brandDomain,jdbcType=VARCHAR},
#{brandAlif,jdbcType=VARCHAR}, #{brandIco,jdbcType=VARCHAR},
#{isHot,jdbcType=CHAR},
#{brandNameCn,jdbcType=VARCHAR},
#{brandNameEn,jdbcType=VARCHAR},
#{brandKeyword,jdbcType=VARCHAR},
#{hotKeyword,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},#{countryId,jdbcType=INTEGER})
</insert>
<insert id="insertbatch" parameterType="java.util.List" timeout="20000">
insert ignore into brand (id, brand_name, brand_domain,
brand_alif, brand_ico,
is_hot,
brand_name_cn, brand_name_en, brand_keyword,
hot_keyword,status,country_id) values
<foreach collection="list" item="item" index="index"
separator=",">
(#{item.id,jdbcType=INTEGER},
#{item.brandName,jdbcType=VARCHAR},
#{item.brandDomain,jdbcType=VARCHAR},
#{item.brandAlif,jdbcType=VARCHAR},
#{item.brandIco,jdbcType=VARCHAR}, #{item.isHot,jdbcType=CHAR},
#{item.brandNameCn,jdbcType=VARCHAR},
#{item.brandNameEn,jdbcType=VARCHAR},
#{item.brandKeyword,jdbcType=VARCHAR},
#{item.hotKeyword,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},#{item.countryId,jdbcType=INTEGER}
)
</foreach>
</insert>
<insert id="insertSelective" parameterType="com.yoho.search.dal.model.Brand"
timeout="20000">
insert ignore into brand
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="brandName != null">
brand_name,
</if>
<if test="brandDomain != null">
brand_domain,
</if>
<if test="brandAlif != null">
brand_alif,
</if>
<if test="brandIco != null">
brand_ico,
</if>
<if test="isHot != null">
is_hot,
</if>
<if test="brandNameCn != null">
brand_name_cn,
</if>
<if test="brandNameEn != null">
brand_name_en,
</if>
<if test="brandKeyword != null">
brand_keyword,
</if>
<if test="hotKeyword != null">
hot_keyword,
</if>
<if test="status != null">
status,
</if>
<if test="countryId != null">
country_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="brandName != null">
#{brandName,jdbcType=VARCHAR},
</if>
<if test="brandDomain != null">
#{brandDomain,jdbcType=VARCHAR},
</if>
<if test="brandAlif != null">
#{brandAlif,jdbcType=VARCHAR},
</if>
<if test="brandIco != null">
#{brandIco,jdbcType=VARCHAR},
</if>
<if test="isHot != null">
#{isHot,jdbcType=CHAR},
</if>
<if test="brandNameCn != null">
#{brandNameCn,jdbcType=VARCHAR},
</if>
<if test="brandNameEn != null">
#{brandNameEn,jdbcType=VARCHAR},
</if>
<if test="brandKeyword != null">
#{brandKeyword,jdbcType=VARCHAR},
</if>
<if test="hotKeyword != null">
#{hotKeyword,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="countryId != null">
#{countryId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.Brand"
timeout="20000">
update brand
<set>
<if test="brandName != null">
brand_name = #{brandName,jdbcType=VARCHAR},
</if>
<if test="brandDomain != null">
brand_domain = #{brandDomain,jdbcType=VARCHAR},
</if>
<if test="brandAlif != null">
brand_alif = #{brandAlif,jdbcType=VARCHAR},
</if>
<if test="brandIco != null">
brand_ico = #{brandIco,jdbcType=VARCHAR},
</if>
<if test="isHot != null">
is_hot = #{isHot,jdbcType=CHAR},
</if>
<if test="brandNameCn != null">
brand_name_cn = #{brandNameCn,jdbcType=VARCHAR},
</if>
<if test="brandNameEn != null">
brand_name_en = #{brandNameEn,jdbcType=VARCHAR},
</if>
<if test="brandKeyword != null">
brand_keyword = #{brandKeyword,jdbcType=VARCHAR},
</if>
<if test="hotKeyword != null">
hot_keyword = #{hotKeyword,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="countryId != null">
country_id = #{countryId,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.Brand" timeout="20000">
update brand
set
brand_name = #{brandName,jdbcType=VARCHAR},
brand_domain =
#{brandDomain,jdbcType=VARCHAR},
brand_alif =
#{brandAlif,jdbcType=VARCHAR},
brand_ico =
#{brandIco,jdbcType=VARCHAR},
is_hot = #{isHot,jdbcType=CHAR},
brand_name_cn = #{brandNameCn,jdbcType=VARCHAR},
brand_name_en =
#{brandNameEn,jdbcType=VARCHAR},
brand_keyword =
#{brandKeyword,jdbcType=VARCHAR},
hot_keyword =
#{hotKeyword,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
country_id = #{countryId,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="count" resultType="java.lang.Integer" timeout="20000" >
SELECT count(1) FROM brand
</select>
<select id="getBrandPageLists" resultMap="BaseResultMap" timeout="20000">
select
<include refid="Base_Column_List" />
from brand limit #{offset},#{pageSize}
</select>
<select id="getAll" resultMap="BaseResultMap" timeout="20000">
select
<include refid="Base_Column_List" />
from brand
</select>
</mapper>