PacketWithDrawRecordMapper.xml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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.PacketWithDrawRecordMapper">
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.record.PacketWithDrawRecord" >
  5. <id column="record_id" property="recordId" jdbcType="VARCHAR" />
  6. <result column="uid" property="uid" jdbcType="BIGINT" />
  7. <result column="packet_prod_cash_id" property="packetProdCashId" jdbcType="INTEGER" />
  8. <result column="packet_num" property="packetNum" jdbcType="DOUBLE" />
  9. <result column="record_status" property="recordStatus" jdbcType="TINYINT" />
  10. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  11. <result column="bank_card" property="bankCard" jdbcType="VARCHAR" />
  12. <result column="bank_card_name" property="bankCardName" jdbcType="VARCHAR" />
  13. <result column="open_bank_code" property="openBankCode" jdbcType="VARCHAR" />
  14. <result column="real_tran_type" property="realTranType" jdbcType="BIT" />
  15. <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
  16. <result column="tran_type" property="tranType" jdbcType="INTEGER"/>
  17. <result column="merchant_order_no" property="merchantOrderNo" jdbcType="VARCHAR"/>
  18. <result column="admin_id" property="adminId" jdbcType="INTEGER"/>
  19. <result column="pingxx_id" property="pingxxId" jdbcType="VARCHAR"/>
  20. <result column="wx_open_id" property="wxOpenId" jdbcType="VARCHAR"/>
  21. </resultMap>
  22. <sql id="Base_Column_List" >
  23. record_id, uid, packet_prod_cash_id, packet_num, record_status, create_time, bank_card,
  24. bank_card_name, open_bank_code, real_tran_type, update_time,tran_type,merchant_order_no,admin_id,pingxx_id,wx_open_id
  25. </sql>
  26. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  27. select
  28. <include refid="Base_Column_List" />
  29. from packet_withdraw_record
  30. where record_id = #{recordId,jdbcType=VARCHAR}
  31. </select>
  32. <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.record.PacketWithDrawRecord" >
  33. update packet_withdraw_record
  34. <set >
  35. <if test="uid != null" >
  36. uid = #{uid,jdbcType=BIGINT},
  37. </if>
  38. <if test="packetProdCashId != null" >
  39. packet_prod_cash_id = #{packetProdCashId,jdbcType=INTEGER},
  40. </if>
  41. <if test="packetNum != null" >
  42. packet_num = #{packetNum,jdbcType=DOUBLE},
  43. </if>
  44. <if test="recordStatus != null" >
  45. record_status = #{recordStatus,jdbcType=TINYINT},
  46. </if>
  47. <if test="bankCard != null" >
  48. bank_card = #{bankCard,jdbcType=VARCHAR},
  49. </if>
  50. <if test="bankCardName != null" >
  51. bank_card_name = #{bankCardName,jdbcType=VARCHAR},
  52. </if>
  53. <if test="openBankCode != null" >
  54. open_bank_code = #{openBankCode,jdbcType=VARCHAR},
  55. </if>
  56. <if test="realTranType != null" >
  57. real_tran_type = #{realTranType,jdbcType=BIT},
  58. </if>
  59. <if test="updateTime != null" >
  60. update_time = #{updateTime,jdbcType=TIMESTAMP},
  61. </if>
  62. <if test="tranType != null" >
  63. tran_type = #{tranType,jdbcType=BIT},
  64. </if>
  65. <if test="merchantOrderNo != null" >
  66. merchant_order_no = #{merchantOrderNo,jdbcType=VARCHAR},
  67. </if>
  68. <if test="adminId != null" >
  69. admin_id = #{adminId,jdbcType=INTEGER},
  70. </if>
  71. <if test="pingxxId != null" >
  72. pingxx_id = #{pingxxId,jdbcType=VARCHAR},
  73. </if>
  74. </set>
  75. where record_id = #{recordId,jdbcType=VARCHAR}
  76. </update>
  77. <select id="selectByPacketWithdrawRecordByList" resultType="com.juxiao.xchat.module.xbd.vo.PacketWithdrawRecordVO">
  78. select ur.record_id as recordId, ur.packet_num as packetNum, ur.record_status as recordStatus, ur.create_time as createTime,
  79. u.uid as uid ,u.erban_no as erbanNo,u.nick as nick,u.phone as phone ,u.alipay_account as aliPayAccount,u.alipay_account_name as aliPayAccountName,
  80. ur.bank_card as cardNumber,ur.bank_card_name as cardName,ur.open_bank_code as openBankCode,u.withdraw_status as withdrawStatus,ur.wx_open_id as wxOpenId,
  81. ur.real_tran_type as realTranType,ur.tran_type as tranType,ur.merchant_order_no as merchantOrderNo,ur.admin_id as adminId,ur.pingxx_id as pingxxId
  82. from packet_withdraw_record ur
  83. INNER JOIN users u ON ur.uid=u.uid
  84. where 1 = 1
  85. <if test="erBanNo != null">
  86. u.erban_no = #{erBanNo}
  87. </if>
  88. <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
  89. AND ur.create_time between #{beginTime} and #{endTime}
  90. </if>
  91. <if test="withdrawStatus != null">
  92. AND ur.record_status = #{withdrawStatus}
  93. </if>
  94. <if test="tranType !=null">
  95. AND ur.tran_type = #{tranType}
  96. </if>
  97. <if test="realTranType != null">
  98. AND ur.real_tran_type = #{realTranType}
  99. </if>
  100. <if test="accountStatus != null">
  101. AND u.withdraw_status = #{accountStatus}
  102. </if>
  103. ORDER BY ur.create_time DESC
  104. </select>
  105. <select id="selectByPacketWithdrawRecordByCount" resultType="com.juxiao.xchat.module.xbd.vo.PacketWithdrawRecordVO">
  106. select COUNT(DISTINCT ur.uid) as userNum , sum(ur.packet_num) as money
  107. from packet_withdraw_record ur
  108. inner join users us on ur.uid = us.uid
  109. where 1 = 1
  110. <if test="erBanNo != null">
  111. and us.erban_no = #{erBanNo}
  112. </if>
  113. <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
  114. AND ur.create_time between #{beginTime} and #{endTime}
  115. </if>
  116. <if test="withdrawStatus != null">
  117. AND ur.record_status = #{withdrawStatus}
  118. </if>
  119. <if test="tranType != null">
  120. AND ur.tran_type = #{tranType}
  121. </if>
  122. <if test="realTranType != null">
  123. AND ur.real_tran_type = #{realTranType}
  124. </if>
  125. <if test="accountStatus != null">
  126. AND us.withdraw_status = #{accountStatus}
  127. </if>
  128. </select>
  129. <select id="selectByRecordIds" resultType="com.juxiao.xchat.module.xbd.vo.PacketWithdrawRecordVO">
  130. SELECT ur.record_id as recordId, ur.packet_num as packetNum, ur.record_status as recordStatus, ur.create_time as createTime,
  131. u.uid as uid ,u.erban_no as erbanNo,u.nick as nick,u.phone as phone ,u.alipay_account as aliPayAccount,u.alipay_account_name as aliPayAccountName,
  132. ubc.bank_card as cardNumber,ubc.bank_card_name as cardName,ubc.open_bank_code as openBankCode,u.withdraw_status as withdrawStatus,ur.wx_open_id as wxOpenId,
  133. ur.real_tran_type as realTranType,ur.tran_type as tranType,ur.merchant_order_no as merchantOrderNo,ur.admin_id as adminId,ur.pingxx_id as pingxxId
  134. FROM packet_withdraw_record ur
  135. INNER JOIN users u ON ur.uid= u.uid
  136. LEFT JOIN user_bank_card ubc on ur.uid = ubc.uid and ubc.is_use = 1
  137. WHERE ur.record_status !=2 and u.withdraw_status = 0 and ur.record_id IN
  138. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  139. #{item}
  140. </foreach>
  141. </select>
  142. <select id="selectByRecordId" resultType="com.juxiao.xchat.module.xbd.vo.PacketWithdrawRecordVO">
  143. SELECT ur.record_id as recordId, ur.packet_num as packetNum, ur.record_status as recordStatus, ur.create_time as createTime,
  144. u.uid as uid ,u.erban_no as erbanNo,u.nick as nick,u.phone as phone ,u.alipay_account as aliPayAccount,u.alipay_account_name as aliPayAccountName,
  145. ubc.bank_card as cardNumber,ubc.bank_card_name as cardName,ubc.open_bank_code as openBankCode,u.withdraw_status as withdrawStatus,ur.wx_open_id as wxOpenId,
  146. ur.real_tran_type as realTranType,ur.tran_type as tranType,ur.merchant_order_no as merchantOrderNo,ur.admin_id as adminId,ur.pingxx_id as pingxxId
  147. FROM packet_withdraw_record ur
  148. INNER JOIN users u ON ur.uid= u.uid
  149. LEFT JOIN user_bank_card ubc on ur.uid = ubc.uid and ubc.is_use = 1
  150. WHERE ur.record_status !=2 and u.withdraw_status = 0 and ur.record_id = #{recordId}
  151. </select>
  152. <select id="selectByMerchantOrderNo" resultMap="BaseResultMap">
  153. select ur.record_id as record_id, ur.packet_num as packet_num, ur.record_status as record_status, ur.create_time as create_time,ur.bank_card as cardNumber,ur.bank_card_name as cardName,ur.open_bank_code as openBankCode
  154. from packet_withdraw_record ur
  155. WHERE ur.merchant_order_no = #{merchantOrderNo}
  156. </select>
  157. </mapper>