FsUserCourseCommentMapper.xml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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.FsUserCourseCommentMapper">
  6. <resultMap type="FsUserCourseComment" id="FsUserCourseCommentResult">
  7. <result property="commentId" column="comment_id" />
  8. <result property="userId" column="user_id" />
  9. <result property="courseId" column="course_id" />
  10. <result property="type" column="type" />
  11. <result property="parentId" column="parent_id" />
  12. <result property="content" column="content" />
  13. <result property="replyCount" column="reply_count" />
  14. <result property="createTime" column="create_time" />
  15. <result property="updateTime" column="update_time" />
  16. <result property="likes" column="likes" />
  17. <result property="toUserId" column="to_user_id" />
  18. <result property="isDel" column="is_del" />
  19. </resultMap>
  20. <sql id="selectFsUserCourseCommentVo">
  21. select comment_id,to_user_id, user_id,is_del, course_id, type, parent_id, content, reply_count, create_time, update_time, likes from fs_user_course_comment
  22. </sql>
  23. <select id="selectFsUserCourseCommentList" parameterType="FsUserCourseComment" resultMap="FsUserCourseCommentResult">
  24. <include refid="selectFsUserCourseCommentVo"/>
  25. <where>
  26. <if test="userId != null "> and user_id = #{userId}</if>
  27. <if test="courseId != null "> and course_id = #{courseId}</if>
  28. <if test="type != null "> and type = #{type}</if>
  29. <if test="parentId != null "> and parent_id = #{parentId}</if>
  30. <if test="content != null and content != ''"> and content = #{content}</if>
  31. <if test="replyCount != null "> and reply_count = #{replyCount}</if>
  32. <if test="likes != null "> and likes = #{likes}</if>
  33. </where>
  34. </select>
  35. <select id="selectFsUserCourseCommentByCommentId" parameterType="Long" resultMap="FsUserCourseCommentResult">
  36. <include refid="selectFsUserCourseCommentVo"/>
  37. where comment_id = #{commentId}
  38. </select>
  39. <insert id="insertFsUserCourseComment" parameterType="FsUserCourseComment" useGeneratedKeys="true" keyProperty="commentId">
  40. insert into fs_user_course_comment
  41. <trim prefix="(" suffix=")" suffixOverrides=",">
  42. <if test="userId != null">user_id,</if>
  43. <if test="courseId != null">course_id,</if>
  44. <if test="type != null">type,</if>
  45. <if test="parentId != null">parent_id,</if>
  46. <if test="content != null">content,</if>
  47. <if test="replyCount != null">reply_count,</if>
  48. <if test="createTime != null">create_time,</if>
  49. <if test="updateTime != null">update_time,</if>
  50. <if test="likes != null">likes,</if>
  51. <if test="toUserId != null">to_user_id,</if>
  52. <if test="isDel != null">is_del,</if>
  53. </trim>
  54. <trim prefix="values (" suffix=")" suffixOverrides=",">
  55. <if test="userId != null">#{userId},</if>
  56. <if test="courseId != null">#{courseId},</if>
  57. <if test="type != null">#{type},</if>
  58. <if test="parentId != null">#{parentId},</if>
  59. <if test="content != null">#{content},</if>
  60. <if test="replyCount != null">#{replyCount},</if>
  61. <if test="createTime != null">#{createTime},</if>
  62. <if test="updateTime != null">#{updateTime},</if>
  63. <if test="likes != null">#{likes},</if>
  64. <if test="toUserId != null">#{toUserId},</if>
  65. <if test="isDel != null">#{isDel},</if>
  66. </trim>
  67. </insert>
  68. <update id="updateFsUserCourseComment" parameterType="FsUserCourseComment">
  69. update fs_user_course_comment
  70. <trim prefix="SET" suffixOverrides=",">
  71. <if test="userId != null">user_id = #{userId},</if>
  72. <if test="courseId != null">course_id = #{courseId},</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="replyCount != null">reply_count = #{replyCount},</if>
  77. <if test="createTime != null">create_time = #{createTime},</if>
  78. <if test="updateTime != null">update_time = #{updateTime},</if>
  79. <if test="likes != null">likes = #{likes},</if>
  80. <if test="toUserId != null">to_user_id = #{toUserId},</if>
  81. <if test="isDel != null">is_del = #{isDel},</if>
  82. </trim>
  83. where comment_id = #{commentId}
  84. </update>
  85. <update id="deleteFsUserCourseCommentByCommentId" parameterType="Long">
  86. update fs_user_course_comment set is_del = 1 where comment_id = #{commentId}
  87. </update>
  88. <update id="deleteFsUserCourseCommentByCommentIds" parameterType="String">
  89. update fs_user_course_comment set is_del = 1 where comment_id in
  90. <foreach item="commentId" collection="array" open="(" separator="," close=")">
  91. #{commentId}
  92. </foreach>
  93. </update>
  94. </mapper>