UserPurseMapper.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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.users.UserPurseMapper" >
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.users.UserPurse" >
  5. <id column="uid" property="uid" jdbcType="BIGINT" />
  6. <result column="charge_gold_num" property="chargeGoldNum" jdbcType="BIGINT" />
  7. <result column="noble_gold_num" property="nobleGoldNum" jdbcType="BIGINT" />
  8. <result column="gold_num" property="goldNum" jdbcType="BIGINT" />
  9. <result column="diamond_num" property="diamondNum" jdbcType="DOUBLE" />
  10. <result column="deposit_num" property="depositNum" jdbcType="BIGINT" />
  11. <result column="is_first_charge" property="isFirstCharge" jdbcType="BIT" />
  12. <result column="first_recharge_time" property="firstRechargeTime" jdbcType="TIMESTAMP" />
  13. <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
  14. </resultMap>
  15. <sql id="Base_Column_List" >
  16. uid, charge_gold_num, noble_gold_num, gold_num, diamond_num, deposit_num, is_first_charge,
  17. first_recharge_time, update_time
  18. </sql>
  19. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
  20. select
  21. <include refid="Base_Column_List" />
  22. from user_purse
  23. where uid = #{uid,jdbcType=BIGINT}
  24. </select>
  25. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.users.UserPurse" >
  26. insert into user_purse (uid, charge_gold_num, noble_gold_num,
  27. gold_num, diamond_num, deposit_num,
  28. is_first_charge, first_recharge_time, update_time
  29. )
  30. values (#{uid,jdbcType=BIGINT}, #{chargeGoldNum,jdbcType=BIGINT}, #{nobleGoldNum,jdbcType=BIGINT},
  31. #{goldNum,jdbcType=BIGINT}, #{diamondNum,jdbcType=DOUBLE}, #{depositNum,jdbcType=BIGINT},
  32. #{isFirstCharge,jdbcType=BIT}, #{firstRechargeTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
  33. )
  34. </insert>
  35. <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.users.UserPurse" >
  36. insert into user_purse
  37. <trim prefix="(" suffix=")" suffixOverrides="," >
  38. <if test="uid != null" >
  39. uid,
  40. </if>
  41. <if test="chargeGoldNum != null" >
  42. charge_gold_num,
  43. </if>
  44. <if test="nobleGoldNum != null" >
  45. noble_gold_num,
  46. </if>
  47. <if test="goldNum != null" >
  48. gold_num,
  49. </if>
  50. <if test="diamondNum != null" >
  51. diamond_num,
  52. </if>
  53. <if test="depositNum != null" >
  54. deposit_num,
  55. </if>
  56. <if test="isFirstCharge != null" >
  57. is_first_charge,
  58. </if>
  59. <if test="firstRechargeTime != null" >
  60. first_recharge_time,
  61. </if>
  62. <if test="updateTime != null" >
  63. update_time,
  64. </if>
  65. </trim>
  66. <trim prefix="values (" suffix=")" suffixOverrides="," >
  67. <if test="uid != null" >
  68. #{uid,jdbcType=BIGINT},
  69. </if>
  70. <if test="chargeGoldNum != null" >
  71. #{chargeGoldNum,jdbcType=BIGINT},
  72. </if>
  73. <if test="nobleGoldNum != null" >
  74. #{nobleGoldNum,jdbcType=BIGINT},
  75. </if>
  76. <if test="goldNum != null" >
  77. #{goldNum,jdbcType=BIGINT},
  78. </if>
  79. <if test="diamondNum != null" >
  80. #{diamondNum,jdbcType=DOUBLE},
  81. </if>
  82. <if test="depositNum != null" >
  83. #{depositNum,jdbcType=BIGINT},
  84. </if>
  85. <if test="isFirstCharge != null" >
  86. #{isFirstCharge,jdbcType=BIT},
  87. </if>
  88. <if test="firstRechargeTime != null" >
  89. #{firstRechargeTime,jdbcType=TIMESTAMP},
  90. </if>
  91. <if test="updateTime != null" >
  92. #{updateTime,jdbcType=TIMESTAMP},
  93. </if>
  94. </trim>
  95. </insert>
  96. <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.users.UserPurse" >
  97. update user_purse
  98. <set >
  99. <if test="chargeGoldNum != null" >
  100. charge_gold_num = #{chargeGoldNum,jdbcType=BIGINT},
  101. </if>
  102. <if test="nobleGoldNum != null" >
  103. noble_gold_num = #{nobleGoldNum,jdbcType=BIGINT},
  104. </if>
  105. <if test="goldNum != null" >
  106. gold_num = #{goldNum,jdbcType=BIGINT},
  107. </if>
  108. <if test="diamondNum != null" >
  109. diamond_num = #{diamondNum,jdbcType=DOUBLE},
  110. </if>
  111. <if test="depositNum != null" >
  112. deposit_num = #{depositNum,jdbcType=BIGINT},
  113. </if>
  114. <if test="isFirstCharge != null" >
  115. is_first_charge = #{isFirstCharge,jdbcType=BIT},
  116. </if>
  117. <if test="firstRechargeTime != null" >
  118. first_recharge_time = #{firstRechargeTime,jdbcType=TIMESTAMP},
  119. </if>
  120. <if test="updateTime != null" >
  121. update_time = #{updateTime,jdbcType=TIMESTAMP},
  122. </if>
  123. </set>
  124. where uid = #{uid,jdbcType=BIGINT}
  125. </update>
  126. <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.users.UserPurse" >
  127. update user_purse
  128. set charge_gold_num = #{chargeGoldNum,jdbcType=BIGINT},
  129. noble_gold_num = #{nobleGoldNum,jdbcType=BIGINT},
  130. gold_num = #{goldNum,jdbcType=BIGINT},
  131. diamond_num = #{diamondNum,jdbcType=DOUBLE},
  132. deposit_num = #{depositNum,jdbcType=BIGINT},
  133. is_first_charge = #{isFirstCharge,jdbcType=BIT},
  134. first_recharge_time = #{firstRechargeTime,jdbcType=TIMESTAMP},
  135. update_time = #{updateTime,jdbcType=TIMESTAMP}
  136. where uid = #{uid,jdbcType=BIGINT}
  137. </update>
  138. <update id="updateAddChargeGold">
  139. update user_purse set is_first_charge = 0, gold_num=gold_num + #{num},charge_gold_num=charge_gold_num + #{num},update_time=now()
  140. where uid=#{uid}
  141. </update>
  142. </mapper>