1
0

OrderRefundDao.xml 6.5 KB

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