1
0

OrderRefundDao.xml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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="refundType" column="refund_type"/>
  9. <result property="refundTime" column="refund_time"/>
  10. <result property="creator" column="creator"/>
  11. <result property="refundMoney" column="refund_money"/>
  12. <result property="refundReason" column="refund_reason"/>
  13. <result property="refundStatus" column="refund_status"/>
  14. <result property="wechatRefundStatusDes" column="wechat_refund_status_des"/>
  15. <result property="approver" column="approver"/>
  16. <result property="approvalTime" column="approval_time"/>
  17. <result property="approvalRemark" column="approval_remark"/>
  18. <result property="orderSn" column="order_sn"/>
  19. <result property="orderStatus" column="order_status"/>
  20. <result property="actualPrice" column="actual_price"/>
  21. <result property="userName" column="username"/>
  22. </resultMap>
  23. <select id="queryObject" resultType="com.kmall.admin.entity.OrderRefundEntity">
  24. SELECT
  25. r.id,
  26. r.order_id,
  27. r.user_id,
  28. r.out_refund_no,
  29. r.refund_id,
  30. r.refund_type,
  31. r.refund_time,
  32. r.creator,
  33. r.refund_money,
  34. r.refund_status,
  35. r.refund_reason,
  36. r.wechat_refund_status_des,
  37. r.refund_recv_accout,
  38. r.approval_time,
  39. r.approval_remark,
  40. r.create_time,
  41. o.order_sn,
  42. o.order_status,
  43. o.actual_price,
  44. o.order_price,
  45. o.goods_price,
  46. o.add_time,
  47. u.username AS username,
  48. s.username AS approver
  49. FROM mall_order_refund r
  50. LEFT JOIN mall_order o ON r.order_id = o.id
  51. LEFT JOIN mall_user u ON o.user_id = u.id
  52. LEFT JOIN sys_user s ON s.user_id = r.approver
  53. where r.id = #{id}
  54. </select>
  55. <select id="queryList" resultType="com.kmall.admin.entity.OrderRefundEntity">
  56. select
  57. r.*,
  58. o.order_sn,
  59. o.order_status,
  60. o.actual_price,
  61. o.order_price,
  62. o.goods_price,
  63. o.add_time,
  64. u.username as username
  65. from mall_order_refund r
  66. left join mall_order o on r.order_id = o.id
  67. left join mall_user u on o.user_id = u.id
  68. WHERE 1=1
  69. <if test="orderSn != null and orderSn.trim() != ''">
  70. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  71. </if>
  72. <if test="userName != null and userName.trim() != ''">
  73. AND u.username LIKE concat('%',#{userName},'%')
  74. </if>
  75. <if test="orderId != null">
  76. AND o.id = #{orderId}
  77. </if>
  78. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  79. AND o.shipping_status = #{shippingStatus}
  80. </if>
  81. <if test="payStatus != null and payStatus.trim() != ''">
  82. AND o.pay_status = #{payStatus}
  83. </if>
  84. <if test="orderStatus != null and orderStatus.trim() != ''">
  85. AND o.order_status = #{orderStatus}
  86. </if>
  87. <if test="noCancelStatus != null and noCancelStatus == 'true'">
  88. AND o.order_status != 101
  89. </if>
  90. <if test="refundStatus != null">
  91. AND r.refund_status = #{refundStatus}
  92. </if>
  93. <if test="orderType != null and orderType.trim() != ''">
  94. AND o.order_type = #{orderType}
  95. </if>
  96. <choose>
  97. <when test="sidx != null and sidx.trim() != ''">
  98. order by ${sidx} ${order}
  99. </when>
  100. <otherwise>
  101. order by r.id desc
  102. </otherwise>
  103. </choose>
  104. <if test="offset != null and limit != null">
  105. limit #{offset}, #{limit}
  106. </if>
  107. </select>
  108. <select id="queryTotal" resultType="int">
  109. select count(r.id)
  110. from mall_order_refund r
  111. left join mall_order o on r.order_id = o.id
  112. left join mall_user u on o.user_id = u.id
  113. WHERE 1=1
  114. <if test="orderSn != null and orderSn.trim() != ''">
  115. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  116. </if>
  117. <if test="orderId != null">
  118. AND o.id = #{orderId}
  119. </if>
  120. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  121. AND o.shipping_status = #{shippingStatus}
  122. </if>
  123. <if test="payStatus != null and payStatus.trim() != ''">
  124. AND o.pay_status = #{payStatus}
  125. </if>
  126. <if test="orderStatus != null and orderStatus.trim() != ''">
  127. AND o.order_status = #{orderStatus}
  128. </if>
  129. <if test="noCancelStatus != null and noCancelStatus == 'true'">
  130. AND o.order_status != 101
  131. </if>
  132. <if test="refundStatus != null">
  133. AND r.refund_status = #{refundStatus}
  134. </if>
  135. <if test="orderType != null and orderType.trim() != ''">
  136. AND o.order_type = #{orderType}
  137. </if>
  138. </select>
  139. <insert id="save" parameterType="com.kmall.admin.entity.OrderRefundEntity" useGeneratedKeys="true" keyProperty="id">
  140. insert into mall_order_refund(
  141. `order_id`,
  142. `user_id`,
  143. `refund_type`,
  144. `refund_time`,
  145. `creator`,
  146. `refund_money`,
  147. `refund_status`,
  148. `wechat_refund_status_des`,
  149. `approver`,
  150. `approval_time`,
  151. `approval_remark`)
  152. values(
  153. #{orderId},
  154. #{userId},
  155. #{refundType},
  156. #{refundTime},
  157. #{creator},
  158. #{refundMoney},
  159. #{refundStatus},
  160. #{wechatRefundStatusDes},
  161. #{approver},
  162. #{approvalTime},
  163. #{approvalRemark})
  164. </insert>
  165. <update id="update" parameterType="com.kmall.admin.entity.OrderRefundEntity">
  166. update mall_order_refund
  167. <set>
  168. <if test="orderId != null">`order_id` = #{orderId},</if>
  169. <if test="userId != null">`user_id` = #{userId},</if>
  170. <if test="refundType != null">`refund_type` = #{refundType},</if>
  171. <if test="refundTime != null">`refund_time` = #{refundTime},</if>
  172. <if test="creator != null">`creator` = #{creator},</if>
  173. <if test="refundMoney != null">`refund_money` = #{refundMoney},</if>
  174. <if test="refundStatus != null">`refund_status` = #{refundStatus},</if>
  175. <if test="wechatRefundStatusDes != null">`wechat_refund_status_des` = #{wechatRefundStatusDes},</if>
  176. <if test="approver != null">`approver` = #{approver},</if>
  177. <if test="approvalTime != null">`approval_time` = #{approvalTime},</if>
  178. <if test="approvalRemark != null">`approval_remark` = #{approvalRemark},</if>
  179. </set>
  180. where id = #{id}
  181. </update>
  182. <delete id="delete">
  183. delete from mall_order_refund where id = #{value}
  184. </delete>
  185. <delete id="deleteBatch">
  186. delete from mall_order_refund where id in
  187. <foreach item="id" collection="array" open="(" separator="," close=")">
  188. #{id}
  189. </foreach>
  190. </delete>
  191. <select id="queryObjectByOrderId" resultType="com.kmall.admin.entity.OrderRefundEntity">
  192. select * from mall_order_refund
  193. where order_id = #{orderId}
  194. </select>
  195. </mapper>