UserGiftPurseMapper.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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.record.UserGiftPurseMapper">
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.record.UserGiftPurse" >
  5. <id column="gift_purse_id" property="giftPurseId" jdbcType="INTEGER" />
  6. <result column="uid" property="uid" jdbcType="BIGINT" />
  7. <result column="gift_id" property="giftId" jdbcType="INTEGER" />
  8. <result column="count_num" property="countNum" jdbcType="INTEGER" />
  9. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  10. </resultMap>
  11. <sql id="Base_Column_List" >
  12. gift_purse_id, uid, gift_id, count_num, create_time
  13. </sql>
  14. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  15. select
  16. <include refid="Base_Column_List" />
  17. from user_gift_purse
  18. where gift_purse_id = #{giftPurseId,jdbcType=INTEGER}
  19. </select>
  20. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.record.UserGiftPurse" >
  21. <selectKey resultType="java.lang.Integer" keyProperty="giftPurseId" order="AFTER" >
  22. SELECT LAST_INSERT_ID()
  23. </selectKey>
  24. insert into user_gift_purse (uid, gift_id, count_num,
  25. create_time)
  26. values (#{uid,jdbcType=BIGINT}, #{giftId,jdbcType=INTEGER}, #{countNum,jdbcType=INTEGER},
  27. #{createTime,jdbcType=TIMESTAMP})
  28. </insert>
  29. <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.record.UserGiftPurse" >
  30. <selectKey resultType="java.lang.Integer" keyProperty="giftPurseId" order="AFTER" >
  31. SELECT LAST_INSERT_ID()
  32. </selectKey>
  33. insert into user_gift_purse
  34. <trim prefix="(" suffix=")" suffixOverrides="," >
  35. <if test="uid != null" >
  36. uid,
  37. </if>
  38. <if test="giftId != null" >
  39. gift_id,
  40. </if>
  41. <if test="countNum != null" >
  42. count_num,
  43. </if>
  44. <if test="createTime != null" >
  45. create_time,
  46. </if>
  47. </trim>
  48. <trim prefix="values (" suffix=")" suffixOverrides="," >
  49. <if test="uid != null" >
  50. #{uid,jdbcType=BIGINT},
  51. </if>
  52. <if test="giftId != null" >
  53. #{giftId,jdbcType=INTEGER},
  54. </if>
  55. <if test="countNum != null" >
  56. #{countNum,jdbcType=INTEGER},
  57. </if>
  58. <if test="createTime != null" >
  59. #{createTime,jdbcType=TIMESTAMP},
  60. </if>
  61. </trim>
  62. </insert>
  63. <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.record.UserGiftPurse" >
  64. update user_gift_purse
  65. <set >
  66. <if test="uid != null" >
  67. uid = #{uid,jdbcType=BIGINT},
  68. </if>
  69. <if test="giftId != null" >
  70. gift_id = #{giftId,jdbcType=INTEGER},
  71. </if>
  72. <if test="countNum != null" >
  73. count_num = #{countNum,jdbcType=INTEGER},
  74. </if>
  75. <if test="createTime != null" >
  76. create_time = #{createTime,jdbcType=TIMESTAMP},
  77. </if>
  78. </set>
  79. where gift_purse_id = #{giftPurseId,jdbcType=INTEGER}
  80. </update>
  81. <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.record.UserGiftPurse" >
  82. update user_gift_purse
  83. set uid = #{uid,jdbcType=BIGINT},
  84. gift_id = #{giftId,jdbcType=INTEGER},
  85. count_num = #{countNum,jdbcType=INTEGER},
  86. create_time = #{createTime,jdbcType=TIMESTAMP}
  87. where gift_purse_id = #{giftPurseId,jdbcType=INTEGER}
  88. </update>
  89. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  90. delete from user_gift_purse
  91. where gift_purse_id = #{giftPurseId,jdbcType=INTEGER}
  92. </delete>
  93. <select id="selectByUidOrGiftId" resultMap="BaseResultMap">
  94. select
  95. <include refid="Base_Column_List" />
  96. from user_gift_purse
  97. where uid = #{uid} and gift_id = #{giftId}
  98. </select>
  99. </mapper>