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
6 days ago
1 week 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. 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. <update id="update">
  73. update cash_record_refund
  74. set
  75. status = 10,
  76. refund_model = #{refundModel},
  77. refund_reason = #{refundReason}
  78. where id = #{id}
  79. </update>
  80. <update id="withdraw">
  81. update cash_record_refund set status = 11
  82. where id = #{id}
  83. </update>
  84. <update id="review">
  85. update cash_record_refund set status = #{status},executor = #{executor},reject_reason = #{rejectReason}
  86. where id = #{id}
  87. </update>
  88. <update id="executor">
  89. update cash_record_refund set refund_currency = #{refundCurrency},
  90. refund_amount = #{refundAmount},
  91. refund_channels = #{refundChannels},
  92. refund_time = #{refundTime},
  93. refund_remark = #{refundRemark},
  94. refund_voucher = #{refundVoucher},
  95. status = #{status},
  96. executor = #{executor}
  97. where id = #{id}
  98. </update>
  99. <update id="updateStatus">
  100. update cash_record_collection
  101. set status = #{status}
  102. <where>
  103. <if test="id != null">
  104. and id = #{id}
  105. </if>
  106. <if test="orderCode != null">
  107. and order_code = #{orderCode}
  108. </if>
  109. </where>
  110. </update>
  111. <update id="updateAudit">
  112. update lhl_audit
  113. <set>
  114. <if test="areaServise != null">
  115. area_servise = #{areaServise},
  116. </if>
  117. <if test="areaFinance != null">
  118. area_finance = #{areaFinance},
  119. </if>
  120. <if test="areaCharge != null">
  121. area_charge = #{areaCharge},
  122. </if>
  123. <if test="headFinance != null">
  124. head_finance = #{headFinance},
  125. </if>
  126. </set>
  127. where id = #{auditId}
  128. </update>
  129. <select id="select" resultType="com.example.demo.domain.vo.cash.CashRecordDTO">
  130. select
  131. crr.id,
  132. crr.jwcode,
  133. crr.name,
  134. crr.market,
  135. crr.permanent_gold,
  136. crr.free_gold,
  137. crr.audit_id,
  138. crr.status,
  139. crr.submitter_id,
  140. crr.submitter_market,
  141. crr.executor,
  142. crr.order_code,
  143. crr.refund_channels,
  144. crr.refund_time,
  145. crr.create_time,
  146. crr.update_time,
  147. crr.audit_time,
  148. crr.related_id,
  149. la.area_servise,
  150. la.area_finance,
  151. la.area_charge,
  152. la.head_finance,
  153. crc.activity,
  154. crc.goods_name,
  155. crc.good_num as goodsNum,
  156. crc.num_unit,
  157. crc.pay_type,
  158. crc.pay_time,
  159. crc.voucher,
  160. crc.remark,
  161. crc.payment_currency,
  162. crc.payment_amount
  163. from cash_record_refund crr
  164. left join lhl_audit la on la.id = crr.audit_id
  165. left join cash_record_collection crc on crc.id = crr.related_id
  166. <where>
  167. <if test="status != null">
  168. and crr.status = #{status}
  169. </if>
  170. <if test="name != null and name.length() > 0">
  171. and crr.name = #{name}
  172. </if>
  173. <if test="jwcode != null">
  174. and crr.jwcode = #{jwcode}
  175. </if>
  176. <if test="markets!= null and markets.size > 0">
  177. AND crr.market IN
  178. <foreach collection="markets" item="markets" open="(" separator="," close=")">
  179. #{markets}
  180. </foreach>
  181. </if>
  182. <if test="statuses!= null and statuses.size > 0">
  183. AND crr.status IN
  184. <foreach collection="statuses" item="statuses" open="(" separator="," close=")">
  185. #{statuses}
  186. </foreach>
  187. </if>
  188. <if test="paymentCurrency!= null and paymentCurrency.length() > 0">
  189. AND crc.payment_currency LIKE CONCAT('%', #{paymentCurrency}, '%')
  190. </if>
  191. <if test="goodsNames!= null and goodsNames.size > 0">
  192. AND crc.goods_name IN
  193. <foreach collection="goodsNames" item="goodsNames" open="(" separator="," close=")">
  194. #{goodsNames}
  195. </foreach>
  196. </if>
  197. <if test="payType != null and payType.length()>0">
  198. and crc.pay_type = #{payType}
  199. </if>
  200. <if test="startTime != null and endTime != null">
  201. and crc.`pay_time` BETWEEN #{startTime} AND #{endTime}
  202. </if>
  203. <if test=" submitterId!= null">
  204. and crr.submitter_id = #{submitterId}
  205. </if>
  206. </where>
  207. <choose>
  208. <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
  209. ORDER BY ${sortField} ${sortOrder}
  210. </when>
  211. <otherwise>
  212. ORDER BY crr.create_time DESC
  213. </otherwise>
  214. </choose>
  215. </select>
  216. <select id="financeSelect" resultType="com.example.demo.domain.vo.cash.CashRecordDTO">
  217. select crr.id,
  218. crr.jwcode,
  219. crr.name,
  220. crr.market,
  221. crc.goods_name,
  222. crr.order_code,
  223. crc.good_num as goodsNum,
  224. crc.num_unit,
  225. crr.refund_model,
  226. crr.submitter_id,
  227. crr.executor,
  228. crr.refund_reason,
  229. crr.remark,
  230. crr.status,
  231. crr.permanent_gold,
  232. crr.free_gold,
  233. crr.audit_id,
  234. crr.related_id,
  235. la.area_servise,
  236. la.area_finance,
  237. la.area_charge,
  238. la.head_finance
  239. from cash_record_refund crr
  240. left join cash_record_collection crc on crc.id = crr.related_id
  241. left join lhl_audit la on la.id = crr.audit_id
  242. <where>
  243. <if test="status != null">
  244. and crr.status = #{status}
  245. </if>
  246. <if test="name != null and name.length() > 0">
  247. and crr.name = #{name}
  248. </if>
  249. <if test="jwcode != null">
  250. and crr.jwcode = #{jwcode}
  251. </if>
  252. <if test="markets!= null and markets.size > 0">
  253. AND crr.market IN
  254. <foreach collection="markets" item="markets" open="(" separator="," close=")">
  255. #{markets}
  256. </foreach>
  257. </if>
  258. <if test="statuses!= null and statuses.size > 0">
  259. AND crr.status IN
  260. <foreach collection="statuses" item="statuses" open="(" separator="," close=")">
  261. #{statuses}
  262. </foreach>
  263. </if>
  264. <if test="paymentCurrency!= null and paymentCurrency.length() > 0">
  265. AND crc.payment_currency LIKE CONCAT('%', #{paymentCurrency}, '%')
  266. </if>
  267. <if test="goodsNames!= null and goodsNames.size > 0">
  268. AND crc.goods_name IN
  269. <foreach collection="goodsNames" item="goodsNames" open="(" separator="," close=")">
  270. #{goodsNames}
  271. </foreach>
  272. </if>
  273. <if test="payType != null and payType.length()>0">
  274. and crc.pay_type = #{payType}
  275. </if>
  276. <if test="startTime != null and endTime != null">
  277. and crc.`pay_time` BETWEEN #{startTime} AND #{endTime}
  278. </if>
  279. <if test=" submitterId!= null">
  280. and crr.submitter_id = #{submitterId}
  281. </if>
  282. </where>
  283. <choose>
  284. <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
  285. ORDER BY ${sortField} ${sortOrder}
  286. </when>
  287. <otherwise>
  288. ORDER BY crr.create_time DESC
  289. </otherwise>
  290. </choose>
  291. </select>
  292. <select id="getAudit" resultType="com.example.demo.domain.vo.cash.LhlAudit">
  293. select la.id,
  294. la.area_servise,
  295. la.area_finance,
  296. la.area_charge,
  297. la.head_finance
  298. from lhl_audit la
  299. where la.id = #{id}
  300. </select>
  301. <select id="exSelect" resultType="com.example.demo.domain.vo.cash.CashRecordDTO">
  302. select crr.id,
  303. crr.jwcode,
  304. crr.name,
  305. crr.market,
  306. crc.goods_name,
  307. crc.order_code,
  308. crc.good_num as goodsNum,
  309. crc.num_unit,
  310. crr.refund_model,
  311. crr.refund_currency,
  312. crr.refund_amount,
  313. crr.refund_channels,
  314. crr.refund_voucher,
  315. crr.refund_time,
  316. crr.executor,
  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.length() > 0">
  357. AND crr.refund_currency = #{refundCurrency}
  358. </if>
  359. <if test="refundChannels != null and refundChannels.length()>0">
  360. and crr.refund_channels = #{refundChannels}
  361. </if>
  362. <if test="sTime != null and eTime != null">
  363. and crr.`refund_time` BETWEEN #{sTime} AND #{eTime}
  364. </if>
  365. <if test=" executor!= null">
  366. and crr.executor = #{executor}
  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. <!-- 批量获取审核人信息 -->
  379. <select id="getAuditBatch" resultType="com.example.demo.domain.vo.cash.LhlAudit">
  380. SELECT *
  381. FROM lhl_audit
  382. WHERE 1 = 0
  383. <if test="auditIds != null and auditIds.size() > 0">
  384. OR id IN
  385. <foreach collection="auditIds" item="id" open="(" separator="," close=")">
  386. #{id}
  387. </foreach>
  388. </if>
  389. </select>
  390. <select id="selectById" resultType="com.example.demo.domain.vo.cash.CashRecordDTO">
  391. select crr.id,
  392. crr.jwcode,
  393. crr.name,
  394. crr.status
  395. from cash_record_refund crr
  396. where crr.id = #{id}
  397. </select>
  398. </mapper>