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.

407 lines
14 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 weeks ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 weeks ago
2 months ago
2 months ago
2 weeks ago
2 weeks ago
2 weeks 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" useGeneratedKeys="true"
  5. keyProperty="id"
  6. keyColumn="id">
  7. INSERT INTO cash_record_refund (
  8. jwcode,
  9. name,
  10. market,
  11. order_code,
  12. bank_code,
  13. permanent_gold,
  14. free_gold,
  15. submitter_id,
  16. submitter_market,
  17. voucher,
  18. remark,
  19. reject_reason,
  20. refund_reason,
  21. refund_model,
  22. executor,
  23. refund_channels,
  24. refund_time,
  25. refund_remark,
  26. refund_voucher,
  27. refund_currency,
  28. refund_amount,
  29. related_id,
  30. audit_id,
  31. status
  32. ) VALUES (
  33. #{jwcode},
  34. #{name},
  35. #{market},
  36. #{orderCode},
  37. #{bankCode},
  38. #{partRefundGold},
  39. #{partRefundFree},
  40. #{submitterId},
  41. #{submitterMarket},
  42. #{voucher},
  43. #{remark},
  44. #{rejectReason},
  45. #{refundReason},
  46. #{refundModel},
  47. #{executor},
  48. #{refundChannels},
  49. #{refundTime},
  50. #{refundRemark},
  51. #{refundVoucher},
  52. #{refundCurrency},
  53. #{refundAmount},
  54. #{originalOrderId},
  55. #{auditId},
  56. #{status}
  57. );
  58. </insert>
  59. <insert id="addAudit" parameterType="com.example.demo.domain.vo.cash.CashRecordDone" useGeneratedKeys="true" keyProperty="id">
  60. insert into lhl_audit
  61. (
  62. area_servise,
  63. area_finance,
  64. area_charge,
  65. head_finance
  66. )
  67. values(
  68. #{areaServise},
  69. #{areaFinance},
  70. #{areaCharge},
  71. #{headFinance}
  72. )
  73. </insert>
  74. <update id="update">
  75. update cash_record_refund
  76. set
  77. status = 10,
  78. refund_model = #{refundModel},
  79. refund_reason = #{refundReason}
  80. where id = #{id}
  81. </update>
  82. <update id="withdraw">
  83. update cash_record_refund set status = 11
  84. where id = #{id}
  85. </update>
  86. <update id="review">
  87. update cash_record_refund set status = #{status},executor = #{executor},reject_reason = #{rejectReason}
  88. where id = #{id}
  89. </update>
  90. <update id="executor">
  91. update cash_record_refund set refund_currency = #{refundCurrency},
  92. refund_amount = #{refundAmount},
  93. refund_channels = #{refundChannels},
  94. refund_time = #{refundTime},
  95. refund_remark = #{refundRemark},
  96. refund_voucher = #{refundVoucher},
  97. status = #{status},
  98. executor = #{executor}
  99. where id = #{id}
  100. </update>
  101. <update id="updateStatus">
  102. update cash_record_collection
  103. set status = #{status}
  104. <where>
  105. <if test="id != null">
  106. and id = #{id}
  107. </if>
  108. <if test="orderCode != null">
  109. and order_code = #{orderCode}
  110. </if>
  111. </where>
  112. </update>
  113. <update id="updateAudit">
  114. update lhl_audit
  115. <set>
  116. <if test="areaServise != null">
  117. area_servise = #{areaServise},
  118. </if>
  119. <if test="areaFinance != null">
  120. area_finance = #{areaFinance},
  121. </if>
  122. <if test="areaCharge != null">
  123. area_charge = #{areaCharge},
  124. </if>
  125. <if test="headFinance != null">
  126. head_finance = #{headFinance},
  127. </if>
  128. </set>
  129. where id = #{auditId}
  130. </update>
  131. <select id="select" resultType="com.example.demo.domain.vo.cash.CashRecordDTO">
  132. select
  133. crr.id,
  134. crr.jwcode,
  135. crr.name,
  136. crr.market,
  137. crr.permanent_gold,
  138. crr.free_gold,
  139. crr.audit_id,
  140. crr.status,
  141. crr.submitter_id,
  142. crr.submitter_market,
  143. crr.executor,
  144. crr.order_code,
  145. crr.refund_channels,
  146. crr.refund_time,
  147. crr.create_time,
  148. crr.update_time,
  149. crr.audit_time,
  150. crr.related_id,
  151. la.area_servise,
  152. la.area_finance,
  153. la.area_charge,
  154. la.head_finance,
  155. crc.activity,
  156. crc.goods_name,
  157. crc.good_num as goodsNum,
  158. crc.num_unit,
  159. crc.pay_type,
  160. crc.pay_time,
  161. crc.voucher,
  162. crc.remark,
  163. crc.payment_currency,
  164. crc.payment_amount
  165. from cash_record_refund crr
  166. left join lhl_audit la on la.id = crr.audit_id
  167. left join cash_record_collection crc on crc.id = crr.related_id
  168. <where>
  169. <if test="status != null">
  170. and crr.status = #{status}
  171. </if>
  172. <if test="name != null and name.length() > 0">
  173. and crr.name = #{name}
  174. </if>
  175. <if test="jwcode != null">
  176. and crr.jwcode = #{jwcode}
  177. </if>
  178. <if test="markets!= null and markets.size > 0">
  179. AND crr.market IN
  180. <foreach collection="markets" item="markets" open="(" separator="," close=")">
  181. #{markets}
  182. </foreach>
  183. </if>
  184. <if test="statuses!= null and statuses.size > 0">
  185. AND crr.status IN
  186. <foreach collection="statuses" item="statuses" open="(" separator="," close=")">
  187. #{statuses}
  188. </foreach>
  189. </if>
  190. <if test="paymentCurrency!= null and paymentCurrency.length() > 0">
  191. AND crc.payment_currency LIKE CONCAT('%', #{paymentCurrency}, '%')
  192. </if>
  193. <if test="goodsNames!= null and goodsNames.size > 0">
  194. AND crc.goods_name IN
  195. <foreach collection="goodsNames" item="goodsNames" open="(" separator="," close=")">
  196. #{goodsNames}
  197. </foreach>
  198. </if>
  199. <if test="payType != null and payType.length()>0">
  200. and crc.pay_type = #{payType}
  201. </if>
  202. <if test="startTime != null and endTime != null">
  203. and crc.`pay_time` BETWEEN #{startTime} AND #{endTime}
  204. </if>
  205. <if test=" submitterId!= null">
  206. and crr.submitter_id = #{submitterId}
  207. </if>
  208. </where>
  209. <choose>
  210. <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
  211. ORDER BY ${sortField} ${sortOrder}
  212. </when>
  213. <otherwise>
  214. ORDER BY crr.create_time DESC
  215. </otherwise>
  216. </choose>
  217. </select>
  218. <select id="financeSelect" resultType="com.example.demo.domain.vo.cash.CashRecordDTO">
  219. select crr.id,
  220. crr.jwcode,
  221. crr.name,
  222. crr.market,
  223. crc.goods_name,
  224. crr.order_code,
  225. crc.good_num as goodsNum,
  226. crc.num_unit,
  227. crr.refund_model,
  228. crr.submitter_id,
  229. crr.refund_reason,
  230. crr.remark,
  231. crr.status,
  232. crr.permanent_gold,
  233. crr.free_gold,
  234. crr.audit_id,
  235. crr.related_id,
  236. la.area_servise,
  237. la.area_finance,
  238. la.area_charge,
  239. la.head_finance
  240. from cash_record_refund crr
  241. left join cash_record_collection crc on crc.id = crr.related_id
  242. left join lhl_audit la on la.id = crr.audit_id
  243. <where>
  244. <if test="status != null">
  245. and crr.status = #{status}
  246. </if>
  247. <if test="name != null and name.length() > 0">
  248. and crr.name = #{name}
  249. </if>
  250. <if test="jwcode != null">
  251. and crr.jwcode = #{jwcode}
  252. </if>
  253. <if test="markets!= null and markets.size > 0">
  254. AND crr.market IN
  255. <foreach collection="markets" item="markets" open="(" separator="," close=")">
  256. #{markets}
  257. </foreach>
  258. </if>
  259. <if test="statuses!= null and statuses.size > 0">
  260. AND crr.status IN
  261. <foreach collection="statuses" item="statuses" open="(" separator="," close=")">
  262. #{statuses}
  263. </foreach>
  264. </if>
  265. <if test="paymentCurrency!= null and paymentCurrency.length() > 0">
  266. AND crc.payment_currency LIKE CONCAT('%', #{paymentCurrency}, '%')
  267. </if>
  268. <if test="goodsNames!= null and goodsNames.size > 0">
  269. AND crc.goods_name IN
  270. <foreach collection="goodsNames" item="goodsNames" open="(" separator="," close=")">
  271. #{goodsNames}
  272. </foreach>
  273. </if>
  274. <if test="payType != null and payType.length()>0">
  275. and crc.pay_type = #{payType}
  276. </if>
  277. <if test="startTime != null and endTime != null">
  278. and crc.`pay_time` BETWEEN #{startTime} AND #{endTime}
  279. </if>
  280. <if test=" submitterId!= null">
  281. and crr.submitter_id = #{submitterId}
  282. </if>
  283. </where>
  284. <choose>
  285. <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
  286. ORDER BY ${sortField} ${sortOrder}
  287. </when>
  288. <otherwise>
  289. ORDER BY crr.create_time DESC
  290. </otherwise>
  291. </choose>
  292. </select>
  293. <select id="getAudit" resultType="com.example.demo.domain.vo.cash.LhlAudit">
  294. select la.id,
  295. la.area_servise,
  296. la.area_finance,
  297. la.area_charge,
  298. la.head_finance
  299. from lhl_audit la
  300. where la.id = #{id}
  301. </select>
  302. <select id="exSelect" resultType="com.example.demo.domain.vo.cash.CashRecordDTO">
  303. select crr.id,
  304. crr.jwcode,
  305. crr.name,
  306. crr.market,
  307. crc.goods_name,
  308. crc.order_code,
  309. crc.good_num as goodsNum,
  310. crc.num_unit,
  311. crr.refund_model,
  312. crr.refund_currency,
  313. crr.refund_amount,
  314. crr.refund_channels,
  315. crr.voucher,
  316. crr.refund_time,
  317. crr.status,
  318. crr.audit_id,
  319. crr.submitter_id,
  320. crr.related_id,
  321. la.area_servise,
  322. la.area_finance,
  323. la.area_charge,
  324. la.head_finance
  325. from cash_record_refund crr
  326. left join cash_record_collection crc on crc.id = crr.related_id
  327. left join lhl_audit la on la.id = crr.audit_id
  328. <where>
  329. <if test="status != null">
  330. and crr.status = #{status}
  331. </if>
  332. <if test="name != null and name.length() > 0">
  333. and crr.name = #{name}
  334. </if>
  335. <if test="jwcode != null">
  336. and crr.jwcode = #{jwcode}
  337. </if>
  338. <if test="markets!= null and markets.size > 0">
  339. AND crr.market IN
  340. <foreach collection="markets" item="markets" open="(" separator="," close=")">
  341. #{markets}
  342. </foreach>
  343. </if>
  344. <if test="statuses!= null and statuses.size > 0">
  345. AND crr.status IN
  346. <foreach collection="statuses" item="statuses" open="(" separator="," close=")">
  347. #{statuses}
  348. </foreach>
  349. </if>
  350. <if test="goodsNames!= null and goodsNames.size > 0">
  351. AND crc.goods_name IN
  352. <foreach collection="goodsNames" item="goodsNames" open="(" separator="," close=")">
  353. #{goodsNames}
  354. </foreach>
  355. </if>
  356. <if test="refundCurrency != null and refundCurrency.size > 0">
  357. AND crr.refund_currency = #{refundCurrency}
  358. </if>
  359. <if test="refundChannels != null and refundChannels.length()>0">
  360. and crc.refund_channels = #{refundChannels}
  361. </if>
  362. <if test="startTime != null and endTime != null">
  363. and crc.`refund_time` BETWEEN #{startTime} AND #{endTime}
  364. </if>
  365. <if test=" submitterId!= null">
  366. and crr.submitter_id = #{submitterId}
  367. </if>
  368. </where>
  369. <choose>
  370. <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
  371. ORDER BY ${sortField} ${sortOrder}
  372. </when>
  373. <otherwise>
  374. ORDER BY crr.create_time DESC
  375. </otherwise>
  376. </choose>
  377. </select>
  378. <select id="getAuditBatch" resultType="com.example.demo.domain.vo.cash.LhlAudit">
  379. SELECT *
  380. FROM lhl_audit
  381. WHERE 1 = 0
  382. <if test="auditIds != null and auditIds.size() > 0">
  383. OR id IN
  384. <foreach collection="auditIds" item="id" open="(" separator="," close=")">
  385. #{id}
  386. </foreach>
  387. </if>
  388. </select>
  389. <select id="selectById" resultType="com.example.demo.domain.vo.cash.CashRecordDTO">
  390. select crr.id,
  391. crr.jwcode,
  392. crr.name,
  393. crr.status
  394. from cash_record_refund crr
  395. where crr.id = #{id}
  396. </select>
  397. </mapper>