CommentLikeMapper.xml 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.juxiao.xchat.module.xbd.mapper.circle.CommentLikeMapper">
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.circle.CommentLike" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="uid" property="uid" jdbcType="BIGINT" />
  7. <result column="comment_id" property="commentId" jdbcType="INTEGER" />
  8. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  9. </resultMap>
  10. <sql id="Base_Column_List" >
  11. id, uid, comment_id, create_time
  12. </sql>
  13. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  14. select
  15. <include refid="Base_Column_List" />
  16. from comment_like
  17. where id = #{id,jdbcType=INTEGER}
  18. </select>
  19. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.circle.CommentLike" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  20. <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
  21. SELECT LAST_INSERT_ID()
  22. </selectKey>
  23. insert into comment_like (uid, comment_id, create_time
  24. )
  25. values (#{uid,jdbcType=BIGINT}, #{commentId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}
  26. )
  27. </insert>
  28. <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.circle.CommentLike" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  29. <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
  30. SELECT LAST_INSERT_ID()
  31. </selectKey>
  32. insert into comment_like
  33. <trim prefix="(" suffix=")" suffixOverrides="," >
  34. <if test="uid != null" >
  35. uid,
  36. </if>
  37. <if test="commentId != null" >
  38. comment_id,
  39. </if>
  40. <if test="createTime != null" >
  41. create_time,
  42. </if>
  43. </trim>
  44. <trim prefix="values (" suffix=")" suffixOverrides="," >
  45. <if test="uid != null" >
  46. #{uid,jdbcType=BIGINT},
  47. </if>
  48. <if test="commentId != null" >
  49. #{commentId,jdbcType=INTEGER},
  50. </if>
  51. <if test="createTime != null" >
  52. #{createTime,jdbcType=TIMESTAMP},
  53. </if>
  54. </trim>
  55. </insert>
  56. <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.circle.CommentLike" >
  57. update comment_like
  58. <set >
  59. <if test="uid != null" >
  60. uid = #{uid,jdbcType=BIGINT},
  61. </if>
  62. <if test="commentId != null" >
  63. comment_id = #{commentId,jdbcType=INTEGER},
  64. </if>
  65. <if test="createTime != null" >
  66. create_time = #{createTime,jdbcType=TIMESTAMP},
  67. </if>
  68. </set>
  69. where id = #{id,jdbcType=INTEGER}
  70. </update>
  71. <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.circle.CommentLike" >
  72. update comment_like
  73. set uid = #{uid,jdbcType=BIGINT},
  74. comment_id = #{commentId,jdbcType=INTEGER},
  75. create_time = #{createTime,jdbcType=TIMESTAMP}
  76. where id = #{id,jdbcType=INTEGER}
  77. </update>
  78. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  79. delete from comment_like
  80. where id = #{id,jdbcType=INTEGER}
  81. </delete>
  82. <select id="countLikes" resultType="java.lang.Integer">
  83. select count(*) from comment_like where comment_id = #{momentsId}
  84. </select>
  85. </mapper>