From 4548c5045b3a5522ad14df7c939f0303c1e17587 Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Sat, 11 Oct 2025 19:07:29 +0800
Subject: [PATCH] ้
้่ดน
---
oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml | 193 ++++++++++++++++++++++++++++++++++++------------
1 files changed, 145 insertions(+), 48 deletions(-)
diff --git a/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml b/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml
index 4b091cd..b5bb2f5 100644
--- a/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml
+++ b/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml
@@ -7,15 +7,20 @@
<result column="return_status" property="returnStatus"/>
<result column="return_status_describe" property="returnStatusDescribe"/>
<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"/>
<result column="user_id" property="userId"/>
<result column="username" property="username"/>
<result column="store_id" property="storeId"/>
<result column="store_name" property="storeName"/>
<result column="store_logo" property="storeLogo"/>
- <result column="original_price" property="originalPrice"/>
- <result column="paid_price" property="paidPrice"/>
- <result column="actually_pay_price" property="actuallyPayPrice"/>
+ <result column="order_original_price" property="originalPrice"/>
+ <result column="order_paid_price" property="paidPrice"/>
+ <result column="order_actually_pay_price" property="actuallyPayPrice"/>
<result column="refund_price" property="refundPrice"/>
<result column="refund_status" property="refundStatus"/>
<result column="success_time" property="successTime"/>
@@ -31,63 +36,155 @@
<result column="create_time" property="createTime"/>
<result column="update_by" property="updateBy"/>
<result column="update_time" property="updateTime"/>
+ <result column="rider_id" property="riderId"/>
+ <result column="rider_phone" property="riderPhone"/>
+ <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"/>
+ <result column="product_name" property="productName"/>
+ <result column="product_title" property="productTitle"/>
+ <result column="product_main_image" property="productMainImage"/>
+ <result column="product_description" property="productDescription"/>
+ <result column="param_data" property="paramData"/>
+ <result column="unit_price" property="unitPrice"/>
+ <result column="detail_count" property="detailCount"/>
+ <result column="original_price" property="originalPrice"/>
+ <result column="paid_price" property="paidPrice"/>
+ <result column="actually_pay_price" property="actuallyPayPrice"/>
+ </collection>
</resultMap>
<sql id="Base_Column_List">
- return_id, return_num, return_status, return_status_describe, order_num, pay_type, user_id, username, store_id, store_name, store_logo, original_price, paid_price, actually_pay_price, refund_price, refund_status, success_time, channel, reason, remark, photos, audit_status, audit_user, audit_time, audit_message, create_by, create_time, update_by, update_time
+ o.return_id, o.return_num, o.return_status, o.return_status_describe, o.order_num, o.order_store_num,
+ 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,
+ o.create_by, o.create_time, o.update_by, o.update_time
</sql>
+
+ <sql id="Product_Column_List">
+ 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">
+ <where>
+ <if test="criteria.returnNum != null">
+ and o.return_num like concat('%',#{criteria.returnNum},'%')
+ </if>
+ <if test="criteria.returnStatus != null and criteria.returnStatus.size() > 0">
+ and o.return_status IN
+ <foreach collection="criteria.returnStatus" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ </if>
+ <if test="criteria.orderNum != null">
+ and o.order_num like concat('%',#{criteria.orderNum},'%')
+ </if>
+ <if test="criteria.payType != null">
+ and o.pay_type = #{criteria.payType}
+ </if>
+ <if test="criteria.userId != null">
+ and o.user_id = #{criteria.userId}
+ </if>
+ <if test="criteria.username != null">
+ and o.username like concat('%',#{criteria.username},'%')
+ </if>
+ <if test="criteria.storeId != null">
+ and o.store_id = #{criteria.storeId}
+ </if>
+ <if test="criteria.refundStatus != null">
+ and o.refund_status = #{criteria.refundStatus}
+ </if>
+ <if test="criteria.auditUser != null">
+ and o.audit_user like concat('%',#{criteria.auditUser},'%')
+ </if>
+ <if test="criteria.successTime != null and criteria.successTime.size() > 0">
+ AND o.success_time BETWEEN #{criteria.successTime[0]} AND #{criteria.successTime[1]}
+ </if>
+ <if test="criteria.auditTime != null and criteria.auditTime.size() > 0">
+ AND o.audit_time BETWEEN #{criteria.auditTime[0]} AND #{criteria.auditTime[1]}
+ </if>
+ <if test="criteria.createTime != null and criteria.createTime.size() > 0">
+ AND o.create_time BETWEEN #{criteria.createTime[0]} AND #{criteria.createTime[1]}
+ </if>
+ </where>
+ </sql>
+
+ <sql id="Where_Sql_Product">
+ <where>
+ <if test="blurry != null and blurry != ''">
+ and (p.product_code like concat('%',#{blurry},'%')
+ or p.product_barcode like concat('%',#{blurry},'%')
+ or p.product_name like concat('%',#{blurry},'%')
+ or p.product_title like concat('%',#{blurry},'%')
+ or p.product_description like concat('%',#{blurry},'%')
+ or o.return_num like concat('%',#{blurry},'%')
+ or o.username like concat('%',#{blurry},'%')
+ or o.order_num like concat('%',#{blurry},'%'))
+ </if>
+ </where>
+ </sql>
+
<update id="updatePayStatus">
- update sh_order_return set return_status = #{payState}, success_time = #{payTime}
- where order_num = #{orderNum}
+ update sh_order_return
+ 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">
- select
+ select o.* ,
+ <include refid="Product_Column_List"/>
+ from ( select
<include refid="Base_Column_List"/>
- from sh_order_return
- <where>
- <if test="criteria.returnNum != null">
- and return_num like concat('%',#{criteria.returnNum},'%')
- </if>
- <if test="criteria.returnStatus != null">
- and return_status = #{criteria.returnStatus}
- </if>
- <if test="criteria.orderNum != null">
- and order_num like concat('%',#{criteria.orderNum},'%')
- </if>
- <if test="criteria.payType != null">
- and pay_type = #{criteria.payType}
- </if>
- <if test="criteria.userId != null">
- and user_id = #{criteria.userId}
- </if>
- <if test="criteria.username != null">
- and username like concat('%',#{criteria.username},'%')
- </if>
- <if test="criteria.storeId != null">
- and store_id = #{criteria.storeId}
- </if>
- <if test="criteria.refundStatus != null">
- and refund_status = #{criteria.refundStatus}
- </if>
- <if test="criteria.auditUser != null">
- and audit_user like concat('%',#{criteria.auditUser},'%')
- </if>
- <if test="criteria.successTime != null and criteria.successTime.size() > 0">
- AND success_time BETWEEN #{criteria.successTime[0]} AND #{criteria.successTime[1]}
- </if>
- <if test="criteria.auditTime != null and criteria.auditTime.size() > 0">
- AND audit_time BETWEEN #{criteria.auditTime[0]} AND #{criteria.auditTime[1]}
- </if>
- <if test="criteria.createTime != null and criteria.createTime.size() > 0">
- AND create_time BETWEEN #{criteria.createTime[0]} AND #{criteria.createTime[1]}
- </if>
- </where>
- order by return_id desc
+ from sh_order_return as o
+ <include refid="Where_sql"/>
+ order by o.return_id desc
+ <if test="criteria.offset != null">
+ limit #{criteria.offset}, #{criteria.size}
+ </if>
+ ) 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.return_id desc
</select>
<select id="getByReturnNum" resultMap="BaseResultMap">
+ 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
+ from sh_order_return as o where o.return_num = #{returnNum}
+ </select>
+ <select id="countAll" resultType="java.lang.Long">
+ select count(1) from (
+ 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"/>
+ from sh_order_return as o
+ <include refid="Where_sql"/>
+ ) o
+ left join sh_order_return_product_snapshot as p on p.return_num = o.return_num
+ <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 where return_num = #{returnNum}
+ from sh_order_return as o
+ where o.order_num = #{orderNum} and o.audit_status = #{status}
</select>
</mapper>
--
Gitblit v1.9.3