OrderRefundDao.xml 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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.kmall.admin.dao.OrderRefundDao">
  4. <resultMap type="com.kmall.admin.entity.OrderRefundEntity" id="orderRefundMap">
  5. <result property="id" column="id"/>
  6. <result property="orderId" column="order_id"/>
  7. <result property="userId" column="user_id"/>
  8. <result property="outRefundNo" column="out_refund_no"/>
  9. <result property="refundId" column="refund_id"/>
  10. <result property="refundType" column="refund_type"/>
  11. <result property="refundTime" column="refund_time"/>
  12. <result property="creator" column="creator"/>
  13. <result property="refundMoney" column="refund_money"/>
  14. <result property="refundStatus" column="refund_status"/>
  15. <result property="refundReason" column="refund_reason"/>
  16. <result property="approver" column="approver"/>
  17. <result property="approvalTime" column="approval_time"/>
  18. <result property="approvalRemark" column="approval_remark"/>
  19. <result property="createSn" column="create_sn"/>
  20. <result property="createTime" column="create_time"/>
  21. <result property="moderSn" column="moder_sn"/>
  22. <result property="modTime" column="mod_time"/>
  23. <result property="tstm" column="tstm"/>
  24. <result property="refundRecvAccout" column="refund_recv_accout"/>
  25. <result property="wechatRefundStatusDes" column="wechat_refund_status_des"/>
  26. <result property="orderSn" column="order_sn"/>
  27. <result property="orderStatus" column="order_status"/>
  28. <result property="actualPrice" column="actual_price"/>
  29. <result property="userName" column="username"/>
  30. <result property="refundFeeType" column="refund_fee_type"/>
  31. <result property="totalFee" column="total_fee"/>
  32. <result property="feeType" column="fee_type"/>
  33. <result property="cashFee" column="cash_fee"/>
  34. <result property="cashFeeType" column="cash_fee_type"/>
  35. <result property="cashRefundFee" column="cash_refund_fee"/>
  36. <result property="cashRefundFeeType" column="cash_refund_fee_type"/>
  37. <result property="rate" column="rate"/>
  38. </resultMap>
  39. <select id="queryObject" resultType="com.kmall.admin.entity.OrderRefundEntity">
  40. SELECT
  41. r.id,
  42. r.order_id,
  43. r.user_id,
  44. r.out_refund_no,
  45. r.refund_id,
  46. r.refund_type,
  47. r.refund_time,
  48. r.creator,
  49. r.refund_money,
  50. r.refund_fee_type,
  51. r.total_fee,
  52. r.fee_type,
  53. r.cash_fee,
  54. r.cash_fee_type,
  55. r.cash_refund_fee,
  56. r.cash_refund_fee_type,
  57. r.rate,
  58. r.refund_status,
  59. r.refund_reason,
  60. r.wechat_refund_status_des,
  61. r.refund_recv_accout,
  62. r.approval_time,
  63. r.approval_remark,
  64. r.create_time,
  65. o.order_sn,
  66. o.order_status,
  67. o.actual_price,
  68. o.order_price,
  69. o.goods_price,
  70. o.add_time,
  71. u.username AS username,
  72. s.username AS approver
  73. FROM mall_order_refund r
  74. LEFT JOIN mall_order o ON r.order_id = o.id
  75. LEFT JOIN mall_user u ON o.user_id = u.id
  76. LEFT JOIN sys_user s ON s.user_id = r.approver
  77. where r.id = #{id}
  78. </select>
  79. <select id="queryList" resultType="com.kmall.admin.entity.OrderRefundEntity">
  80. select
  81. r.*,
  82. o.order_sn,
  83. o.order_status,
  84. o.actual_price,
  85. o.order_price,
  86. o.goods_price,
  87. o.add_time,
  88. u.username as username
  89. from mall_order_refund r
  90. left join mall_order o on r.order_id = o.id
  91. left join mall_user u on o.user_id = u.id
  92. WHERE 1=1
  93. <if test="orderSn != null and orderSn.trim() != ''">
  94. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  95. </if>
  96. <if test="userName != null and userName.trim() != ''">
  97. AND u.username LIKE concat('%',#{userName},'%')
  98. </if>
  99. <if test="orderId != null">
  100. AND o.id = #{orderId}
  101. </if>
  102. <if test="storeId != null and storeId != ''">
  103. AND o.store_id = #{storeId}
  104. </if>
  105. <if test="merchSn != null and merchSn.trim() != ''">
  106. AND o.merch_sn = #{merchSn}
  107. </if>
  108. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  109. AND o.shipping_status = #{shippingStatus}
  110. </if>
  111. <if test="payStatus != null and payStatus.trim() != ''">
  112. AND o.pay_status = #{payStatus}
  113. </if>
  114. <if test="orderStatus != null and orderStatus.trim() != ''">
  115. AND o.order_status = #{orderStatus}
  116. </if>
  117. <if test="noCancelStatus != null and noCancelStatus == 'true'">
  118. AND o.order_status != 101
  119. </if>
  120. <if test="refundStatus != null">
  121. AND r.refund_status = #{refundStatus}
  122. </if>
  123. <if test="orderType != null and orderType.trim() != ''">
  124. AND o.order_type = #{orderType}
  125. </if>
  126. <choose>
  127. <when test="sidx != null and sidx.trim() != ''">
  128. order by ${sidx} ${order}
  129. </when>
  130. <otherwise>
  131. order by r.id desc
  132. </otherwise>
  133. </choose>
  134. <if test="offset != null and limit != null">
  135. limit #{offset}, #{limit}
  136. </if>
  137. </select>
  138. <select id="queryTotal" resultType="int">
  139. select count(r.id)
  140. from mall_order_refund r
  141. left join mall_order o on r.order_id = o.id
  142. left join mall_user u on o.user_id = u.id
  143. WHERE 1=1
  144. <if test="orderSn != null and orderSn.trim() != ''">
  145. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  146. </if>
  147. <if test="userName != null and userName.trim() != ''">
  148. AND u.username LIKE concat('%',#{userName},'%')
  149. </if>
  150. <if test="storeId != null and storeId != ''">
  151. AND o.store_id = #{storeId}
  152. </if>
  153. <if test="merchSn != null and merchSn.trim() != ''">
  154. AND o.merch_sn = #{merchSn}
  155. </if>
  156. <if test="orderId != null">
  157. AND o.id = #{orderId}
  158. </if>
  159. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  160. AND o.shipping_status = #{shippingStatus}
  161. </if>
  162. <if test="payStatus != null and payStatus.trim() != ''">
  163. AND o.pay_status = #{payStatus}
  164. </if>
  165. <if test="orderStatus != null and orderStatus.trim() != ''">
  166. AND o.order_status = #{orderStatus}
  167. </if>
  168. <if test="noCancelStatus != null and noCancelStatus == 'true'">
  169. AND o.order_status != 101
  170. </if>
  171. <if test="refundStatus != null">
  172. AND r.refund_status = #{refundStatus}
  173. </if>
  174. <if test="orderType != null and orderType.trim() != ''">
  175. AND o.order_type = #{orderType}
  176. </if>
  177. </select>
  178. <insert id="save" parameterType="com.kmall.admin.entity.OrderRefundEntity" useGeneratedKeys="true" keyProperty="id">
  179. insert into mall_order_refund(
  180. `order_id`,
  181. `user_id`,
  182. `refund_type`,
  183. `refund_time`,
  184. `creator`,
  185. `refund_money`,
  186. `refund_fee_type`,
  187. `total_fee`,
  188. `fee_type`,
  189. `cash_fee`,
  190. `cash_fee_type`,
  191. `cash_refund_fee`,
  192. `cash_refund_fee_type`,
  193. `rate`,
  194. `refund_status`,
  195. `wechat_refund_status_des`,
  196. `approver`,
  197. `approval_time`,
  198. `approval_remark`,
  199. `out_refund_no`)
  200. values(
  201. #{orderId},
  202. #{userId},
  203. #{refundType},
  204. #{refundTime},
  205. #{creator},
  206. #{refundMoney},
  207. #{refundFeeType},
  208. #{totalFee},
  209. #{feeType},
  210. #{cashFee},
  211. #{cashFeeType},
  212. #{cashRefundFee},
  213. #{cashRefundFeeType},
  214. #{rate},
  215. #{refundStatus},
  216. #{wechatRefundStatusDes},
  217. #{approver},
  218. #{approvalTime},
  219. #{approvalRemark},
  220. #{outRefundNo})
  221. </insert>
  222. <update id="update" parameterType="com.kmall.admin.entity.OrderRefundEntity">
  223. update mall_order_refund
  224. <set>
  225. <if test="orderId != null">`order_id` = #{orderId},</if>
  226. <if test="userId != null">`user_id` = #{userId},</if>
  227. <if test="refundType != null">`refund_type` = #{refundType},</if>
  228. <if test="refundTime != null">`refund_time` = #{refundTime},</if>
  229. <if test="creator != null">`creator` = #{creator},</if>
  230. <if test="refundMoney != null">`refund_money` = #{refundMoney},</if>
  231. <if test="refundFeeType != null">`refund_fee_type` = #{refundFeeType}, </if>
  232. <if test="totalFee != null">`total_fee` = #{totalFee}, </if>
  233. <if test="feeType != null">`fee_type` = #{feeType}, </if>
  234. <if test="cashFee != null">`cash_fee` = #{cashFee}, </if>
  235. <if test="cashFeeType != null">`cash_fee_type` = #{cashFeeType}, </if>
  236. <if test="cashRefundFee != null">`cash_refund_fee` = #{cashRefundFee}, </if>
  237. <if test="cashRefundFeeType != null">`cash_refund_fee_type` = #{cashRefundFeeType}, </if>
  238. <if test="rate != null">`rate` = #{rate}, </if>
  239. <if test="refundStatus != null">`refund_status` = #{refundStatus},</if>
  240. <if test="wechatRefundStatusDes != null">`wechat_refund_status_des` = #{wechatRefundStatusDes},</if>
  241. <if test="approver != null">`approver` = #{approver},</if>
  242. <if test="approvalTime != null">`approval_time` = #{approvalTime},</if>
  243. <if test="approvalRemark != null">`approval_remark` = #{approvalRemark},</if>
  244. <if test="outRefundNo != null">`out_refund_no` = #{outRefundNo},</if>
  245. </set>
  246. where id = #{id}
  247. </update>
  248. <delete id="delete">
  249. delete from mall_order_refund where id = #{value}
  250. </delete>
  251. <delete id="deleteBatch">
  252. delete from mall_order_refund where id in
  253. <foreach item="id" collection="array" open="(" separator="," close=")">
  254. #{id}
  255. </foreach>
  256. </delete>
  257. <select id="queryObjectByOrderId" resultType="com.kmall.admin.entity.OrderRefundEntity">
  258. select * from mall_order_refund
  259. where order_id = #{orderId}
  260. </select>
  261. </mapper>