251 lines
7.0 KiB
XML
251 lines
7.0 KiB
XML
<?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.wzj.soopin.content.mapper.VlogMapper">
|
|
<!-- 通用更新 -->
|
|
<update id="dynamicUpdate">
|
|
UPDATE t_vlog
|
|
<set>
|
|
<foreach collection="updateFields" index="key" item="value" separator=",">
|
|
${key} = #{value}
|
|
</foreach>
|
|
</set>
|
|
WHERE ${primaryKey} = #{idValue}
|
|
</update>
|
|
|
|
<update id="updateVlogByConditions">
|
|
UPDATE t_vlog
|
|
<set>
|
|
<foreach collection="updates" item="value" index="key" separator=",">
|
|
${key} = #{value}
|
|
</foreach>
|
|
</set>
|
|
<where>
|
|
<foreach collection="conditions" item="value" index="key" separator=" AND ">
|
|
<choose>
|
|
<!-- 处理null值条件 -->
|
|
<when test="value == null">
|
|
${key} IS NULL
|
|
</when>
|
|
<!-- 处理IN条件 -->
|
|
<when test="value instanceof java.util.Collection">
|
|
${key} IN
|
|
<foreach collection="value" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</when>
|
|
<!-- 处理普通条件 -->
|
|
<otherwise>
|
|
${key} = #{value}
|
|
</otherwise>
|
|
</choose>
|
|
</foreach>
|
|
</where>
|
|
</update>
|
|
|
|
<!-- 单条插入 -->
|
|
<insert id="dynamicInsert">
|
|
INSERT INTO t_vlog
|
|
<foreach collection="vlogData.keys" item="key" open="(" separator="," close=")">
|
|
${key}
|
|
</foreach>
|
|
VALUES
|
|
<foreach collection="vlogData.values" item="value" open="(" separator="," close=")">
|
|
#{value}
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 批量插入 -->
|
|
<insert id="dynamicBatchInsert">
|
|
INSERT INTO t_vlog
|
|
<foreach collection="vlogList[0].keys" item="key" open="(" separator="," close=")">
|
|
${key}
|
|
</foreach>
|
|
VALUES
|
|
<foreach collection="vlogList" item="vlogData" separator=",">
|
|
<foreach collection="vlogData.values" item="value" open="(" separator="," close=")">
|
|
#{value}
|
|
</foreach>
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 查询 -->
|
|
<select id="selectMyPublic" parameterType="map" resultType="com.wzj.soopin.content.domain.vo.IndexVlogVO">
|
|
SELECT
|
|
v.id as vlogId,
|
|
v.vloger_id as vlogerId,
|
|
u.face as vlogerFace,
|
|
u.nickname as vlogerName,
|
|
v.title as content,
|
|
v.url as url,
|
|
v.cover as cover,
|
|
v.width as width,
|
|
v.height as height,
|
|
v.like_counts as likeCounts,
|
|
v.comments_counts as commentsCounts,
|
|
v.is_private as isPrivate,
|
|
v.city_code as cityCode,
|
|
v.reason as reason,
|
|
v.file_id as fileId,
|
|
v.status as status,
|
|
v.first_frame_img as firstFrameImg,
|
|
v.id as vlogId
|
|
FROM
|
|
t_vlog v
|
|
LEFT JOIN
|
|
t_users u
|
|
ON
|
|
v.vloger_id = u.id
|
|
WHERE
|
|
v.is_private = 0
|
|
AND v.vloger_id = #{paramMap.vlogerId}
|
|
<choose>
|
|
<when test="paramMap.status != null and paramMap.status!=''">
|
|
AND v.status = #{paramMap.status}
|
|
</when>
|
|
<otherwise>
|
|
AND v.status = 1
|
|
</otherwise>
|
|
</choose>
|
|
<if test="paramMap.cityCode != null and paramMap.cityCode != ''">
|
|
AND v.city_code = #{paramMap.cityCode}
|
|
</if>
|
|
<if test="paramMap.search != null and paramMap.search != ''">
|
|
AND v.title like '%${paramMap.search}%'
|
|
</if>
|
|
<if test="paramMap.blockVd != null and paramMap.blockVd.size() > 0">
|
|
AND v.id NOT IN
|
|
<foreach collection="paramMap.blockVd" item="vlogId" open="(" separator="," close=")">
|
|
#{vlogId}
|
|
</foreach>
|
|
</if>
|
|
ORDER BY
|
|
v.created_time
|
|
DESC
|
|
</select>
|
|
|
|
|
|
<select id="getVlogDetailFromId" parameterType="map" resultType="com.wzj.soopin.content.domain.vo.IndexVlogVO">
|
|
SELECT
|
|
v.id as vlogId,
|
|
v.vloger_id as vlogerId,
|
|
u.face as vlogerFace,
|
|
u.nickname as vlogerName,
|
|
v.title as content,
|
|
v.url as url,
|
|
v.cover as cover,
|
|
v.width as width,
|
|
v.height as height,
|
|
v.like_counts as likeCounts,
|
|
v.comments_counts as commentsCounts,
|
|
v.is_private as isPrivate,
|
|
v.city_code as cityCode,
|
|
v.reason as reason,
|
|
v.file_id as fileId,
|
|
v.status as status,
|
|
v.first_frame_img as firstFrameImg,
|
|
v.id as vlogId
|
|
FROM
|
|
t_vlog v
|
|
LEFT JOIN
|
|
t_users u
|
|
ON
|
|
v.vloger_id = u.id
|
|
WHERE
|
|
v.id = #{paramMap.vlogId}
|
|
AND v.status = 1
|
|
AND v.first_frame_img IS NOT NULL
|
|
</select>
|
|
|
|
<!-- 更新视频审核状态 -->
|
|
<update id="updateVlogStatus">
|
|
UPDATE t_vlog
|
|
SET status = #{params.status},
|
|
reason = #{params.reason},
|
|
audit_time = #{params.auditTime}
|
|
WHERE id = #{params.vlogId}
|
|
</update>
|
|
|
|
<!-- 根据fileId查询Vlog信息 -->
|
|
<select id="selectByFileId" parameterType="String" resultType="com.wzj.soopin.content.domain.po.Vlog">
|
|
/* @SqlParser(filter=true) */
|
|
SELECT * FROM t_vlog WHERE file_id = #{fileId}
|
|
</select>
|
|
|
|
<select id="selectVlogList" resultType="java.util.Map">
|
|
SELECT
|
|
v.id,
|
|
v.vloger_id,
|
|
v.url as mediaUrl,
|
|
v.cover,
|
|
v.title,
|
|
v.width,
|
|
v.height,
|
|
v.like_counts as likeCounts,
|
|
v.comments_counts as commentCounts,
|
|
v.is_private,
|
|
v.status,
|
|
v.file_id,
|
|
v.reason,
|
|
v.city_code,
|
|
v.first_frame_img as coverUrl,
|
|
v.create_time,
|
|
v.update_time,
|
|
m.mobile,
|
|
m.nickname
|
|
FROM
|
|
t_vlog v
|
|
LEFT JOIN t_users m ON v.vloger_id = m.id
|
|
<where>
|
|
<if test="params.mobile != null and params.mobile != ''">
|
|
AND m.mobile LIKE CONCAT('%', #{params.mobile}, '%')
|
|
</if>
|
|
<if test="params.nickname != null and params.nickname != ''">
|
|
AND m.nickname LIKE CONCAT('%', #{params.nickname}, '%')
|
|
</if>
|
|
<if test="params.title != null and params.title != ''">
|
|
AND v.title LIKE CONCAT('%', #{params.title}, '%')
|
|
</if>
|
|
<if test="params.status != null">
|
|
AND v.status = #{params.status}
|
|
</if>
|
|
<if test="params.startTime != null">
|
|
AND v.create_time >= #{params.startTime}
|
|
</if>
|
|
<if test="params.endTime != null">
|
|
AND v.create_time <= #{params.endTime}
|
|
</if>
|
|
</where>
|
|
ORDER BY v.create_time DESC
|
|
</select>
|
|
|
|
<select id="selectByMobileAndVlogId" resultType="com.wzj.soopin.content.domain.vo.CommentVO">
|
|
SELECT
|
|
c.id,
|
|
c.id as commentId,
|
|
c.vloger_id as vlogerId,
|
|
c.father_comment_id as fatherCommentId,
|
|
c.vlog_id as vlogId,
|
|
c.comment_user_id as commentUserId,
|
|
u.nickname as commentUserNickname,
|
|
u.face as commentUserFace,
|
|
c.content,
|
|
c.like_counts as likeCounts,
|
|
c.create_time as createTime
|
|
FROM t_comment c
|
|
LEFT JOIN t_users u ON c.comment_user_id = u.id
|
|
<where>
|
|
c.father_comment_id = '0'
|
|
<if test="vlogId != null and vlogId != ''">
|
|
AND c.vlog_id = #{vlogId}
|
|
</if>
|
|
<if test="mobile != null and mobile != ''">
|
|
AND u.mobile LIKE CONCAT('%', #{mobile}, '%')
|
|
</if>
|
|
</where>
|
|
ORDER BY c.create_time DESC
|
|
</select>
|
|
|
|
</mapper>
|
|
|