ZFBPayMapper.xml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.travel.mapper.ZFBPayMapper">
  5. <!-- 支付 -->
  6. <insert id="payUpdate" parameterType="ZFBPay">
  7. insert into bus_pay(uuid,release_uuid,fee_type,mch_id,nonce_str,out_trade_no,total_fee,trade_type,prepay_id,open_id,time_end,jdrq,code_url,body,pay_type)
  8. values(#{uuid},#{releaseUuid},#{feeType},#{mchId},#{nonceStr},#{outTradeNo},#{totalFee},#{tradeType},#{prepayId},#{openId},#{timeEnd},CONVERT(VARCHAR(100), SYSDATETIME(), 20),#{codeUrl},#{body},#{payType})
  9. </insert>
  10. <!-- 增加购买的报价单次数 -->
  11. <update id="addOfferNum">
  12. update sys_supplier set offer_num = (select offer_num + ${offerNum} from sys_supplier where code = #{code}) where code = #{code}
  13. </update>
  14. <!-- 子账户次数同步 -->
  15. <update id="addOfferNumChild">
  16. update sys_supplier set offer_num = (select offer_num from sys_supplier where code = #{code}) where account_associated = #{code}
  17. </update>
  18. <!-- 购买记录添加金额 -->
  19. <update id="updateBuyOfferNum" parameterType="BuyOfferNum">
  20. update bus_buy_offer_num set pay_amount = #{payAmount},pay_type=#{payType} where code = #{code} and uuid = #{uuid}
  21. </update>
  22. <!-- 完善充值记录 -->
  23. <update id="updateBuySupplier" parameterType="ZFBPay">
  24. update bus_top_up_record set jdrq = CONVERT(VARCHAR(100), SYSDATETIME(), 20),total_fee=#{totalFee},pay_type=#{payType} where code = #{code} and uuid = #{uuid}
  25. </update>
  26. <!-- 供应商余额充值 -->
  27. <update id="updateBalance" parameterType="double">
  28. UPDATE sys_supplier
  29. SET balance_of = (SELECT balance_of + ${totalFee} FROM sys_supplier WHERE code = #{code})
  30. WHERE
  31. code = #{code}
  32. </update>
  33. <!-- 子账户余额同步 -->
  34. <update id="updateBalanceChild">
  35. UPDATE sys_supplier
  36. SET balance_of = (SELECT balance_of FROM sys_supplier WHERE code = #{code})
  37. WHERE
  38. account_associated = #{code}
  39. </update>
  40. <!-- 查询供应商路线 -->
  41. <select id="getSupplierRelease" resultType="SupplierRelease">
  42. select
  43. a.*,b.name
  44. from bus_supplier_release a
  45. LEFT JOIN sys_supplier b on a.code = b.code
  46. <trim prefix="WHERE" prefixOverrides="and | or">
  47. <if test="uuid != null and uuid != ''">
  48. and a.uuid = #{uuid}
  49. </if>
  50. <if test="code != null and code != ''">
  51. and a.code = #{code}
  52. </if>
  53. <if test="demandUuid != null and demandUuid != ''">
  54. and a.demand_uuid = #{demandUuid}
  55. </if>
  56. </trim>
  57. </select>
  58. <!-- 查询该定制单的所有状态 -->
  59. <select id="getSupplierReleaseType" parameterType="String" resultType="SupplierRelease">
  60. select * from bus_private_ordering_type where demand_uuid = #{demandUuid}
  61. </select>
  62. <!-- 修改指定供应商定制单状态 -->
  63. <update id="updatePrivateType" parameterType="SupplierRelease">
  64. update bus_private_ordering_type set order_type = #{orderType} where code = #{code} and demand_uuid = #{demandUuid}
  65. </update>
  66. <!-- 返回供应商报价单次数 -->
  67. <update id="updateSupplierOffer" parameterType="SupplierRelease">
  68. UPDATE sys_supplier
  69. SET offer_num = ( SELECT offer_num + 1 FROM sys_supplier WHERE code = #{code} )
  70. WHERE
  71. code = #{code}
  72. </update>
  73. <!-- 返回供应商子报价单次数 -->
  74. <update id="updateSupplierOfferChild" parameterType="SupplierRelease">
  75. UPDATE sys_supplier
  76. SET offer_num = ( SELECT offer_num FROM sys_supplier WHERE code = #{code} )
  77. WHERE
  78. account_associated = #{code}
  79. </update>
  80. <!-- 查询指定参数的退款信息 -->
  81. <select id="getRefund" resultType="ZFBRefund">
  82. select * from bus_refund
  83. <trim prefix="WHERE" prefixOverrides="and | or">
  84. <if test="code != null and code !=''">
  85. and code = #{code}
  86. </if>
  87. <if test="releaseUuid != null and releaseUuid !=''">
  88. and release_uuid = #{releaseUuid}
  89. </if>
  90. </trim>
  91. </select>
  92. <!-- 查询指定报价单的支付信息 -->
  93. <select id="getRefundVal" resultType="ZFBPay" parameterType="String">
  94. SELECT
  95. a.*,
  96. c.balance_of,
  97. c.code
  98. FROM
  99. bus_pay a
  100. LEFT JOIN bus_supplier_release b ON a.release_uuid = b.uuid
  101. LEFT JOIN sys_supplier c ON b.code = c.code
  102. WHERE
  103. a.release_uuid = #{releUuid}
  104. </select>
  105. <!-- 修改退款状态 -->
  106. <update id="updateRefundType" parameterType="String">
  107. update bus_refund set refund_state = #{refundState} where release_uuid = #{releUuid}
  108. </update>
  109. <!-- 查询报价单单价 -->
  110. <select id="getByNumber" resultType="Map">
  111. select * from tuya_sites_info where site_id = 1
  112. </select>
  113. <!-- 添加购买次数记录 -->
  114. <insert id="addBuyOfferNum" parameterType="BuyOfferNum">
  115. insert into bus_buy_offer_num(uuid,jdrq,pay_amount,offer_num,code,pay_type)
  116. values(#{uuid},CONVERT(VARCHAR(100), SYSDATETIME(), 20),#{payAmount},#{offerNum},#{code},#{payType})
  117. </insert>
  118. <!-- 供应商余额充值记录 -->
  119. <insert id="buySupplierBalance" parameterType="WxPay">
  120. insert into bus_top_up_record(uuid,code,jdrq,total_fee,pay_type) values(#{uuid},#{code},CONVERT(VARCHAR(100), SYSDATETIME(), 20),#{totalFee},#{payType})
  121. </insert>
  122. <!-- 查询个人信息 -->
  123. <select id="getPresonalMessage" parameterType="String" resultType="Supplier">
  124. select * from sys_supplier where code = #{code}
  125. </select>
  126. <!-- 存入提现记录 -->
  127. <insert id="zfbCash" parameterType="WxWithdrawal">
  128. insert into bus_withdrawal(uuid,jdrq,amount,out_trade_no,code,name,account,card)
  129. values(#{uuid},SYSDATETIME(),#{amount},#{outTradeNo},#{code},#{name},#{account},#{card})
  130. </insert>
  131. <!-- 提现 -->
  132. <update id="minusBalanceOf" parameterType="WxWithdrawal">
  133. UPDATE sys_supplier
  134. SET balance_of = ( SELECT balance_of - ${amount} FROM sys_supplier WHERE code = #{code} )
  135. WHERE
  136. code = #{code}
  137. </update>
  138. <!-- 用户购买报价单后将资金转入供应商余额 -->
  139. <update id="addSupplierBalanceOf" parameterType="Supplier">
  140. UPDATE sys_supplier
  141. SET balance_of = ( SELECT balance_of + ${balanceOf} FROM sys_supplier WHERE code = #{code} )
  142. WHERE
  143. code = #{code}
  144. </update>
  145. <!-- 用户购买报价单后将资金转入供应商余额子账号同步 -->
  146. <update id="addSupplierBalanceOfChild" parameterType="Supplier">
  147. UPDATE sys_supplier
  148. SET balance_of = ( SELECT balance_of FROM sys_supplier WHERE code = #{code} )
  149. WHERE
  150. account_associated = #{code}
  151. </update>
  152. <!-- 供应商退款后账户余额变更 -->
  153. <update id="subtractBalance" parameterType="Supplier">
  154. UPDATE sys_supplier
  155. SET balance_of = #{bigDecimal2}
  156. WHERE
  157. code = #{code}
  158. </update>
  159. <!-- 支付 -->
  160. <insert id="pay" parameterType="ZFBPay">
  161. insert into bus_pay(uuid,release_uuid,fee_type,mch_id,nonce_str,out_trade_no,total_fee,trade_type,prepay_id,open_id,time_end,jdrq,code_url,body)
  162. values(#{uuid},#{releaseUuid},#{feeType},#{mchId},#{nonceStr},#{outTradeNo},#{totalFee},#{tradeType},#{prepayId},#{openId},#{timeEnd},CONVERT(VARCHAR(100), SYSDATETIME(), 20),#{codeUrl},#{body})
  163. </insert>
  164. <!-- 删除支付信息 -->
  165. <delete id="deletePay" parameterType="ZFBPay">
  166. delete from bus_pay where release_uuid = #{releaseUuid}
  167. </delete>
  168. <!-- 提现 -->
  169. <update id="minusBalanceOfUser" parameterType="WxWithdrawal">
  170. UPDATE sys_users
  171. SET balance_of = ( SELECT balance_of - ${amount} FROM sys_users WHERE code = #{code} )
  172. WHERE
  173. code = #{code}
  174. </update>
  175. </mapper>