|
@@ -0,0 +1,372 @@
|
|
1
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
3
|
+<mapper namespace="com.slodon.b2b2c.dao.write.live.LiveGoodsWriteMapper">
|
|
4
|
+ <resultMap id="resultMap" type="com.slodon.b2b2c.live.pojo.LiveGoods">
|
|
5
|
+ <id column="goodsId" property="goodsId" />
|
|
6
|
+ <result column="coverImgUrl" property="coverImgUrl" />
|
|
7
|
+ <result column="name" property="name" />
|
|
8
|
+ <result column="priceType" property="priceType" />
|
|
9
|
+ <result column="price" property="price" />
|
|
10
|
+ <result column="price2" property="price2" />
|
|
11
|
+ <result column="url" property="url" />
|
|
12
|
+ <result column="thirdPartyAppid" property="thirdPartyAppid" />
|
|
13
|
+ <result column="vendorId" property="vendorId" />
|
|
14
|
+ <result column="localGoodsId" property="localGoodsId" />
|
|
15
|
+ <result column="auditStatus" property="auditStatus" />
|
|
16
|
+ <result column="auditId" property="auditId" />
|
|
17
|
+ </resultMap>
|
|
18
|
+
|
|
19
|
+ <!--除主键外的所有字段,用于插入操作-->
|
|
20
|
+ <sql id="columns">
|
|
21
|
+ <trim suffixOverrides=",">
|
|
22
|
+ <if test="goodsId != null">
|
|
23
|
+ goodsId,
|
|
24
|
+ </if>
|
|
25
|
+ <if test="vendorId != null">
|
|
26
|
+ vendorId,
|
|
27
|
+ </if>
|
|
28
|
+ <if test="name != null">
|
|
29
|
+ name,
|
|
30
|
+ </if>
|
|
31
|
+ <if test="coverImgUrl != null">
|
|
32
|
+ coverImgUrl,
|
|
33
|
+ </if>
|
|
34
|
+ <if test="priceType != null">
|
|
35
|
+ priceType,
|
|
36
|
+ </if>
|
|
37
|
+ <if test="price != null">
|
|
38
|
+ price,
|
|
39
|
+ </if>
|
|
40
|
+ <if test="price2 != null">
|
|
41
|
+ price2,
|
|
42
|
+ </if>
|
|
43
|
+ <if test="url != null">
|
|
44
|
+ url,
|
|
45
|
+ </if>
|
|
46
|
+ <if test="thirdPartyAppid != null">
|
|
47
|
+ thirdPartyAppid,
|
|
48
|
+ </if>
|
|
49
|
+ <if test="localGoodsId != null">
|
|
50
|
+ localGoodsId,
|
|
51
|
+ </if>
|
|
52
|
+ <if test="auditStatus != null">
|
|
53
|
+ auditStatus,
|
|
54
|
+ </if>
|
|
55
|
+ <if test="auditId != null">
|
|
56
|
+ auditId,
|
|
57
|
+ </if>
|
|
58
|
+ </trim>
|
|
59
|
+ </sql>
|
|
60
|
+ <!--按照主键值进行操作-->
|
|
61
|
+ <sql id="pkWhere">
|
|
62
|
+ WHERE goodsId = #{primaryKey}
|
|
63
|
+ </sql>
|
|
64
|
+ <!--操作条件-->
|
|
65
|
+ <sql id="whereCondition">
|
|
66
|
+ <if test="example != null">
|
|
67
|
+ <trim prefix="WHERE" prefixOverrides="AND|OR">
|
|
68
|
+ <if test="example.coverImgUrl != null">
|
|
69
|
+ AND coverImgUrl = #{example.coverImgUrl}
|
|
70
|
+ </if>
|
|
71
|
+ <if test="example.vendorId != null">
|
|
72
|
+ AND vendorId = #{example.vendorId}
|
|
73
|
+ </if>
|
|
74
|
+ <if test="example.name != null">
|
|
75
|
+ AND name like concat('%',#{example.name},'%')
|
|
76
|
+ </if>
|
|
77
|
+ <if test="example.priceType != null">
|
|
78
|
+ AND priceType = #{example.priceType}
|
|
79
|
+ </if>
|
|
80
|
+ <if test="example.price != null">
|
|
81
|
+ AND price = #{example.price}
|
|
82
|
+ </if>
|
|
83
|
+ <if test="example.price2 != null">
|
|
84
|
+ AND price2 = #{example.price2}
|
|
85
|
+ </if>
|
|
86
|
+ <if test="example.url != null">
|
|
87
|
+ AND url = #{example.url}
|
|
88
|
+ </if>
|
|
89
|
+ <if test="example.thirdPartyAppid != null">
|
|
90
|
+ AND thirdPartyAppid = #{example.thirdPartyAppid}
|
|
91
|
+ </if>
|
|
92
|
+ <if test="example.localGoodsId != null">
|
|
93
|
+ AND localGoodsId = #{example.localGoodsId}
|
|
94
|
+ </if>
|
|
95
|
+ <if test="example.auditStatus != null">
|
|
96
|
+ AND auditStatus = #{example.auditStatus}
|
|
97
|
+ </if>
|
|
98
|
+ <if test="example.goodsId != null">
|
|
99
|
+ AND goodsId = #{example.goodsId}
|
|
100
|
+ </if>
|
|
101
|
+ <if test="example.auditId != null">
|
|
102
|
+ AND auditId = #{example.auditId}
|
|
103
|
+ </if>
|
|
104
|
+
|
|
105
|
+ </trim>
|
|
106
|
+ </if>
|
|
107
|
+ </sql>
|
|
108
|
+ <!--排序条件-->
|
|
109
|
+ <sql id="orderBy">
|
|
110
|
+ ORDER BY goodsId DESC
|
|
111
|
+ </sql>
|
|
112
|
+ <sql id="orderByOther">
|
|
113
|
+ order by #{example.orderBy}
|
|
114
|
+ </sql>
|
|
115
|
+ <!--分组条件-->
|
|
116
|
+ <sql id="groupBy">
|
|
117
|
+ group by #{example.groupBy}
|
|
118
|
+ </sql>
|
|
119
|
+ <!--分页条件-->
|
|
120
|
+ <sql id="limit">
|
|
121
|
+ <if test="size != null and size > 0">
|
|
122
|
+ limit #{startRow},#{size}
|
|
123
|
+ </if>
|
|
124
|
+ </sql>
|
|
125
|
+ <!--查询符合条件的记录数-->
|
|
126
|
+ <select id="countByExample" parameterType="com.slodon.b2b2c.live.example.LiveGoodsExample" resultType="java.lang.Integer">
|
|
127
|
+ SELECT
|
|
128
|
+ COUNT(*)
|
|
129
|
+ FROM live_goods
|
|
130
|
+ <include refid="whereCondition" />
|
|
131
|
+ </select>
|
|
132
|
+ <!--根据主键查询记录-->
|
|
133
|
+ <select id="getByPrimaryKey" resultMap="resultMap">
|
|
134
|
+ SELECT
|
|
135
|
+ *
|
|
136
|
+ FROM live_goods
|
|
137
|
+ <include refid="pkWhere" />
|
|
138
|
+ </select>
|
|
139
|
+ <!--查询符合条件的记录(所有字段)-->
|
|
140
|
+ <select id="listByExample" resultMap="resultMap">
|
|
141
|
+ SELECT
|
|
142
|
+ *
|
|
143
|
+ FROM live_goods
|
|
144
|
+ <include refid="whereCondition" />
|
|
145
|
+ <if test="example.groupBy != null">
|
|
146
|
+ <include refid="groupBy" />
|
|
147
|
+ </if>
|
|
148
|
+ <choose>
|
|
149
|
+ <when test="example.orderBy != null">
|
|
150
|
+ <include refid="orderByOther" />
|
|
151
|
+ </when>
|
|
152
|
+ <otherwise>
|
|
153
|
+ <include refid="orderBy" />
|
|
154
|
+ </otherwise>
|
|
155
|
+ </choose>
|
|
156
|
+ </select>
|
|
157
|
+ <!--分页查询符合条件的记录(所有字段)-->
|
|
158
|
+ <select id="listPageByExample" resultMap="resultMap">
|
|
159
|
+ SELECT
|
|
160
|
+ *
|
|
161
|
+ FROM live_goods
|
|
162
|
+ <include refid="whereCondition" />
|
|
163
|
+ <if test="example.groupBy != null">
|
|
164
|
+ <include refid="groupBy" />
|
|
165
|
+ </if>
|
|
166
|
+ <choose>
|
|
167
|
+ <when test="example.orderBy != null">
|
|
168
|
+ <include refid="orderByOther" />
|
|
169
|
+ </when>
|
|
170
|
+ <otherwise>
|
|
171
|
+ <include refid="orderBy" />
|
|
172
|
+ </otherwise>
|
|
173
|
+ </choose>
|
|
174
|
+ <include refid="limit" />
|
|
175
|
+ </select>
|
|
176
|
+ <!--查询符合条件的记录(指定字段)-->
|
|
177
|
+ <select id="listFieldsByExample" resultMap="resultMap">
|
|
178
|
+ SELECT
|
|
179
|
+ #{fields}
|
|
180
|
+ FROM live_goods
|
|
181
|
+ <include refid="whereCondition" />
|
|
182
|
+ <if test="example.groupBy != null">
|
|
183
|
+ <include refid="groupBy" />
|
|
184
|
+ </if>
|
|
185
|
+ <choose>
|
|
186
|
+ <when test="example.orderBy != null">
|
|
187
|
+ <include refid="orderByOther" />
|
|
188
|
+ </when>
|
|
189
|
+ <otherwise>
|
|
190
|
+ <include refid="orderBy" />
|
|
191
|
+ </otherwise>
|
|
192
|
+ </choose>
|
|
193
|
+ </select>
|
|
194
|
+ <!--分页查询符合条件的记录(指定字段)-->
|
|
195
|
+ <select id="listFieldsPageByExample" resultMap="resultMap">
|
|
196
|
+ SELECT
|
|
197
|
+ #{fields}
|
|
198
|
+ FROM live_goods
|
|
199
|
+ <include refid="whereCondition" />
|
|
200
|
+ <if test="example.groupBy != null">
|
|
201
|
+ <include refid="groupBy" />
|
|
202
|
+ </if>
|
|
203
|
+ <choose>
|
|
204
|
+ <when test="example.orderBy != null">
|
|
205
|
+ <include refid="orderByOther" />
|
|
206
|
+ </when>
|
|
207
|
+ <otherwise>
|
|
208
|
+ <include refid="orderBy" />
|
|
209
|
+ </otherwise>
|
|
210
|
+ </choose>
|
|
211
|
+ <include refid="limit" />
|
|
212
|
+ </select>
|
|
213
|
+ <select id="getLivesGoodsIds" resultType="java.lang.Integer">
|
|
214
|
+ select goodsId from live_goods where auditStatus = 1
|
|
215
|
+ </select>
|
|
216
|
+ <select id="getListRelation" resultMap="resultMap">
|
|
217
|
+ select lg.* from live_goods_relation rel
|
|
218
|
+ left join live_goods lg on rel.goodsId = lg.goodsId
|
|
219
|
+ where rel.roomId = #{roomId}
|
|
220
|
+ <if test="name != null">
|
|
221
|
+ AND lg.name = #{name}
|
|
222
|
+ </if>
|
|
223
|
+ </select>
|
|
224
|
+ <!--根据条件删除记录,可多条删除-->
|
|
225
|
+ <delete id="deleteByExample">
|
|
226
|
+ DELETE FROM live_goods
|
|
227
|
+ <include refid="whereCondition" />
|
|
228
|
+ </delete>
|
|
229
|
+ <!--根据主键删除记录-->
|
|
230
|
+ <delete id="deleteByPrimaryKey">
|
|
231
|
+ DELETE FROM live_goods
|
|
232
|
+ <include refid="pkWhere" />
|
|
233
|
+ </delete>
|
|
234
|
+ <!--插入一条记录-->
|
|
235
|
+ <insert id="insert" keyColumn="roomId" keyProperty="roomId" parameterType="com.slodon.b2b2c.live.pojo.LiveGoods" useGeneratedKeys="true">
|
|
236
|
+ INSERT INTO live_goods(
|
|
237
|
+ <include refid="columns" />
|
|
238
|
+ )
|
|
239
|
+ VALUES(
|
|
240
|
+ <trim suffixOverrides=",">
|
|
241
|
+ <if test="goodsId != null">
|
|
242
|
+ #{goodsId},
|
|
243
|
+ </if>
|
|
244
|
+ <if test="vendorId != null">
|
|
245
|
+ #{vendorId},
|
|
246
|
+ </if>
|
|
247
|
+ <if test="name != null">
|
|
248
|
+ #{name},
|
|
249
|
+ </if>
|
|
250
|
+ <if test="coverImgUrl != null">
|
|
251
|
+ #{coverImgUrl},
|
|
252
|
+ </if>
|
|
253
|
+ <if test="priceType != null">
|
|
254
|
+ #{priceType},
|
|
255
|
+ </if>
|
|
256
|
+ <if test="price != null">
|
|
257
|
+ #{price},
|
|
258
|
+ </if>
|
|
259
|
+ <if test="price2 != null">
|
|
260
|
+ #{price2},
|
|
261
|
+ </if>
|
|
262
|
+ <if test="url != null">
|
|
263
|
+ #{url},
|
|
264
|
+ </if>
|
|
265
|
+ <if test="thirdPartyAppid != null">
|
|
266
|
+ #{thirdPartyAppid},
|
|
267
|
+ </if>
|
|
268
|
+ <if test="localGoodsId != null">
|
|
269
|
+ #{localGoodsId},
|
|
270
|
+ </if>
|
|
271
|
+ <if test="auditStatus != null">
|
|
272
|
+ #{auditStatus},
|
|
273
|
+ </if>
|
|
274
|
+ <if test="auditId != null">
|
|
275
|
+ #{auditId},
|
|
276
|
+ </if>
|
|
277
|
+
|
|
278
|
+ </trim>
|
|
279
|
+ )
|
|
280
|
+ </insert>
|
|
281
|
+ <!--按条件更新记录中不为空的字段-->
|
|
282
|
+ <update id="updateByExampleSelective">
|
|
283
|
+ UPDATE live_goods
|
|
284
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
285
|
+ <if test="record.goodsId != null">
|
|
286
|
+ AND goodsId = #{record.goodsId},
|
|
287
|
+ </if>
|
|
288
|
+ <if test="record.vendorId != null">
|
|
289
|
+ AND vendorId = #{record.vendorId},
|
|
290
|
+ </if>
|
|
291
|
+ <if test="record.name != null">
|
|
292
|
+ AND name = #{record.name},
|
|
293
|
+ </if>
|
|
294
|
+ <if test="record.coverImgUrl != null">
|
|
295
|
+ AND coverImgUrl = #{record.coverImgUrl},
|
|
296
|
+ </if>
|
|
297
|
+ <if test="record.priceType != null">
|
|
298
|
+ AND priceType = #{record.priceType},
|
|
299
|
+ </if>
|
|
300
|
+ <if test="record.price != null">
|
|
301
|
+ AND price = #{record.price},
|
|
302
|
+ </if>
|
|
303
|
+ <if test="record.price2 != null">
|
|
304
|
+ AND price2 = #{record.price2},
|
|
305
|
+ </if>
|
|
306
|
+ <if test="record.url != null">
|
|
307
|
+ AND url = #{record.url},
|
|
308
|
+ </if>
|
|
309
|
+ <if test="record.thirdPartyAppid != null">
|
|
310
|
+ AND thirdPartyAppid = #{record.thirdPartyAppid},
|
|
311
|
+ </if>
|
|
312
|
+ <if test="record.localGoodsId != null">
|
|
313
|
+ AND localGoodsId = #{record.localGoodsId},
|
|
314
|
+ </if>
|
|
315
|
+ <if test="record.auditStatus != null">
|
|
316
|
+ AND auditStatus = #{record.auditStatus},
|
|
317
|
+ </if>
|
|
318
|
+ <if test="record.auditId != null">
|
|
319
|
+ AND auditId = #{record.auditId},
|
|
320
|
+ </if>
|
|
321
|
+
|
|
322
|
+ </trim>
|
|
323
|
+ <include refid="whereCondition" />
|
|
324
|
+ </update>
|
|
325
|
+ <!--按照主键更新记录中不为空的字段-->
|
|
326
|
+ <update id="updateByPrimaryKeySelective">
|
|
327
|
+ UPDATE live_goods
|
|
328
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
329
|
+ <if test="vendorId != null">
|
|
330
|
+ AND vendorId = #{vendorId},
|
|
331
|
+ </if>
|
|
332
|
+ <if test="name != null">
|
|
333
|
+ AND name = #{name},
|
|
334
|
+ </if>
|
|
335
|
+ <if test="coverImgUrl != null">
|
|
336
|
+ AND coverImgUrl = #{coverImgUrl},
|
|
337
|
+ </if>
|
|
338
|
+ <if test="priceType != null">
|
|
339
|
+ AND priceType = #{priceType},
|
|
340
|
+ </if>
|
|
341
|
+ <if test="price != null">
|
|
342
|
+ AND price = #{price},
|
|
343
|
+ </if>
|
|
344
|
+ <if test="price2 != null">
|
|
345
|
+ AND price2 = #{price2},
|
|
346
|
+ </if>
|
|
347
|
+ <if test="url != null">
|
|
348
|
+ AND url = #{url},
|
|
349
|
+ </if>
|
|
350
|
+ <if test="thirdPartyAppid != null">
|
|
351
|
+ AND thirdPartyAppid = #{thirdPartyAppid},
|
|
352
|
+ </if>
|
|
353
|
+ <if test="localGoodsId != null">
|
|
354
|
+ AND localGoodsId = #{localGoodsId},
|
|
355
|
+ </if>
|
|
356
|
+ <if test="auditStatus != null">
|
|
357
|
+ AND auditStatus = #{auditStatus},
|
|
358
|
+ </if>
|
|
359
|
+ <if test="auditId != null">
|
|
360
|
+ AND auditId = #{auditId},
|
|
361
|
+ </if>
|
|
362
|
+ </trim>
|
|
363
|
+ WHERE goodsId = #{goodsId}
|
|
364
|
+ </update>
|
|
365
|
+ <update id="updateLivesGoodsType">
|
|
366
|
+ <foreach collection="liveGoodsList" item="item" index="index">
|
|
367
|
+ update live_goods set
|
|
368
|
+ auditStatus=#{item.auditStatus}
|
|
369
|
+ where goodsId = #{item.goodsId};
|
|
370
|
+ </foreach>
|
|
371
|
+ </update>
|
|
372
|
+</mapper>
|