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 |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml b/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml
index 26c2cf1..2829091 100644
--- a/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml
+++ b/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml
@@ -132,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">
@@ -151,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
@@ -173,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