FsCourseWatchCommentMapper.xml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. </resultMap>
  19. <sql id="selectFsCourseWatchCommentVo">
  20. select comment_id, user_id, user_type, course_id, video_id, type, parent_id, content, create_time, update_time, is_revoke from fs_course_watch_comment
  21. </sql>
  22. <select id="selectFsCourseWatchCommentList" parameterType="FsCourseWatchComment" resultMap="FsCourseWatchCommentResult">
  23. <include refid="selectFsCourseWatchCommentVo"/>
  24. <where>
  25. <if test="userId != null "> and user_id = #{userId}</if>
  26. <if test="userType != null "> and user_type = #{userType}</if>
  27. <if test="courseId != null "> and course_id = #{courseId}</if>
  28. <if test="videoId != null "> and video_id = #{videoId}</if>
  29. <if test="type != null "> and type = #{type}</if>
  30. <if test="parentId != null "> and parent_id = #{parentId}</if>
  31. <if test="content != null and content != ''"> and content = #{content}</if>
  32. <if test="isRevoke != null "> and is_revoke = #{isRevoke}</if>
  33. </where>
  34. </select>
  35. <select id="selectFsCourseWatchCommentByCommentId" parameterType="Long" resultMap="FsCourseWatchCommentResult">
  36. <include refid="selectFsCourseWatchCommentVo"/>
  37. where comment_id = #{commentId}
  38. </select>
  39. <insert id="insertFsCourseWatchComment" parameterType="FsCourseWatchComment" useGeneratedKeys="true" keyProperty="commentId">
  40. insert into fs_course_watch_comment
  41. <trim prefix="(" suffix=")" suffixOverrides=",">
  42. <if test="userId != null">user_id,</if>
  43. <if test="userType != null">user_type,</if>
  44. <if test="courseId != null">course_id,</if>
  45. <if test="videoId != null">video_id,</if>
  46. <if test="type != null">type,</if>
  47. <if test="parentId != null">parent_id,</if>
  48. <if test="content != null">content,</if>
  49. <if test="createTime != null">create_time,</if>
  50. <if test="updateTime != null">update_time,</if>
  51. <if test="isRevoke != null">is_revoke,</if>
  52. </trim>
  53. <trim prefix="values (" suffix=")" suffixOverrides=",">
  54. <if test="userId != null">#{userId},</if>
  55. <if test="userType != null">#{userType},</if>
  56. <if test="courseId != null">#{courseId},</if>
  57. <if test="videoId != null">#{videoId},</if>
  58. <if test="type != null">#{type},</if>
  59. <if test="parentId != null">#{parentId},</if>
  60. <if test="content != null">#{content},</if>
  61. <if test="createTime != null">#{createTime},</if>
  62. <if test="updateTime != null">#{updateTime},</if>
  63. <if test="isRevoke != null">#{isRevoke},</if>
  64. </trim>
  65. </insert>
  66. <update id="updateFsCourseWatchComment" parameterType="FsCourseWatchComment">
  67. update fs_course_watch_comment
  68. <trim prefix="SET" suffixOverrides=",">
  69. <if test="userId != null">user_id = #{userId},</if>
  70. <if test="userType != null">user_type = #{userType},</if>
  71. <if test="courseId != null">course_id = #{courseId},</if>
  72. <if test="videoId != null">video_id = #{videoId},</if>
  73. <if test="type != null">type = #{type},</if>
  74. <if test="parentId != null">parent_id = #{parentId},</if>
  75. <if test="content != null">content = #{content},</if>
  76. <if test="createTime != null">create_time = #{createTime},</if>
  77. <if test="updateTime != null">update_time = #{updateTime},</if>
  78. <if test="isRevoke != null">is_revoke = #{isRevoke},</if>
  79. </trim>
  80. where comment_id = #{commentId}
  81. </update>
  82. <delete id="deleteFsCourseWatchCommentByCommentId" parameterType="Long">
  83. delete from fs_course_watch_comment where comment_id = #{commentId}
  84. </delete>
  85. <delete id="deleteFsCourseWatchCommentByCommentIds" parameterType="String">
  86. delete from fs_course_watch_comment where comment_id in
  87. <foreach item="commentId" collection="array" open="(" separator="," close=")">
  88. #{commentId}
  89. </foreach>
  90. </delete>
  91. <select id="selectH5CourseWatchComments" resultType="com.fs.course.vo.FsCourseWatchCommentVO">
  92. select comment_id, user_id, user_type, course_id, video_id, type, content, create_time from fs_course_watch_comment
  93. <where>
  94. and is_revoke = 0
  95. </where>
  96. order by create_time desc
  97. </select>
  98. </mapper>