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.

392 lines
14 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
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_refund (
  6. jwcode,
  7. name,
  8. market,
  9. order_code,
  10. bank_code,
  11. permanent_gold,
  12. free_gold,
  13. submitter_id,
  14. submitter_market,
  15. voucher,
  16. remark,
  17. reject_reason,
  18. refund_reason,
  19. refund_model,
  20. executor,
  21. refund_channels,
  22. refund_time,
  23. refund_remark,
  24. refund_voucher,
  25. refund_currency,
  26. refund_amount,
  27. related_id,
  28. audit_id,
  29. status
  30. ) VALUES (
  31. #{jwcode},
  32. #{name},
  33. #{market},
  34. #{orderCode},
  35. #{bankCode},
  36. #{partRefundGold},
  37. #{partRefundFree},
  38. #{submitterId},
  39. #{submitterMarket},
  40. #{voucher},
  41. #{remark},
  42. #{rejectReason},
  43. #{refundReason},
  44. #{refundModel},
  45. #{executor},
  46. #{refundChannels},
  47. #{refundTime},
  48. #{refundRemark},
  49. #{refundVoucher},
  50. #{refundCurrency},
  51. #{refundAmount},
  52. #{id},
  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.refund_channels,
  143. crr.refund_time,
  144. crr.create_time,
  145. crr.update_time,
  146. crr.audit_time,
  147. crr.related_id,
  148. la.area_servise,
  149. la.area_finance,
  150. la.area_charge,
  151. la.head_finance,
  152. crc.activity,
  153. crc.goods_name,
  154. crc.good_num as goodsNum,
  155. crc.num_unit,
  156. crc.pay_type,
  157. crc.pay_time,
  158. crc.voucher,
  159. crc.remark,
  160. crc.payment_currency,
  161. crc.payment_amount
  162. from cash_record_refund crr
  163. left join lhl_audit la on la.id = crr.audit_id
  164. left join cash_record_collection crc on crc.id = crr.related_id
  165. <where>
  166. <if test="status != null">
  167. and crr.status = #{status}
  168. </if>
  169. <if test="name != null and name.length() > 0">
  170. and crr.name = #{name}
  171. </if>
  172. <if test="jwcode != null">
  173. and crr.jwcode = #{jwcode}
  174. </if>
  175. <if test="markets!= null and markets.size > 0">
  176. AND crr.market IN
  177. <foreach collection="markets" item="markets" open="(" separator="," close=")">
  178. #{markets}
  179. </foreach>
  180. </if>
  181. <if test="statuses!= null and statuses.size > 0">
  182. AND crr.status IN
  183. <foreach collection="statuses" item="statuses" open="(" separator="," close=")">
  184. #{statuses}
  185. </foreach>
  186. </if>
  187. <if test="paymentCurrency!= null and paymentCurrency.length() > 0">
  188. AND crc.payment_currency LIKE CONCAT('%', #{paymentCurrency}, '%')
  189. </if>
  190. <if test="goodsNames!= null and goodsNames.size > 0">
  191. AND crc.goods_name IN
  192. <foreach collection="goodsNames" item="goodsNames" open="(" separator="," close=")">
  193. #{goodsNames}
  194. </foreach>
  195. </if>
  196. <if test="payType != null and payType.length()>0">
  197. and crc.pay_type = #{payType}
  198. </if>
  199. <if test="startTime != null and endTime != null">
  200. and crc.`pay_time` BETWEEN #{startTime} AND #{endTime}
  201. </if>
  202. <if test=" submitterId!= null">
  203. and crr.submitter_id = #{submitterId}
  204. </if>
  205. </where>
  206. <choose>
  207. <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
  208. ORDER BY ${sortField} ${sortOrder}
  209. </when>
  210. <otherwise>
  211. ORDER BY crr.create_time DESC
  212. </otherwise>
  213. </choose>
  214. </select>
  215. <select id="financeSelect" resultType="com.example.demo.domain.vo.cash.CashRecordDTO">
  216. select crr.id,
  217. crr.jwcode,
  218. crr.name,
  219. crr.market,
  220. crc.goods_name,
  221. crc.good_num as goodsNum,
  222. crc.num_unit,
  223. crr.refund_model,
  224. crr.submitter_id,
  225. crr.refund_reason,
  226. crr.remark,
  227. crr.status,
  228. crr.permanent_gold,
  229. crr.free_gold,
  230. crr.audit_id,
  231. crr.related_id,
  232. la.area_servise,
  233. la.area_finance,
  234. la.area_charge,
  235. la.head_finance
  236. from cash_record_refund crr
  237. left join cash_record_collection crc on crc.id = crr.related_id
  238. left join lhl_audit la on la.id = crr.audit_id
  239. <where>
  240. <if test="status != null">
  241. and crr.status = #{status}
  242. </if>
  243. <if test="name != null and name.length() > 0">
  244. and crr.name = #{name}
  245. </if>
  246. <if test="jwcode != null">
  247. and crr.jwcode = #{jwcode}
  248. </if>
  249. <if test="markets!= null and markets.size > 0">
  250. AND crr.market IN
  251. <foreach collection="markets" item="markets" open="(" separator="," close=")">
  252. #{markets}
  253. </foreach>
  254. </if>
  255. <if test="statuses!= null and statuses.size > 0">
  256. AND crr.status IN
  257. <foreach collection="statuses" item="statuses" open="(" separator="," close=")">
  258. #{statuses}
  259. </foreach>
  260. </if>
  261. <if test="paymentCurrency!= null and paymentCurrency.length() > 0">
  262. AND crc.payment_currency LIKE CONCAT('%', #{paymentCurrency}, '%')
  263. </if>
  264. <if test="goodsNames!= null and goodsNames.size > 0">
  265. AND crc.goods_name IN
  266. <foreach collection="goodsNames" item="goodsNames" open="(" separator="," close=")">
  267. #{goodsNames}
  268. </foreach>
  269. </if>
  270. <if test="payType != null and payType.length()>0">
  271. and crc.pay_type = #{payType}
  272. </if>
  273. <if test="startTime != null and endTime != null">
  274. and crc.`pay_time` BETWEEN #{startTime} AND #{endTime}
  275. </if>
  276. <if test=" submitterId!= null">
  277. and crr.submitter_id = #{submitterId}
  278. </if>
  279. </where>
  280. <choose>
  281. <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
  282. ORDER BY ${sortField} ${sortOrder}
  283. </when>
  284. <otherwise>
  285. ORDER BY crr.create_time DESC
  286. </otherwise>
  287. </choose>
  288. </select>
  289. <select id="getAudit" resultType="com.example.demo.domain.vo.cash.LhlAudit">
  290. select la.id,
  291. la.area_servise,
  292. la.area_finance,
  293. la.area_charge,
  294. la.head_finance
  295. from lhl_audit la
  296. where la.id = #{id}
  297. </select>
  298. <select id="exSelect" resultType="com.example.demo.domain.vo.cash.CashRecordDTO">
  299. select crr.id,
  300. crr.jwcode,
  301. crr.name,
  302. crr.market,
  303. crc.goods_name,
  304. crc.good_num as goodsNum,
  305. crc.num_unit,
  306. crr.refund_model,
  307. crr.refund_currency,
  308. crr.refund_amount,
  309. crr.refund_channels,
  310. crr.voucher,
  311. crr.refund_time,
  312. crr.status,
  313. crr.audit_id,
  314. crr.related_id,
  315. la.area_servise,
  316. la.area_finance,
  317. la.area_charge,
  318. la.head_finance
  319. from cash_record_refund crr
  320. left join cash_record_collection crc on crc.id = crr.related_id
  321. left join lhl_audit la on la.id = crr.audit_id
  322. <where>
  323. <if test="status != null">
  324. and crr.status = #{status}
  325. </if>
  326. <if test="name != null and name.length() > 0">
  327. and crr.name = #{name}
  328. </if>
  329. <if test="jwcode != null">
  330. and crr.jwcode = #{jwcode}
  331. </if>
  332. <if test="markets!= null and markets.size > 0">
  333. AND crr.market IN
  334. <foreach collection="markets" item="markets" open="(" separator="," close=")">
  335. #{markets}
  336. </foreach>
  337. </if>
  338. <if test="statuses!= null and statuses.size > 0">
  339. AND crr.status IN
  340. <foreach collection="statuses" item="statuses" open="(" separator="," close=")">
  341. #{statuses}
  342. </foreach>
  343. </if>
  344. <if test="goodsNames!= null and goodsNames.size > 0">
  345. AND crc.goods_name IN
  346. <foreach collection="goodsNames" item="goodsNames" open="(" separator="," close=")">
  347. #{goodsNames}
  348. </foreach>
  349. </if>
  350. <if test="refundCurrency != null and refundCurrency.size > 0">
  351. AND crr.refund_currency = #{refundCurrency}
  352. </if>
  353. <if test="refundChannels != null and refundChannels.length()>0">
  354. and crc.refund_channels = #{refundChannels}
  355. </if>
  356. <if test="startTime != null and endTime != null">
  357. and crc.`refund_time` BETWEEN #{startTime} AND #{endTime}
  358. </if>
  359. <if test=" submitterId!= null">
  360. and crr.submitter_id = #{submitterId}
  361. </if>
  362. </where>
  363. <choose>
  364. <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
  365. ORDER BY ${sortField} ${sortOrder}
  366. </when>
  367. <otherwise>
  368. ORDER BY crr.create_time DESC
  369. </otherwise>
  370. </choose>
  371. </select>
  372. <select id="getAuditBatch" resultType="com.example.demo.domain.vo.cash.LhlAudit">
  373. select * from lhl_audit
  374. <where>
  375. <if test="auditIds != null and auditIds.size() > 0">
  376. id in
  377. <foreach collection="auditIds" item="id" open="(" separator="," close=")">
  378. #{id}
  379. </foreach>
  380. </if>
  381. </where>
  382. </select>
  383. </mapper>