FsVideoBarrageMapper.xml 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.fs.course.mapper.FsVideoBarrageMapper">
  6. <resultMap type="FsVideoBarrage" id="FsVideoBarrageResult">
  7. <result property="id" column="id" />
  8. <result property="videoId" column="video_id" />
  9. <result property="content" column="content" />
  10. <result property="timePoint" column="time_point" />
  11. <result property="userId" column="user_id" />
  12. <result property="username" column="username" />
  13. <result property="platform" column="platform" />
  14. <result property="createTime" column="create_time" />
  15. <result property="status" column="status" />
  16. <result property="duration" column="duration" />
  17. <result property="isPrior" column="is_prior" />
  18. <result property="isColor" column="is_color" />
  19. <result property="color" column="color" />
  20. <result property="mode" column="mode" />
  21. <result property="fontSize" column="font_size" />
  22. </resultMap>
  23. <sql id="selectFsVideoBarrageVo">
  24. 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
  25. </sql>
  26. <select id="selectFsVideoBarrageList" parameterType="com.fs.course.param.FsVideoBarrageQueryParam" resultType="com.fs.course.vo.FsVideoBarrageVO">
  27. 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,
  28. b.is_color,b.color,b.mode,b.font_size ,v.title video_title
  29. from fs_video_barrage b
  30. LEFT JOIN fs_user_course_video v on b.video_id = v.video_id
  31. <where>
  32. <if test="videoId != null "> and b.video_id = #{videoId}</if>
  33. <if test="content != null and content != ''"> and b.content = #{content}</if>
  34. <if test="timePoint != null "> and b.time_point = #{timePoint}</if>
  35. <if test="userId != null "> and b.user_id = #{userId}</if>
  36. <if test="username != null and username != ''"> and b.username like concat('%', #{username}, '%')</if>
  37. <if test="platform != null and platform != ''"> and b.platform = #{platform}</if>
  38. <if test="status != null "> and b.status = #{status}</if>
  39. <if test="duration != null "> and b.duration = #{duration}</if>
  40. <if test="isPrior != null "> and b.is_prior = #{isPrior}</if>
  41. <if test="isColor != null "> and b.is_color = #{isColor}</if>
  42. <if test="color != null "> and b.color = #{color}</if>
  43. <if test="mode != null "> and b.mode = #{mode}</if>
  44. <if test="fontSize != null "> and b.font_size = #{fontSize}</if>
  45. <if test="keyword != null and keyword !=''"> and (b.content like concat('%',#{keyword},'%') or v.title like concat('%',#{keyword},'%'))</if>
  46. </where>
  47. </select>
  48. <select id="selectFsVideoBarrageList_COUNT" parameterType="com.fs.course.param.FsVideoBarrageQueryParam" resultType="long">
  49. select count(*) from fs_video_barrage b
  50. <if test="videoId != null or (keyword != null and keyword !='')">
  51. LEFT JOIN fs_user_course_video v on b.video_id = v.video_id
  52. </if>
  53. <where>
  54. <if test="videoId != null "> and b.video_id = #{videoId}</if>
  55. <if test="content != null and content != ''"> and b.content = #{content}</if>
  56. <if test="timePoint != null "> and b.time_point = #{timePoint}</if>
  57. <if test="userId != null "> and b.user_id = #{userId}</if>
  58. <if test="username != null and username != ''"> and b.username like concat('%', #{username}, '%')</if>
  59. <if test="platform != null and platform != ''"> and b.platform = #{platform}</if>
  60. <if test="status != null "> and b.status = #{status}</if>
  61. <if test="duration != null "> and b.duration = #{duration}</if>
  62. <if test="isPrior != null "> and b.is_prior = #{isPrior}</if>
  63. <if test="isColor != null "> and b.is_color = #{isColor}</if>
  64. <if test="color != null "> and b.color = #{color}</if>
  65. <if test="mode != null "> and b.mode = #{mode}</if>
  66. <if test="fontSize != null "> and b.font_size = #{fontSize}</if>
  67. <if test="keyword != null and keyword !=''"> and (b.content like concat('%',#{keyword},'%') or v.title like concat('%',#{keyword},'%'))</if>
  68. </where>
  69. </select>
  70. <select id="selectFsVideoBarrageById" parameterType="String" resultMap="FsVideoBarrageResult">
  71. <include refid="selectFsVideoBarrageVo"/>
  72. where id = #{id}
  73. </select>
  74. <select id="selectByVideoId" resultMap="FsVideoBarrageResult">
  75. <include refid="selectFsVideoBarrageVo"/>
  76. WHERE video_id = #{videoId} AND status = 1 ORDER BY time_point ASC
  77. </select>
  78. <select id="selectBySegment" resultType="com.fs.course.domain.FsVideoBarrage">
  79. <include refid="selectFsVideoBarrageVo"/>
  80. WHERE video_id = #{videoId} AND time_point BETWEEN #{start} AND #{end} AND status = 1
  81. </select>
  82. <insert id="insertFsVideoBarrage" parameterType="FsVideoBarrage" useGeneratedKeys="true" keyProperty="id">
  83. insert into fs_video_barrage
  84. <trim prefix="(" suffix=")" suffixOverrides=",">
  85. <if test="videoId != null">video_id,</if>
  86. <if test="content != null and content != ''">content,</if>
  87. <if test="timePoint != null">time_point,</if>
  88. <if test="userId != null">user_id,</if>
  89. <if test="username != null">username,</if>
  90. <if test="platform != null">platform,</if>
  91. <if test="createTime != null">create_time,</if>
  92. <if test="status != null">status,</if>
  93. <if test="duration != null">duration,</if>
  94. <if test="isPrior != null">is_prior,</if>
  95. <if test="isColor != null">is_color,</if>
  96. <if test="color != null">color,</if>
  97. <if test="mode != null">mode,</if>
  98. <if test="fontSize != null">font_size,</if>
  99. </trim>
  100. <trim prefix="values (" suffix=")" suffixOverrides=",">
  101. <if test="videoId != null">#{videoId},</if>
  102. <if test="content != null and content != ''">#{content},</if>
  103. <if test="timePoint != null">#{timePoint},</if>
  104. <if test="userId != null">#{userId},</if>
  105. <if test="username != null">#{username},</if>
  106. <if test="platform != null">#{platform},</if>
  107. <if test="createTime != null">#{createTime},</if>
  108. <if test="status != null">#{status},</if>
  109. <if test="duration != null">#{duration},</if>
  110. <if test="isPrior != null">#{isPrior},</if>
  111. <if test="isColor != null">#{isColor},</if>
  112. <if test="color != null">#{color},</if>
  113. <if test="mode != null">#{mode},</if>
  114. <if test="fontSize != null">#{fontSize},</if>
  115. </trim>
  116. </insert>
  117. <insert id="insertBarrage">
  118. INSERT INTO
  119. fs_video_barrage(video_id, content, time_point, user_id, username, platform, status,duration,is_prior,is_color,color,mode,font_size) VALUES
  120. (#{videoId}, #{content}, #{timePoint}, #{userId}, #{username}, #{platform}, 1,#{duration}, #{isPrior},#{isColor},#{color},#{mode},#{fontSize})
  121. </insert>
  122. <update id="updateFsVideoBarrage" parameterType="FsVideoBarrage">
  123. update fs_video_barrage
  124. <trim prefix="SET" suffixOverrides=",">
  125. <if test="videoId != null">video_id = #{videoId},</if>
  126. <if test="content != null and content != ''">content = #{content},</if>
  127. <if test="timePoint != null">time_point = #{timePoint},</if>
  128. <if test="userId != null">user_id = #{userId},</if>
  129. <if test="username != null">username = #{username},</if>
  130. <if test="platform != null">platform = #{platform},</if>
  131. <if test="createTime != null">create_time = #{createTime},</if>
  132. <if test="status != null">status = #{status},</if>
  133. <if test="duration != null">duration = #{duration},</if>
  134. <if test="isPrior != null">is_prior = #{isPrior},</if>
  135. <if test="isColor != null">is_color = #{isColor},</if>
  136. <if test="color != null">color = #{color},</if>
  137. <if test="mode != null">mode = #{mode},</if>
  138. <if test="fontSize != null">font_size = #{fontSize},</if>
  139. </trim>
  140. where id = #{id}
  141. </update>
  142. <update id="updateStatus">
  143. update fs_video_barrage set status = #{status} where id = #{id}
  144. </update>
  145. <update id="batchUpdateStatus">
  146. UPDATE fs_video_barrage
  147. SET status = #{status}
  148. WHERE id IN
  149. <foreach collection="ids" item="id" open="(" separator="," close=")">
  150. #{id}
  151. </foreach>
  152. </update>
  153. <delete id="deleteFsVideoBarrageById" parameterType="String">
  154. delete from fs_video_barrage where id = #{id}
  155. </delete>
  156. <delete id="deleteFsVideoBarrageByIds" parameterType="String">
  157. delete from fs_video_barrage where id in
  158. <foreach item="id" collection="array" open="(" separator="," close=")">
  159. #{id}
  160. </foreach>
  161. </delete>
  162. </mapper>