LiveMapper.xml
13.6 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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
<?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.bjivt.entity.showtime.Live">
<resultMap id="BaseResultMap" type="com.bjivt.entity.showtime.Live">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="user_id" jdbcType="INTEGER" property="userId" />
<result column="record_addr" jdbcType="VARCHAR" property="recordAddr" />
<result column="chatroom_addr" jdbcType="VARCHAR" property="chatroomAddr" />
<result column="video_addr" jdbcType="VARCHAR" property="videoAddr" />
<result column="audience_total_num" jdbcType="INTEGER" property="audienceTotalNum" />
<result column="audience_now_num" jdbcType="INTEGER" property="audienceNowNum" />
<result column="heartbeat" jdbcType="BIGINT" property="heartbeat" />
<result column="like_num" jdbcType="INTEGER" property="likeNum" />
<result column="tag" jdbcType="VARCHAR" property="tag" />
<result column="is_allow_location" jdbcType="SMALLINT" property="isAllowLocation" />
<result column="type" jdbcType="SMALLINT" property="type" />
<result column="location" jdbcType="VARCHAR" property="location" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="ended_time" jdbcType="TIMESTAMP" property="endedTime" />
<result column="recommend" jdbcType="INTEGER" property="recommend" />
<result column="active" jdbcType="SMALLINT" property="active" />
<result column="thumbnail" jdbcType="VARCHAR" property="thumbnail" />
</resultMap>
<sql id="Base_Column_List">
id, name, user_id, record_addr, chatroom_addr, video_addr, audience_total_num, audience_now_num,
heartbeat, like_num, tag, is_allow_location, type, location, create_time, recommend,
active,thumbnail
</sql>
<select id="selectById" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tbl_live_list
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteById" parameterType="java.lang.Integer">
delete from tbl_live_list
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.bjivt.entity.showtime.Live">
insert into tbl_live_list (id, name, user_id,
record_addr, chatroom_addr, video_addr,
audience_total_num, audience_now_num, heartbeat,
like_num, tag, is_allow_location,
type, location, create_time,
recommend, active)
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{userId,jdbcType=INTEGER},
#{recordAddr,jdbcType=VARCHAR}, #{chatroomAddr,jdbcType=VARCHAR}, #{videoAddr,jdbcType=VARCHAR},
#{audienceTotalNum,jdbcType=INTEGER}, #{audienceNowNum,jdbcType=INTEGER}, #{heartbeat,jdbcType=BIGINT},
#{likeNum,jdbcType=INTEGER}, #{tag,jdbcType=VARCHAR}, #{isAllowLocation,jdbcType=SMALLINT},
#{type,jdbcType=SMALLINT}, #{location,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{recommend,jdbcType=INTEGER}, #{active,jdbcType=SMALLINT})
</insert>
<insert id="insertSelective" parameterType="com.bjivt.entity.showtime.Live">
insert into tbl_live_list
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="userId != null">
user_id,
</if>
<if test="recordAddr != null">
record_addr,
</if>
<if test="chatroomAddr != null">
chatroom_addr,
</if>
<if test="videoAddr != null">
video_addr,
</if>
<if test="audienceTotalNum != null">
audience_total_num,
</if>
<if test="audienceNowNum != null">
audience_now_num,
</if>
<if test="heartbeat != null">
heartbeat,
</if>
<if test="likeNum != null">
like_num,
</if>
<if test="tag != null">
tag,
</if>
<if test="isAllowLocation != null">
is_allow_location,
</if>
<if test="type != null">
type,
</if>
<if test="location != null">
location,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="recommend != null">
recommend,
</if>
<if test="active != null">
active,
</if>
<if test="endedTime != null">
ended_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="userId != null">
#{userId,jdbcType=INTEGER},
</if>
<if test="recordAddr != null">
#{recordAddr,jdbcType=VARCHAR},
</if>
<if test="chatroomAddr != null">
#{chatroomAddr,jdbcType=VARCHAR},
</if>
<if test="videoAddr != null">
#{videoAddr,jdbcType=VARCHAR},
</if>
<if test="audienceTotalNum != null">
#{audienceTotalNum,jdbcType=INTEGER},
</if>
<if test="audienceNowNum != null">
#{audienceNowNum,jdbcType=INTEGER},
</if>
<if test="heartbeat != null">
#{heartbeat,jdbcType=BIGINT},
</if>
<if test="likeNum != null">
#{likeNum,jdbcType=INTEGER},
</if>
<if test="tag != null">
#{tag,jdbcType=VARCHAR},
</if>
<if test="isAllowLocation != null">
#{isAllowLocation,jdbcType=SMALLINT},
</if>
<if test="type != null">
#{type,jdbcType=SMALLINT},
</if>
<if test="location != null">
#{location,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="recommend != null">
#{recommend,jdbcType=INTEGER},
</if>
<if test="active != null">
#{active,jdbcType=SMALLINT},
</if>
<if test="endedTime != null">
#{endedTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByIdSelective" parameterType="com.bjivt.entity.showtime.Live">
update tbl_live_list
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="recordAddr != null">
record_addr = #{recordAddr,jdbcType=VARCHAR},
</if>
<if test="chatroomAddr != null">
chatroom_addr = #{chatroomAddr,jdbcType=VARCHAR},
</if>
<if test="videoAddr != null">
video_addr = #{videoAddr,jdbcType=VARCHAR},
</if>
<if test="audienceTotalNum != null">
audience_total_num = #{audienceTotalNum,jdbcType=INTEGER},
</if>
<if test="audienceNowNum != null">
audience_now_num = #{audienceNowNum,jdbcType=INTEGER},
</if>
<if test="heartbeat != null">
heartbeat = #{heartbeat,jdbcType=BIGINT},
</if>
<if test="likeNum != null">
like_num = #{likeNum,jdbcType=INTEGER},
</if>
<if test="tag != null">
tag = #{tag,jdbcType=VARCHAR},
</if>
<if test="isAllowLocation != null">
is_allow_location = #{isAllowLocation,jdbcType=SMALLINT},
</if>
<if test="type != null">
type = #{type,jdbcType=SMALLINT},
</if>
<if test="location != null">
location = #{location,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="recommend != null">
recommend = #{recommend,jdbcType=INTEGER},
</if>
<if test="active != null">
active = #{active,jdbcType=SMALLINT},
</if>
<if test="endedTime != null">
ended_time = #{endedTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateById" parameterType="com.bjivt.entity.showtime.Live">
update tbl_live_list
set name = #{name,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=INTEGER},
record_addr = #{recordAddr,jdbcType=VARCHAR},
chatroom_addr = #{chatroomAddr,jdbcType=VARCHAR},
video_addr = #{videoAddr,jdbcType=VARCHAR},
audience_total_num = #{audienceTotalNum,jdbcType=INTEGER},
audience_now_num = #{audienceNowNum,jdbcType=INTEGER},
heartbeat = #{heartbeat,jdbcType=BIGINT},
like_num = #{likeNum,jdbcType=INTEGER},
tag = #{tag,jdbcType=VARCHAR},
is_allow_location = #{isAllowLocation,jdbcType=SMALLINT},
type = #{type,jdbcType=SMALLINT},
location = #{location,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
recommend = #{recommend,jdbcType=INTEGER},
active = #{active,jdbcType=SMALLINT},
ended_time = #{endedTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="getCountBy" resultType="java.lang.Integer" parameterType="com.bjivt.entity.showtime.Live">
SELECT
count(id)
FROM
tbl_live_list
<trim prefix="where" prefixOverrides="and|or">
<if test="userId != null and userId != ''" >
and tbl_live_list.user_id = #{userId}
</if>
<if test="name != null and name != ''" >
and from_base64(tbl_live_list.name) like '%${name}%'
</if>
<if test="recommend!= null and recommend!= ''" >
and tbl_live_list.recommend = #{recommend}
</if>
</trim>
</select>
<select id="findListByMap" resultMap="BaseResultMap" parameterType="java.util.Map">
SELECT
<include refid="Base_Column_List"/>
FROM
tbl_live_list
<trim prefix="where" prefixOverrides="and|or">
<if test="Live.userId!= null and Live.userId!= ''" >
and tbl_live_list.user_id = #{Live.userId}
</if>
<if test="Live.recommend!= null and Live.recommend!= ''" >
and tbl_live_list.recommend = #{Live.recommend}
</if>
<if test="Live.name!=null and Live.name!= ''" >
and from_base64(tbl_live_list.name) like '%${Live.name}%'
</if>
<if test="startTime != null and startTime !='' and endTime != null and endTime !=''">
and date_format(tbl_live_list.create_time,'%Y-%m-%d') between str_to_date(#{startTime},'%Y-%m-%d') and str_to_date(#{endTime},'%Y-%m-%d')
</if>
</trim>
order by create_time DESC
<if test="page != null and page !=''">
<if test="page.from != null and page.size != null">
limit #{page.from},#{page.size}
</if>
</if>
</select>
<select id="getStarLiveCountBy" resultType="java.lang.Integer" parameterType="com.bjivt.entity.showtime.Live">
SELECT
count(tbl.id)
FROM
tbl_live_list tbl
LEFT JOIN tbl_user_list tbu ON tbu.id = tbl.user_id
where 1=1
<if test="userId!= null and userId!= ''" >
and tbl.user_id = #{userId}
</if>
<if test="recommend!= null and recommend!= ''" >
and tbl.recommend = #{recommend}
</if>
<if test="name!=null and name!= ''" >
and from_base64(tbl.name) like '%${name}%'
</if>
</select>
<select id="findStarLiveListByPage" resultMap="BaseResultMap" parameterType="java.util.Map">
SELECT
tbl.id, tbl.name, tbl.user_id, tbl.record_addr, tbl.chatroom_addr, tbl.video_addr, tbl.audience_total_num, tbl.audience_now_num,
tbl.heartbeat, tbl.like_num, tbl.tag, tbl.is_allow_location, tbl.type, tbl.location, tbl.create_time, tbl.recommend,
tbl.active
FROM
tbl_live_list tbl
LEFT JOIN tbl_user_list tbu ON tbu.id = tbl.user_id
where 1=1
<if test="Live.userId!= null and Live.userId!= ''" >
and tbl.user_id = #{Live.userId}
</if>
<if test="Live.recommend!= null and Live.recommend!= ''" >
and tbl.recommend = #{Live.recommend}
</if>
<if test="Live.name!=null and Live.name!= ''" >
and from_base64(tbl.name) like '%${Live.name}%'
</if>
order by tbl.create_time DESC
<if test="page != null and page !=''">
<if test="page.from != null and page.size != null">
limit #{page.from},#{page.size}
</if>
</if>
</select>
<select id="findLiveListByPage" resultMap="BaseResultMap" parameterType="java.util.Map">
SELECT
tbl.id, tbl.name, tbl.user_id, tbl.record_addr, tbl.chatroom_addr, tbl.video_addr, tbl.audience_total_num, tbl.audience_now_num,
tbl.heartbeat, tbl.like_num, tbl.tag, tbl.is_allow_location, tbl.type, tbl.location, tbl.create_time, tbl.recommend, tbl.ended_time,
tbl.active
FROM
tbl_live_list tbl
LEFT JOIN tbl_user_list tbu ON tbu.id = tbl.user_id
where 1=1
<if test="Live.userId!= null and Live.userId!= ''" >
and tbl.user_id = #{Live.userId}
</if>
<if test="Live.recommend!= null and Live.recommend!= ''" >
and tbl.recommend = #{Live.recommend}
</if>
<if test="Live.name!=null and Live.name!= ''" >
and from_base64(tbl.name) like '%${Live.name}%'
</if>
<if test="startTime!=null and startTime!=''">
and
<![CDATA[date_format(tbl.create_time,'%Y-%m-%d') >= str_to_date(#{startTime},'%Y-%m-%d') ]]>
<![CDATA[and date_format(tbl.create_time,'%Y-%m-%d') <= str_to_date(#{endTime},'%Y-%m-%d')]]>
</if>
order by tbl.create_time DESC
<if test="page != null and page !=''">
<if test="page.from != null and page.size != null">
limit #{page.from},#{page.size}
</if>
</if>
</select>
</mapper>