|
@@ -0,0 +1,178 @@
|
|
|
+<?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.FsCourseWatchCommentMapper">
|
|
|
+
|
|
|
+ <resultMap type="FsCourseWatchComment" id="FsCourseWatchCommentResult">
|
|
|
+ <result property="commentId" column="comment_id" />
|
|
|
+ <result property="userId" column="user_id" />
|
|
|
+ <result property="userType" column="user_type" />
|
|
|
+ <result property="courseId" column="course_id" />
|
|
|
+ <result property="videoId" column="video_id" />
|
|
|
+ <result property="type" column="type" />
|
|
|
+ <result property="parentId" column="parent_id" />
|
|
|
+ <result property="content" column="content" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ <result property="isRevoke" column="is_revoke" />
|
|
|
+ <result property="time" column="time" />
|
|
|
+ <result property="fontSize" column="font_size" />
|
|
|
+ <result property="mode" column="mode" />
|
|
|
+ <result property="color" column="color" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectFsCourseWatchCommentVo">
|
|
|
+ select comment_id, user_id, user_type, course_id, video_id, type, parent_id, content, create_time, update_time, is_revoke, `time`,
|
|
|
+ font_size, mode, color from fs_course_watch_comment
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectFsCourseWatchCommentList" resultType="com.fs.course.vo.FsCourseWatchCommentListVO">
|
|
|
+ SELECT
|
|
|
+ fs_course_watch_comment.comment_id,
|
|
|
+ fs_course_watch_comment.user_id,
|
|
|
+ fs_course_watch_comment.user_type,
|
|
|
+ fs_course_watch_comment.course_id,
|
|
|
+ fs_course_watch_comment.video_id,
|
|
|
+ fs_course_watch_comment.type,
|
|
|
+ fs_course_watch_comment.parent_id,
|
|
|
+ fs_course_watch_comment.content,
|
|
|
+ fs_course_watch_comment.create_time,
|
|
|
+ fs_course_watch_comment.update_time,
|
|
|
+ fs_course_watch_comment.is_revoke,
|
|
|
+ fs_course_watch_comment.`time`,
|
|
|
+ fs_course_watch_comment.font_size,
|
|
|
+ fs_course_watch_comment.`mode`,
|
|
|
+ fs_course_watch_comment.color,
|
|
|
+ fs_user.nick_name
|
|
|
+ <if test="isAll != null and isAll == true ">
|
|
|
+ ,fs_user_course.course_name, fs_user_course_video.title
|
|
|
+ </if>
|
|
|
+ FROM
|
|
|
+ fs_course_watch_comment
|
|
|
+ LEFT JOIN fs_user ON fs_user.user_id = fs_course_watch_comment.user_id
|
|
|
+ <if test="isAll != null and isAll == true">
|
|
|
+ LEFT JOIN fs_user_course on fs_user_course.course_id = fs_course_watch_comment.course_id
|
|
|
+ LEFT JOIN fs_user_course_video on fs_user_course_video.video_id = fs_course_watch_comment.video_id
|
|
|
+ </if>
|
|
|
+ <where>
|
|
|
+ <if test="courseId != null "> and fs_course_watch_comment.course_id = #{courseId}</if>
|
|
|
+ <if test="videoId != null "> and fs_course_watch_comment.video_id = #{videoId}</if>
|
|
|
+ <if test="nickName != null and nickName != '' ">and fs_user.nick_name like concat('%', #{nickName}, '%')</if>
|
|
|
+ <if test="isAll != null and isAll == true and keywords != null and keywords !='' ">
|
|
|
+ AND (fs_user.nickname LIKE concat('%',#{keywords},'%')
|
|
|
+ or fs_user_course.course_name LIKE concat('%',#{keywords},'%')
|
|
|
+ or fs_user_course_video.title LIKE concat('%',#{keywords},'%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectFsCourseWatchCommentByCommentId" parameterType="Long" resultMap="FsCourseWatchCommentResult">
|
|
|
+ <include refid="selectFsCourseWatchCommentVo"/>
|
|
|
+ where comment_id = #{commentId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertFsCourseWatchComment" parameterType="FsCourseWatchComment" useGeneratedKeys="true" keyProperty="commentId">
|
|
|
+ insert into fs_course_watch_comment
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="userId != null">user_id,</if>
|
|
|
+ <if test="userType != null">user_type,</if>
|
|
|
+ <if test="courseId != null">course_id,</if>
|
|
|
+ <if test="videoId != null">video_id,</if>
|
|
|
+ <if test="type != null">type,</if>
|
|
|
+ <if test="parentId != null">parent_id,</if>
|
|
|
+ <if test="content != null">content,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ <if test="isRevoke != null">is_revoke,</if>
|
|
|
+ <if test="time != null">`time`,</if>
|
|
|
+ <if test="fontSize != null">font_size,</if>
|
|
|
+ <if test="mode != null">mode,</if>
|
|
|
+ <if test="color != null">color,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="userId != null">#{userId},</if>
|
|
|
+ <if test="userType != null">#{userType},</if>
|
|
|
+ <if test="courseId != null">#{courseId},</if>
|
|
|
+ <if test="videoId != null">#{videoId},</if>
|
|
|
+ <if test="type != null">#{type},</if>
|
|
|
+ <if test="parentId != null">#{parentId},</if>
|
|
|
+ <if test="content != null">#{content},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ <if test="isRevoke != null">#{isRevoke},</if>
|
|
|
+ <if test="time != null">#{time},</if>
|
|
|
+ <if test="fontSize != null">#{fontSize},</if>
|
|
|
+ <if test="mode != null">#{mode},</if>
|
|
|
+ <if test="color != null">#{color},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateFsCourseWatchComment" parameterType="FsCourseWatchComment">
|
|
|
+ update fs_course_watch_comment
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="userId != null">user_id = #{userId},</if>
|
|
|
+ <if test="userType != null">user_type = #{userType},</if>
|
|
|
+ <if test="courseId != null">course_id = #{courseId},</if>
|
|
|
+ <if test="videoId != null">video_id = #{videoId},</if>
|
|
|
+ <if test="type != null">type = #{type},</if>
|
|
|
+ <if test="parentId != null">parent_id = #{parentId},</if>
|
|
|
+ <if test="content != null">content = #{content},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ <if test="isRevoke != null">is_revoke = #{isRevoke},</if>
|
|
|
+ <if test="time != null">`time` = #{time},</if>
|
|
|
+ <if test="fontSize != null">font_size = #{fontSize},</if>
|
|
|
+ <if test="mode != null">mode = #{mode},</if>
|
|
|
+ <if test="color != null">color = #{color},</if>
|
|
|
+ </trim>
|
|
|
+ where comment_id = #{commentId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteFsCourseWatchCommentByCommentId" parameterType="Long">
|
|
|
+ delete from fs_course_watch_comment where comment_id = #{commentId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteFsCourseWatchCommentByCommentIds" parameterType="String">
|
|
|
+ delete from fs_course_watch_comment where comment_id in
|
|
|
+ <foreach item="commentId" collection="array" open="(" separator="," close=")">
|
|
|
+ #{commentId}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <select id="selectH5CourseWatchComments" resultType="com.fs.course.vo.FsCourseWatchCommentVO">
|
|
|
+ select cwc.comment_id, cwc.user_id, cwc.user_type, cwc.course_id, cwc.video_id, cwc.type, cwc.content, cwc.create_time,
|
|
|
+ fs_user.nick_name,cwc.time,cwc.font_size, cwc.mode, cwc.color from fs_course_watch_comment cwc
|
|
|
+ left join fs_user on fs_user.user_id = cwc.user_id
|
|
|
+ <where>
|
|
|
+ and cwc.is_revoke = 0
|
|
|
+ <if test="courseId != null">
|
|
|
+ and cwc.course_id = #{courseId}
|
|
|
+ </if>
|
|
|
+ <if test="videoId != null">
|
|
|
+ and cwc.video_id = #{videoId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by cwc.create_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectH5CourseWatchCommentsRound" resultType="com.fs.course.vo.FsCourseWatchCommentVO">
|
|
|
+ select * from (
|
|
|
+ select cwc.comment_id, cwc.user_id, cwc.user_type, cwc.course_id, cwc.video_id, cwc.type, cwc.content,
|
|
|
+ cwc.create_time,
|
|
|
+ fs_user.nick_name,cwc.time,cwc.font_size, cwc.mode, cwc.color from fs_course_watch_comment cwc
|
|
|
+ left join fs_user on fs_user.user_id = cwc.user_id
|
|
|
+ <where>
|
|
|
+ and cwc.is_revoke = 0
|
|
|
+ <if test="courseId != null">
|
|
|
+ and cwc.course_id = #{courseId}
|
|
|
+ </if>
|
|
|
+ <if test="videoId != null">
|
|
|
+ and cwc.video_id = #{videoId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ORDER BY RAND() LIMIT #{listNum}
|
|
|
+ ) a
|
|
|
+ </select>
|
|
|
+</mapper>
|