|
@@ -0,0 +1,171 @@
|
|
|
+<?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.fs.course.mapper.FsVideoBarrageMapper">
|
|
|
+
|
|
|
+ <resultMap type="FsVideoBarrage" id="FsVideoBarrageResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="videoId" column="video_id" />
|
|
|
+ <result property="content" column="content" />
|
|
|
+ <result property="timePoint" column="time_point" />
|
|
|
+ <result property="userId" column="user_id" />
|
|
|
+ <result property="username" column="username" />
|
|
|
+ <result property="platform" column="platform" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="status" column="status" />
|
|
|
+ <result property="duration" column="duration" />
|
|
|
+ <result property="isPrior" column="is_prior" />
|
|
|
+ <result property="isColor" column="is_color" />
|
|
|
+ <result property="color" column="color" />
|
|
|
+ <result property="mode" column="mode" />
|
|
|
+ <result property="fontSize" column="font_size" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectFsVideoBarrageVo">
|
|
|
+ select id, video_id, content, time_point, user_id, username, platform, create_time, status,duration,is_prior,is_color,color,mode,font_size from fs_video_barrage
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectFsVideoBarrageList" parameterType="com.fs.course.param.FsVideoBarrageQueryParam" resultType="com.fs.course.vo.FsVideoBarrageVO">
|
|
|
+ select b.id, b.video_id, b.content, b.time_point, b.username, b.platform, b.create_time, b.status,b.duration,b.is_prior,
|
|
|
+ b.is_color,b.color,b.mode,b.font_size ,v.title video_title
|
|
|
+ from fs_video_barrage b
|
|
|
+ LEFT JOIN fs_user_course_video v on b.video_id = v.video_id
|
|
|
+ <where>
|
|
|
+ <if test="videoId != null "> and b.video_id = #{videoId}</if>
|
|
|
+ <if test="content != null and content != ''"> and b.content = #{content}</if>
|
|
|
+ <if test="timePoint != null "> and b.time_point = #{timePoint}</if>
|
|
|
+ <if test="userId != null "> and b.user_id = #{userId}</if>
|
|
|
+ <if test="username != null and username != ''"> and b.username like concat('%', #{username}, '%')</if>
|
|
|
+ <if test="platform != null and platform != ''"> and b.platform = #{platform}</if>
|
|
|
+ <if test="status != null "> and b.status = #{status}</if>
|
|
|
+ <if test="duration != null "> and b.duration = #{duration}</if>
|
|
|
+ <if test="isPrior != null "> and b.is_prior = #{isPrior}</if>
|
|
|
+ <if test="isColor != null "> and b.is_color = #{isColor}</if>
|
|
|
+ <if test="color != null "> and b.color = #{color}</if>
|
|
|
+ <if test="mode != null "> and b.mode = #{mode}</if>
|
|
|
+ <if test="fontSize != null "> and b.font_size = #{fontSize}</if>
|
|
|
+ <if test="keyword != null and keyword !=''"> and (b.content like concat('%',#{keyword},'%') or v.title like concat('%',#{keyword},'%'))</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectFsVideoBarrageList_COUNT" parameterType="com.fs.course.param.FsVideoBarrageQueryParam" resultType="long">
|
|
|
+ select count(*) from fs_video_barrage b
|
|
|
+ <if test="videoId != null or (keyword != null and keyword !='')">
|
|
|
+ LEFT JOIN fs_user_course_video v on b.video_id = v.video_id
|
|
|
+ </if>
|
|
|
+ <where>
|
|
|
+ <if test="videoId != null "> and b.video_id = #{videoId}</if>
|
|
|
+ <if test="content != null and content != ''"> and b.content = #{content}</if>
|
|
|
+ <if test="timePoint != null "> and b.time_point = #{timePoint}</if>
|
|
|
+ <if test="userId != null "> and b.user_id = #{userId}</if>
|
|
|
+ <if test="username != null and username != ''"> and b.username like concat('%', #{username}, '%')</if>
|
|
|
+ <if test="platform != null and platform != ''"> and b.platform = #{platform}</if>
|
|
|
+ <if test="status != null "> and b.status = #{status}</if>
|
|
|
+ <if test="duration != null "> and b.duration = #{duration}</if>
|
|
|
+ <if test="isPrior != null "> and b.is_prior = #{isPrior}</if>
|
|
|
+ <if test="isColor != null "> and b.is_color = #{isColor}</if>
|
|
|
+ <if test="color != null "> and b.color = #{color}</if>
|
|
|
+ <if test="mode != null "> and b.mode = #{mode}</if>
|
|
|
+ <if test="fontSize != null "> and b.font_size = #{fontSize}</if>
|
|
|
+ <if test="keyword != null and keyword !=''"> and (b.content like concat('%',#{keyword},'%') or v.title like concat('%',#{keyword},'%'))</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectFsVideoBarrageById" parameterType="String" resultMap="FsVideoBarrageResult">
|
|
|
+ <include refid="selectFsVideoBarrageVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+ <select id="selectByVideoId" resultMap="FsVideoBarrageResult">
|
|
|
+ <include refid="selectFsVideoBarrageVo"/>
|
|
|
+ WHERE video_id = #{videoId} AND status = 1 ORDER BY time_point ASC
|
|
|
+ </select>
|
|
|
+ <select id="selectBySegment" resultType="com.fs.course.domain.FsVideoBarrage">
|
|
|
+ <include refid="selectFsVideoBarrageVo"/>
|
|
|
+ WHERE video_id = #{videoId} AND time_point BETWEEN #{start} AND #{end} AND status = 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertFsVideoBarrage" parameterType="FsVideoBarrage" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into fs_video_barrage
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="videoId != null">video_id,</if>
|
|
|
+ <if test="content != null and content != ''">content,</if>
|
|
|
+ <if test="timePoint != null">time_point,</if>
|
|
|
+ <if test="userId != null">user_id,</if>
|
|
|
+ <if test="username != null">username,</if>
|
|
|
+ <if test="platform != null">platform,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="status != null">status,</if>
|
|
|
+ <if test="duration != null">duration,</if>
|
|
|
+ <if test="isPrior != null">is_prior,</if>
|
|
|
+ <if test="isColor != null">is_color,</if>
|
|
|
+ <if test="color != null">color,</if>
|
|
|
+ <if test="mode != null">mode,</if>
|
|
|
+ <if test="fontSize != null">font_size,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="videoId != null">#{videoId},</if>
|
|
|
+ <if test="content != null and content != ''">#{content},</if>
|
|
|
+ <if test="timePoint != null">#{timePoint},</if>
|
|
|
+ <if test="userId != null">#{userId},</if>
|
|
|
+ <if test="username != null">#{username},</if>
|
|
|
+ <if test="platform != null">#{platform},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="status != null">#{status},</if>
|
|
|
+ <if test="duration != null">#{duration},</if>
|
|
|
+ <if test="isPrior != null">#{isPrior},</if>
|
|
|
+ <if test="isColor != null">#{isColor},</if>
|
|
|
+ <if test="color != null">#{color},</if>
|
|
|
+ <if test="mode != null">#{mode},</if>
|
|
|
+ <if test="fontSize != null">#{fontSize},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+ <insert id="insertBarrage">
|
|
|
+ INSERT INTO
|
|
|
+ fs_video_barrage(video_id, content, time_point, user_id, username, platform, status,duration,is_prior,is_color,color,mode,font_size) VALUES
|
|
|
+ (#{videoId}, #{content}, #{timePoint}, #{userId}, #{username}, #{platform}, 1,#{duration}, #{isPrior},#{isColor},#{color},#{mode},#{fontSize})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateFsVideoBarrage" parameterType="FsVideoBarrage">
|
|
|
+ update fs_video_barrage
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="videoId != null">video_id = #{videoId},</if>
|
|
|
+ <if test="content != null and content != ''">content = #{content},</if>
|
|
|
+ <if test="timePoint != null">time_point = #{timePoint},</if>
|
|
|
+ <if test="userId != null">user_id = #{userId},</if>
|
|
|
+ <if test="username != null">username = #{username},</if>
|
|
|
+ <if test="platform != null">platform = #{platform},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="status != null">status = #{status},</if>
|
|
|
+ <if test="duration != null">duration = #{duration},</if>
|
|
|
+ <if test="isPrior != null">is_prior = #{isPrior},</if>
|
|
|
+ <if test="isColor != null">is_color = #{isColor},</if>
|
|
|
+ <if test="color != null">color = #{color},</if>
|
|
|
+ <if test="mode != null">mode = #{mode},</if>
|
|
|
+ <if test="fontSize != null">font_size = #{fontSize},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+ <update id="updateStatus">
|
|
|
+ update fs_video_barrage set status = #{status} where id = #{id}
|
|
|
+ </update>
|
|
|
+ <update id="batchUpdateStatus">
|
|
|
+ UPDATE fs_video_barrage
|
|
|
+ SET status = #{status}
|
|
|
+ WHERE id IN
|
|
|
+ <foreach collection="ids" item="id" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteFsVideoBarrageById" parameterType="String">
|
|
|
+ delete from fs_video_barrage where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteFsVideoBarrageByIds" parameterType="String">
|
|
|
+ delete from fs_video_barrage where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+</mapper>
|