You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

268 lines
8.8 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  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.example.demo.mapper.cash.CashRefundMapper">
  4. <insert id="insert">
  5. INSERT INTO cash_record (
  6. order_type,
  7. jwcode,
  8. name,
  9. market,
  10. activity,
  11. order_code,
  12. bank_code,
  13. goods_name,
  14. good_num,
  15. audit_id,
  16. payment_currency,
  17. payment_amount,
  18. received_currency,
  19. received_amount,
  20. handling_charge,
  21. received_market,
  22. pay_type,
  23. pay_time,
  24. received_time,
  25. status,
  26. submitter_id,
  27. voucher,
  28. remark,
  29. refund_reason,
  30. refund_model,
  31. executor,
  32. refund_channels,
  33. refund_time,
  34. refund_remark,
  35. refund_voucher
  36. ) VALUES (
  37. #{orderType},
  38. #{jwcode},
  39. #{name},
  40. #{market},
  41. #{activity},
  42. #{orderCode},
  43. #{bankCode},
  44. #{goodsName},
  45. #{goodNum},
  46. #{auditId},
  47. #{paymentCurrency},
  48. #{paymentAmount},
  49. #{receivedCurrency},
  50. #{receivedAmount},
  51. #{handlingCharge},
  52. #{receivedMarket},
  53. #{payType},
  54. #{payTime},
  55. #{receivedTime},
  56. #{status},
  57. #{submitterId},
  58. #{voucher},
  59. #{remark},
  60. #{refundReason},
  61. #{refundModel},
  62. #{executor},
  63. #{refundChannels},
  64. #{refundTime},
  65. #{refundRemark},
  66. #{refundVoucher}
  67. );
  68. </insert>
  69. <insert id="addAudit" parameterType="com.example.demo.domain.vo.cash.CashRecordDone" useGeneratedKeys="true" keyProperty="id">
  70. insert into lhl_audit
  71. (
  72. area_servise,
  73. area_finance,
  74. area_charge,
  75. head_finance
  76. )
  77. values(
  78. #{areaServise},
  79. #{areaFinance},
  80. #{areaCharge},
  81. #{headFinance}
  82. )
  83. </insert>
  84. <update id="update">
  85. update cash_record
  86. set
  87. status = 10,
  88. refund_model = #{refundModel},
  89. refund_reason = #{refundReason}
  90. where id = #{id}
  91. </update>
  92. <update id="withdraw">
  93. update cash_record set status = 11
  94. where order_type =2 and id = #{id}
  95. </update>
  96. <update id="review">
  97. update cash_record set status = #{status},executor = #{executor},reject_reason = #{rejectReason}
  98. where order_type =2 and id = #{id}
  99. </update>
  100. <update id="executor">
  101. update cash_record set refund_currency = #{refundCurrency},
  102. refund_amount = #{refundAmount},
  103. refund_channels = #{refundChannels},
  104. refund_time = #{refundTime},
  105. refund_remark = #{refundRemark},
  106. refund_voucher = #{refundVoucher},
  107. status = #{status},
  108. executor = #{executor}
  109. where order_type =2 and id = #{id}
  110. </update>
  111. <update id="updateStatus">
  112. update cash_record
  113. set status = #{status}
  114. <where>
  115. <if test="id != null">
  116. and id = #{id}
  117. </if>
  118. <if test="orderCode != null">
  119. and order_code = #{orderCode}
  120. </if>
  121. </where>
  122. </update>
  123. <update id="updateAudit">
  124. update lhl_audit
  125. <set>
  126. <if test="areaServise != null">
  127. area_servise = #{areaServise},
  128. </if>
  129. <if test="areaFinance != null">
  130. area_finance = #{areaFinance},
  131. </if>
  132. <if test="areaCharge != null">
  133. area_charge = #{areaCharge},
  134. </if>
  135. <if test="headFinance != null">
  136. head_finance = #{headFinance},
  137. </if>
  138. </set>
  139. where id = #{auditId}
  140. </update>
  141. <select id="select" resultType="com.example.demo.domain.vo.cash.CashRecordDone">
  142. select
  143. cr.id,
  144. cr.order_type,
  145. cr.jwcode,
  146. cr.name,
  147. cr.market,
  148. cr.activity,
  149. cr.order_code,
  150. cr.bank_code,
  151. cr.goods_name,
  152. cr.good_num,
  153. cr.payment_currency,
  154. Round((payment_amount) / 100.0, 2) AS PaymentAmount,
  155. cr.received_currency,
  156. Round((received_amount) / 100.0, 2) AS receivedAmount,
  157. Round((handling_charge) / 100.0, 2) AS handlingCharge,
  158. cr.pay_type,
  159. cr.received_market,
  160. cr.pay_time,
  161. cr.received_time,
  162. cr.audit_id,
  163. cr.status,
  164. cr.submitter_id,
  165. cr.voucher,
  166. cr.refund_reason,
  167. cr.refund_model,
  168. cr.executor,
  169. cr.refund_channels,
  170. cr.refund_time,
  171. cr.refund_remark,
  172. cr.refund_voucher,
  173. cr.remark,
  174. cr.reject_reason,
  175. cr.create_time,
  176. cr.update_time,
  177. cr.audit_time,
  178. a1.admin_name as submitterName,
  179. a3.admin_name as executorName,
  180. a2.area_servise,
  181. a2.area_finance,
  182. a2.area_charge,
  183. a2.head_finance,
  184. cr.refund_currency,
  185. cr.refund_amount,
  186. cr.permanent_gold,
  187. cr.free_gold,
  188. m.name as marketName
  189. from cash_record cr
  190. left join admin a1 on submitter_id = a1.id
  191. left join lhl_audit a2 on cr.audit_id = a2.id
  192. left join admin a3 on executor = a3.account
  193. left join market m on m.id = cr.market
  194. <where>
  195. cr.order_type = 2
  196. <if test="status != null">
  197. and cr.status = #{status}
  198. </if>
  199. <if test="orderCode != null">
  200. and cr.order_code = #{orderCode}
  201. </if>
  202. <if test="name != null and name.length() > 0">
  203. and cr.name = #{name}
  204. </if>
  205. <if test="jwcode != null">
  206. and cr.jwcode = #{jwcode}
  207. </if>
  208. <if test="markets!= null and markets.size > 0">
  209. AND cr.market IN
  210. <foreach collection="markets" item="markets" open="(" separator="," close=")">
  211. #{markets}
  212. </foreach>
  213. </if>
  214. <if test="statuses!= null and statuses.size > 0">
  215. AND cr.status IN
  216. <foreach collection="statuses" item="statuses" open="(" separator="," close=")">
  217. #{statuses}
  218. </foreach>
  219. </if>
  220. <if test="paymentCurrency!= null and paymentCurrency.length() > 0">
  221. AND cr.payment_currency LIKE CONCAT('%', #{paymentCurrency}, '%')
  222. </if>
  223. <if test="goodsNames!= null and goodsNames.size > 0">
  224. AND cr.goods_name IN
  225. <foreach collection="goodsNames" item="goodsNames" open="(" separator="," close=")">
  226. #{goodsNames}
  227. </foreach>
  228. </if>
  229. <if test="payType != null and payType.length()>0">
  230. and cr.pay_type = #{payType}
  231. </if>
  232. <if test="receivedMarket != null and receivedMarket.length()>0">
  233. and cr.received_market = #{receivedMarket}
  234. </if>
  235. <if test="refundModel != null and refundModel.length()>0">
  236. and cr.refundModel = #{refundModel}
  237. </if>
  238. <if test="startTime != null and endTime != null">
  239. and cr.`pay_time` BETWEEN #{startTime} AND #{endTime}
  240. </if>
  241. <if test=" submitterId!= null">
  242. and cr.submitter_id = #{submitterId}
  243. </if>
  244. <if test="refundCurrency != null and refundCurrency.length()>0">
  245. and cr.refund_currency = #{refundCurrency}
  246. </if>
  247. <if test="refundChannels != null and refundChannels.length()>0">
  248. and cr.refund_channels = #{refundChannels}
  249. </if>
  250. <if test="sTime != null and eTime != null">
  251. and cr.`refund_time` BETWEEN #{sTime} AND #{eTime}
  252. </if>
  253. </where>
  254. <choose>
  255. <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
  256. ORDER BY ${sortField} ${sortOrder}
  257. </when>
  258. <otherwise>
  259. ORDER BY create_time DESC
  260. </otherwise>
  261. </choose>
  262. </select>
  263. </mapper>