From 54e2adf7f701d99fcc83efcc18abbe8af93079ae Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Fri, 12 Sep 2025 15:21:35 +0800
Subject: [PATCH] 退单sql

---
 oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 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..33abf7c 100644
--- a/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml
+++ b/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml
@@ -41,6 +41,8 @@
         <result column="rider_name" property="riderName"/>
         <collection property="productSnapshots" ofType="com.oying.modules.sh.domain.OrderReturnProductSnapshot">
             <id column="snapshot_id" property="snapshotId"/>
+            <result column="return_num" property="returnNum"/>
+            <result column="store_id" property="storeId"/>
             <result column="product_id" property="productId"/>
             <result column="product_code" property="productCode"/>
             <result column="product_barcode" property="productBarcode"/>
@@ -67,7 +69,7 @@
     </sql>
 
     <sql id="Product_Column_List">
-        p.snapshot_id, p.product_id, p.product_code, p.product_barcode, p.product_name, p.product_title, p.product_main_image,
+        p.snapshot_id, p.return_num, p.store_id, p.product_id, p.product_code, p.product_barcode, p.product_name, p.product_title, p.product_main_image,
         p.product_description, p.param_data, p.unit_price, p.detail_count, p.original_price, p.paid_price, p.actually_pay_price
     </sql>
     <sql id="Where_sql">
@@ -132,9 +134,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,10 +160,10 @@
         ) 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
+        select o.*, from ( select
         <include refid="Base_Column_List"/>
         from sh_order_return as o ) o
         left join sh_order_return_product_snapshot as p on p.return_num = o.return_num
@@ -162,7 +171,7 @@
     </select>
     <select id="countAll" resultType="java.lang.Long">
         select count(1) from (
-        select distinct o.*
+        select distinct o.*,
         p.product_code, p.product_barcode, p.product_name, p.product_title, p.product_description
         from ( select
         <include refid="Base_Column_List"/>
@@ -173,4 +182,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