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.

424 lines
15 KiB

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