FsCourseWatchCommentMapper.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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.FsCourseWatchCommentMapper">
  6. <resultMap type="FsCourseWatchComment" id="FsCourseWatchCommentResult">
  7. <result property="commentId" column="comment_id" />
  8. <result property="userId" column="user_id" />
  9. <result property="userType" column="user_type" />
  10. <result property="courseId" column="course_id" />
  11. <result property="videoId" column="video_id" />
  12. <result property="type" column="type" />
  13. <result property="parentId" column="parent_id" />
  14. <result property="content" column="content" />
  15. <result property="createTime" column="create_time" />
  16. <result property="updateTime" column="update_time" />
  17. <result property="isRevoke" column="is_revoke" />
  18. <result property="time" column="time" />
  19. <result property="fontSize" column="font_size" />
  20. <result property="mode" column="mode" />
  21. <result property="color" column="color" />
  22. </resultMap>
  23. <sql id="selectFsCourseWatchCommentVo">
  24. select comment_id, user_id, user_type, course_id, video_id, type, parent_id, content, create_time, update_time, is_revoke, `time`,
  25. font_size, mode, color from fs_course_watch_comment
  26. </sql>
  27. <select id="selectFsCourseWatchCommentList" parameterType="FsCourseWatchComment" resultMap="FsCourseWatchCommentResult">
  28. <include refid="selectFsCourseWatchCommentVo"/>
  29. <where>
  30. <if test="userId != null "> and user_id = #{userId}</if>
  31. <if test="userType != null "> and user_type = #{userType}</if>
  32. <if test="courseId != null "> and course_id = #{courseId}</if>
  33. <if test="videoId != null "> and video_id = #{videoId}</if>
  34. <if test="type != null "> and type = #{type}</if>
  35. <if test="parentId != null "> and parent_id = #{parentId}</if>
  36. <if test="content != null and content != ''"> and content = #{content}</if>
  37. <if test="isRevoke != null "> and is_revoke = #{isRevoke}</if>
  38. </where>
  39. </select>
  40. <select id="selectFsCourseWatchCommentByCommentId" parameterType="Long" resultMap="FsCourseWatchCommentResult">
  41. <include refid="selectFsCourseWatchCommentVo"/>
  42. where comment_id = #{commentId}
  43. </select>
  44. <insert id="insertFsCourseWatchComment" parameterType="FsCourseWatchComment" useGeneratedKeys="true" keyProperty="commentId">
  45. insert into fs_course_watch_comment
  46. <trim prefix="(" suffix=")" suffixOverrides=",">
  47. <if test="userId != null">user_id,</if>
  48. <if test="userType != null">user_type,</if>
  49. <if test="courseId != null">course_id,</if>
  50. <if test="videoId != null">video_id,</if>
  51. <if test="type != null">type,</if>
  52. <if test="parentId != null">parent_id,</if>
  53. <if test="content != null">content,</if>
  54. <if test="createTime != null">create_time,</if>
  55. <if test="updateTime != null">update_time,</if>
  56. <if test="isRevoke != null">is_revoke,</if>
  57. <if test="time != null">`time`,</if>
  58. <if test="fontSize != null">font_size,</if>
  59. <if test="mode != null">mode,</if>
  60. <if test="color != null">color,</if>
  61. </trim>
  62. <trim prefix="values (" suffix=")" suffixOverrides=",">
  63. <if test="userId != null">#{userId},</if>
  64. <if test="userType != null">#{userType},</if>
  65. <if test="courseId != null">#{courseId},</if>
  66. <if test="videoId != null">#{videoId},</if>
  67. <if test="type != null">#{type},</if>
  68. <if test="parentId != null">#{parentId},</if>
  69. <if test="content != null">#{content},</if>
  70. <if test="createTime != null">#{createTime},</if>
  71. <if test="updateTime != null">#{updateTime},</if>
  72. <if test="isRevoke != null">#{isRevoke},</if>
  73. <if test="time != null">#{time},</if>
  74. <if test="fontSize != null">#{fontSize},</if>
  75. <if test="mode != null">#{mode},</if>
  76. <if test="color != null">#{color},</if>
  77. </trim>
  78. </insert>
  79. <update id="updateFsCourseWatchComment" parameterType="FsCourseWatchComment">
  80. update fs_course_watch_comment
  81. <trim prefix="SET" suffixOverrides=",">
  82. <if test="userId != null">user_id = #{userId},</if>
  83. <if test="userType != null">user_type = #{userType},</if>
  84. <if test="courseId != null">course_id = #{courseId},</if>
  85. <if test="videoId != null">video_id = #{videoId},</if>
  86. <if test="type != null">type = #{type},</if>
  87. <if test="parentId != null">parent_id = #{parentId},</if>
  88. <if test="content != null">content = #{content},</if>
  89. <if test="createTime != null">create_time = #{createTime},</if>
  90. <if test="updateTime != null">update_time = #{updateTime},</if>
  91. <if test="isRevoke != null">is_revoke = #{isRevoke},</if>
  92. <if test="time != null">`time` = #{time},</if>
  93. <if test="fontSize != null">font_size = #{fontSize},</if>
  94. <if test="mode != null">mode = #{mode},</if>
  95. <if test="color != null">color = #{color},</if>
  96. </trim>
  97. where comment_id = #{commentId}
  98. </update>
  99. <delete id="deleteFsCourseWatchCommentByCommentId" parameterType="Long">
  100. delete from fs_course_watch_comment where comment_id = #{commentId}
  101. </delete>
  102. <delete id="deleteFsCourseWatchCommentByCommentIds" parameterType="String">
  103. delete from fs_course_watch_comment where comment_id in
  104. <foreach item="commentId" collection="array" open="(" separator="," close=")">
  105. #{commentId}
  106. </foreach>
  107. </delete>
  108. <select id="selectH5CourseWatchComments" resultType="com.fs.course.vo.FsCourseWatchCommentVO">
  109. select cwc.comment_id, cwc.user_id, cwc.user_type, cwc.course_id, cwc.video_id, cwc.type, cwc.content, cwc.create_time,
  110. fs_user.nick_name,cwc.time,cwc.font_size, cwc.mode, cwc.color from fs_course_watch_comment cwc
  111. left join fs_user on fs_user.user_id = cwc.user_id
  112. <where>
  113. and cwc.is_revoke = 0
  114. <if test="courseId != null">
  115. and cwc.course_id = #{courseId}
  116. </if>
  117. <if test="videoId != null">
  118. and cwc.video_id = #{videoId}
  119. </if>
  120. </where>
  121. order by cwc.create_time desc
  122. </select>
  123. </mapper>