MomentsLikeMapper.xml 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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.MomentsLikeMapper">
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.circle.MomentsLike" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="uid" property="uid" jdbcType="BIGINT" />
  7. <result column="moments_id" property="momentsId" jdbcType="INTEGER" />
  8. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  9. </resultMap>
  10. <sql id="Base_Column_List" >
  11. id, uid, moments_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 moments_like
  17. where id = #{id,jdbcType=INTEGER}
  18. </select>
  19. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.circle.MomentsLike" 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 moments_like (uid, moments_id, create_time
  24. )
  25. values (#{uid,jdbcType=BIGINT}, #{momentsId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}
  26. )
  27. </insert>
  28. <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.circle.MomentsLike" 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 moments_like
  33. <trim prefix="(" suffix=")" suffixOverrides="," >
  34. <if test="uid != null" >
  35. uid,
  36. </if>
  37. <if test="momentsId != null" >
  38. moments_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="momentsId != null" >
  49. #{momentsId,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.MomentsLike" >
  57. update moments_like
  58. <set >
  59. <if test="uid != null" >
  60. uid = #{uid,jdbcType=BIGINT},
  61. </if>
  62. <if test="momentsId != null" >
  63. moments_id = #{momentsId,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.MomentsLike" >
  72. update moments_like
  73. set uid = #{uid,jdbcType=BIGINT},
  74. moments_id = #{momentsId,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 moments_like
  80. where id = #{id,jdbcType=INTEGER}
  81. </delete>
  82. <delete id="deleteByMomentsId">
  83. delete from moments_like where moments_id = #{momentsId}
  84. </delete>
  85. </mapper>