OrderRefundDao.xml 6.5 KB

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