HeadwearPurseRecordMapper.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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.HeadwearPurseRecordMapper">
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.record.HeadwearPurseRecord" >
  5. <id column="record_id" property="recordId" jdbcType="BIGINT" />
  6. <result column="uid" property="uid" jdbcType="BIGINT" />
  7. <result column="headwear_id" property="headwearId" jdbcType="BIGINT" />
  8. <result column="headwear_date" property="headwearDate" jdbcType="INTEGER" />
  9. <result column="total_gold_num" property="totalGoldNum" jdbcType="BIGINT" />
  10. <result column="is_use" property="isUse" jdbcType="TINYINT" />
  11. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  12. </resultMap>
  13. <sql id="Base_Column_List" >
  14. record_id, uid, headwear_id, headwear_date, total_gold_num, is_use, create_time
  15. </sql>
  16. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
  17. select
  18. <include refid="Base_Column_List" />
  19. from headwear_purse_record
  20. where record_id = #{recordId,jdbcType=BIGINT}
  21. </select>
  22. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.record.HeadwearPurseRecord" >
  23. <selectKey resultType="java.lang.Long" keyProperty="recordId" order="AFTER" >
  24. SELECT LAST_INSERT_ID()
  25. </selectKey>
  26. insert into headwear_purse_record (uid, headwear_id, headwear_date,
  27. total_gold_num, is_use, create_time
  28. )
  29. values (#{uid,jdbcType=BIGINT}, #{headwearId,jdbcType=BIGINT}, #{headwearDate,jdbcType=INTEGER},
  30. #{totalGoldNum,jdbcType=BIGINT}, #{isUse,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}
  31. )
  32. </insert>
  33. <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.record.HeadwearPurseRecord" >
  34. <selectKey resultType="java.lang.Long" keyProperty="recordId" order="AFTER" >
  35. SELECT LAST_INSERT_ID()
  36. </selectKey>
  37. insert into headwear_purse_record
  38. <trim prefix="(" suffix=")" suffixOverrides="," >
  39. <if test="uid != null" >
  40. uid,
  41. </if>
  42. <if test="headwearId != null" >
  43. headwear_id,
  44. </if>
  45. <if test="headwearDate != null" >
  46. headwear_date,
  47. </if>
  48. <if test="totalGoldNum != null" >
  49. total_gold_num,
  50. </if>
  51. <if test="isUse != null" >
  52. is_use,
  53. </if>
  54. <if test="createTime != null" >
  55. create_time,
  56. </if>
  57. </trim>
  58. <trim prefix="values (" suffix=")" suffixOverrides="," >
  59. <if test="uid != null" >
  60. #{uid,jdbcType=BIGINT},
  61. </if>
  62. <if test="headwearId != null" >
  63. #{headwearId,jdbcType=BIGINT},
  64. </if>
  65. <if test="headwearDate != null" >
  66. #{headwearDate,jdbcType=INTEGER},
  67. </if>
  68. <if test="totalGoldNum != null" >
  69. #{totalGoldNum,jdbcType=BIGINT},
  70. </if>
  71. <if test="isUse != null" >
  72. #{isUse,jdbcType=TINYINT},
  73. </if>
  74. <if test="createTime != null" >
  75. #{createTime,jdbcType=TIMESTAMP},
  76. </if>
  77. </trim>
  78. </insert>
  79. <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.record.HeadwearPurseRecord" >
  80. update headwear_purse_record
  81. <set >
  82. <if test="uid != null" >
  83. uid = #{uid,jdbcType=BIGINT},
  84. </if>
  85. <if test="headwearId != null" >
  86. headwear_id = #{headwearId,jdbcType=BIGINT},
  87. </if>
  88. <if test="headwearDate != null" >
  89. headwear_date = #{headwearDate,jdbcType=INTEGER},
  90. </if>
  91. <if test="totalGoldNum != null" >
  92. total_gold_num = #{totalGoldNum,jdbcType=BIGINT},
  93. </if>
  94. <if test="isUse != null" >
  95. is_use = #{isUse,jdbcType=TINYINT},
  96. </if>
  97. <if test="createTime != null" >
  98. create_time = #{createTime,jdbcType=TIMESTAMP},
  99. </if>
  100. </set>
  101. where record_id = #{recordId,jdbcType=BIGINT}
  102. </update>
  103. <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.record.HeadwearPurseRecord" >
  104. update headwear_purse_record
  105. set uid = #{uid,jdbcType=BIGINT},
  106. headwear_id = #{headwearId,jdbcType=BIGINT},
  107. headwear_date = #{headwearDate,jdbcType=INTEGER},
  108. total_gold_num = #{totalGoldNum,jdbcType=BIGINT},
  109. is_use = #{isUse,jdbcType=TINYINT},
  110. create_time = #{createTime,jdbcType=TIMESTAMP}
  111. where record_id = #{recordId,jdbcType=BIGINT}
  112. </update>
  113. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
  114. delete from headwear_purse_record
  115. where record_id = #{recordId,jdbcType=BIGINT}
  116. </delete>
  117. <select id="selectGiveHeadWearUsersInfoByQuery"
  118. resultType="com.juxiao.xchat.module.xbd.vo.GiveHeadWearUsersVO">
  119. select u.uid, u.erban_no as erBanNo,u.avatar , u.nick,CONCAT(u.erban_no,',',h.headwear_id) as erBanNoOrHeadWearId,h.headwear_name as headwearName, h.gold_price as goldPrice,h.headwear_id as headwearId
  120. from users u
  121. left join headwear h on 1 = 1
  122. where u.def_user = 1 and u.erban_no = #{erBanNo} and h.headwear_id = #{headWearId}
  123. </select>
  124. <select id="selectHeadWearDaysByCarId" resultType="java.lang.Integer">
  125. select ifnull(hpr.headwear_date,0) as carDate
  126. from users u
  127. LEFT JOIN headwear h on 1 = 1
  128. LEFT JOIN headwear_purse_record hpr on u.uid = hpr.uid and h.headwear_id = hpr.headwear_id
  129. where u.uid = #{uid} and h.headwear_id = #{headWearId}
  130. </select>
  131. <select id="selectHeadwearPurseRecordByUid" resultMap="BaseResultMap">
  132. select
  133. <include refid="Base_Column_List" />
  134. from headwear_purse_record
  135. where uid = #{uid}
  136. </select>
  137. <select id="selectHeadWearPurseRecordByHeadWearIdOrUid" resultMap="BaseResultMap">
  138. select
  139. <include refid="Base_Column_List" />
  140. from headwear_purse_record
  141. where uid = #{uid} and headwear_id = #{headWearId}
  142. </select>
  143. </mapper>