From 5d16a26a496323aa6d288362602513bbd0484012 Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Fri, 12 Sep 2025 15:08:01 +0800
Subject: [PATCH] 订单退单sql优化

---
 oying-system/src/main/resources/mapper/sh/OrderMapper.xml                                |    4 +++-
 oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml                          |    6 ++++--
 oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderReturnServiceImpl.java |    6 +++---
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderReturnServiceImpl.java b/oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderReturnServiceImpl.java
index 337325d..8ed6275 100644
--- a/oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderReturnServiceImpl.java
+++ b/oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderReturnServiceImpl.java
@@ -103,8 +103,8 @@
         // 退款订单号
         String returnNum = redisUtils.generateSn(ORDER_RETURN_KEY, GenerateEnum.ORDER_RETURN.getKey());
         returnOrder.setReturnNum(returnNum);
-        returnOrder.setReturnStatus(ReturnAuditEnum.ZERO.getKey());
-        returnOrder.setReturnStatusDescribe(ReturnAuditEnum.ZERO.getValue());
+        returnOrder.setReturnStatus(OrderStatusEnum.TEN.getKey());
+        returnOrder.setReturnStatusDescribe(OrderStatusEnum.TEN.getValue());
         returnOrder.setOrderNum(resources.getOrderNum());
         returnOrder.setOrderTime(order.getOrderTime());
         returnOrder.setOrderStoreNum(order.getOrderStoreNum());
@@ -138,7 +138,7 @@
             }
         }
         productSnapshotService.saveBatch(productSnapshots);
-        operationLogService.create(response, OrderStatusEnum.FIFTEEN, null);
+        operationLogService.create(response, OrderStatusEnum.TEN, null);
     }
 
     private static OrderReturnProductSnapshot getSnapshot(OrderProductSnapshot snapshot, String returnNum) {
diff --git a/oying-system/src/main/resources/mapper/sh/OrderMapper.xml b/oying-system/src/main/resources/mapper/sh/OrderMapper.xml
index 6417087..b390ff9 100644
--- a/oying-system/src/main/resources/mapper/sh/OrderMapper.xml
+++ b/oying-system/src/main/resources/mapper/sh/OrderMapper.xml
@@ -46,6 +46,8 @@
         <result column="rider_name" property="riderName"/>
         <collection property="productSnapshots" ofType="com.oying.modules.sh.domain.OrderProductSnapshot">
             <id column="snapshot_id" property="snapshotId"/>
+            <result column="order_num" property="orderNum"/>
+            <result column="store_id" property="storeId"/>
             <result column="product_id" property="productId"/>
             <result column="product_code" property="productCode"/>
             <result column="product_barcode" property="productBarcode"/>
@@ -74,7 +76,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.snapshot_id, p.order_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, p.pay_state
     </sql>
diff --git a/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml b/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml
index 2829091..b32d489 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">
@@ -161,7 +163,7 @@
         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

--
Gitblit v1.9.3