From bb05129db40db646a59ddc90cb097edf063140c1 Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Thu, 28 Aug 2025 17:01:54 +0800
Subject: [PATCH] 订单-sql优化

---
 oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml b/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml
index 53e1556..2829091 100644
--- a/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml
+++ b/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml
@@ -9,6 +9,7 @@
         <result column="order_num" property="orderNum"/>
         <result column="order_store_num" property="orderStoreNum"/>
         <result column="order_time" property="orderTime"/>
+        <result column="packaging_price" property="packagingPrice"/>
         <result column="send_price" property="sendPrice"/>
         <result column="send_type" property="sendType"/>
         <result column="pay_type" property="payType"/>
@@ -58,7 +59,7 @@
 
     <sql id="Base_Column_List">
         o.return_id, o.return_num, o.return_status, o.return_status_describe, o.order_num, o.order_store_num,
-        o.order_time, o.send_price, o.send_type, o.pay_type, o.user_id, o.username, o.store_id, o.store_name, o.store_logo,
+        o.order_time, o.packaging_price, o.send_price, o.send_type, o.pay_type, o.user_id, o.username, o.store_id, o.store_name, o.store_logo,
         o.original_price order_original_price, o.paid_price order_paid_price, o.actually_pay_price order_actually_pay_price,
         o.refund_price, o.refund_status, o.success_time, o.channel, o.reason, o.remark, o.photos, o.audit_status,
         o.audit_user, o.audit_time, o.audit_message, o.rider_id, o.rider_phone, o.rider_name,
@@ -131,9 +132,16 @@
 
     <update id="updatePayStatus">
         update sh_order_return
-        set return_status = #{payState},
-            success_time  = #{payTime}
-        where order_num = #{orderNum}
+        set refund_status = #{refundStatus},
+            success_time  = #{successTime}
+        where return_num = #{returnNum}
+    </update>
+    <update id="updateStatus">
+        update sh_order_return
+        set return_status = #{returnStatus},
+            return_status_describe = #{value},
+            audit_status  = #{auditStatus}
+        where return_num = #{returnNum}
     </update>
 
     <select id="findAll" resultMap="BaseResultMap">
@@ -150,7 +158,7 @@
         ) o
         left join sh_order_return_product_snapshot as p on p.return_num = o.return_num
         <include refid="Where_Sql_Product"/>
-        order by o.order_id desc
+        order by o.return_id desc
     </select>
     <select id="getByReturnNum" resultMap="BaseResultMap">
         select o.* from ( select
@@ -172,4 +180,10 @@
         <include refid="Where_Sql_Product"/>
         ) t
     </select>
+    <select id="getByOrderNum" resultType="com.oying.modules.sh.domain.OrderReturn">
+        select
+        <include refid="Base_Column_List"/>
+        from sh_order_return as o
+        where o.order_num = #{orderNum} and o.audit_status = #{status}
+    </select>
 </mapper>

--
Gitblit v1.9.3