UserBankCardMapper.xml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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.UserBankCardMapper" >
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.users.UserBankCard" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="uid" property="uid" jdbcType="BIGINT" />
  7. <result column="bank_card" property="bankCard" jdbcType="VARCHAR" />
  8. <result column="bank_card_name" property="bankCardName" jdbcType="VARCHAR" />
  9. <result column="open_bank_code" property="openBankCode" jdbcType="VARCHAR" />
  10. <result column="is_use" property="isUse" jdbcType="BIT" />
  11. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  12. </resultMap>
  13. <sql id="Base_Column_List" >
  14. id, uid, bank_card, bank_card_name, open_bank_code, is_use, create_time
  15. </sql>
  16. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  17. select
  18. <include refid="Base_Column_List" />
  19. from user_bank_card
  20. where id = #{id,jdbcType=INTEGER}
  21. </select>
  22. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  23. delete from user_bank_card
  24. where id = #{id,jdbcType=INTEGER}
  25. </delete>
  26. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.users.UserBankCard" >
  27. <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
  28. SELECT LAST_INSERT_ID()
  29. </selectKey>
  30. insert into user_bank_card (uid, bank_card, bank_card_name,
  31. open_bank_code, is_use, create_time
  32. )
  33. values (#{uid,jdbcType=BIGINT}, #{bankCard,jdbcType=VARCHAR}, #{bankCardName,jdbcType=VARCHAR},
  34. #{openBankCode,jdbcType=VARCHAR}, #{isUse,jdbcType=BIT}, #{createTime,jdbcType=TIMESTAMP}
  35. )
  36. </insert>
  37. <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.users.UserBankCard" >
  38. <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
  39. SELECT LAST_INSERT_ID()
  40. </selectKey>
  41. insert into user_bank_card
  42. <trim prefix="(" suffix=")" suffixOverrides="," >
  43. <if test="uid != null" >
  44. uid,
  45. </if>
  46. <if test="bankCard != null" >
  47. bank_card,
  48. </if>
  49. <if test="bankCardName != null" >
  50. bank_card_name,
  51. </if>
  52. <if test="openBankCode != null" >
  53. open_bank_code,
  54. </if>
  55. <if test="isUse != null" >
  56. is_use,
  57. </if>
  58. <if test="createTime != null" >
  59. create_time,
  60. </if>
  61. </trim>
  62. <trim prefix="values (" suffix=")" suffixOverrides="," >
  63. <if test="uid != null" >
  64. #{uid,jdbcType=BIGINT},
  65. </if>
  66. <if test="bankCard != null" >
  67. #{bankCard,jdbcType=VARCHAR},
  68. </if>
  69. <if test="bankCardName != null" >
  70. #{bankCardName,jdbcType=VARCHAR},
  71. </if>
  72. <if test="openBankCode != null" >
  73. #{openBankCode,jdbcType=VARCHAR},
  74. </if>
  75. <if test="isUse != null" >
  76. #{isUse,jdbcType=BIT},
  77. </if>
  78. <if test="createTime != null" >
  79. #{createTime,jdbcType=TIMESTAMP},
  80. </if>
  81. </trim>
  82. </insert>
  83. <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.users.UserBankCard" >
  84. update user_bank_card
  85. <set >
  86. <if test="uid != null" >
  87. uid = #{uid,jdbcType=BIGINT},
  88. </if>
  89. <if test="bankCard != null" >
  90. bank_card = #{bankCard,jdbcType=VARCHAR},
  91. </if>
  92. <if test="bankCardName != null" >
  93. bank_card_name = #{bankCardName,jdbcType=VARCHAR},
  94. </if>
  95. <if test="openBankCode != null" >
  96. open_bank_code = #{openBankCode,jdbcType=VARCHAR},
  97. </if>
  98. <if test="isUse != null" >
  99. is_use = #{isUse,jdbcType=BIT},
  100. </if>
  101. <if test="createTime != null" >
  102. create_time = #{createTime,jdbcType=TIMESTAMP},
  103. </if>
  104. </set>
  105. where id = #{id,jdbcType=INTEGER}
  106. </update>
  107. <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.users.UserBankCard" >
  108. update user_bank_card
  109. set uid = #{uid,jdbcType=BIGINT},
  110. bank_card = #{bankCard,jdbcType=VARCHAR},
  111. bank_card_name = #{bankCardName,jdbcType=VARCHAR},
  112. open_bank_code = #{openBankCode,jdbcType=VARCHAR},
  113. is_use = #{isUse,jdbcType=BIT},
  114. create_time = #{createTime,jdbcType=TIMESTAMP}
  115. where id = #{id,jdbcType=INTEGER}
  116. </update>
  117. <select id="selectByUsersBankCardQuery" resultType="com.juxiao.xchat.module.xbd.vo.UsersBankCardVO">
  118. SELECT bc.id, bc.uid, bc.bank_card as bankCard, bc.bank_card_name as bankCardName, bc.open_bank_code as openBankCode, bc.is_use as isUse, u.erban_no as erbanNo, u.nick,bc.create_time as createTime
  119. from user_bank_card bc
  120. INNER JOIN users u on bc.uid = u.uid
  121. <where> 1 = 1
  122. <if test="uidList != null">
  123. and u.erban_no in
  124. <foreach collection="uidList" index="index" item="item" open="(" separator="," close=")">
  125. #{item}
  126. </foreach>
  127. </if>
  128. <if test="bankCode != null and bankCode !=''">
  129. and bc.open_bank_code = #{bankCode}
  130. </if>
  131. </where>
  132. ORDER BY bc.create_time desc
  133. </select>
  134. <select id="selectByUidOrBankCode" resultMap="BaseResultMap">
  135. select
  136. <include refid="Base_Column_List" />
  137. from user_bank_card
  138. where uid = #{uid} and open_bank_code = #{bankCode}
  139. </select>
  140. <select id="selectByUidOrIsUse" resultMap="BaseResultMap">
  141. select
  142. <include refid="Base_Column_List" />
  143. from user_bank_card
  144. where uid = #{uid} and is_use = #{isUse}
  145. </select>
  146. <select id="selectByUid" resultMap="BaseResultMap">
  147. select
  148. <include refid="Base_Column_List" />
  149. from user_bank_card
  150. where uid = #{uid}
  151. </select>
  152. <update id="updateIsUseByUid">
  153. update user_bank_card set is_use = #{isUse} where uid = #{uid}
  154. </update>
  155. <select id="selectUsersUseBankCard" resultMap="BaseResultMap">
  156. select
  157. <include refid="Base_Column_List" />
  158. from user_bank_card
  159. where uid = #{uid} and is_use = 1
  160. </select>
  161. </mapper>