From 9b867103f0d53bf913bb4ea93687820d92ee0515 Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Thu, 14 Aug 2025 14:45:24 +0800
Subject: [PATCH] 退款订单
---
oying-system/src/main/resources/mapper/sh/OrderMapper.xml | 171 ++++++++++++++++++++++++++++++--------------------------
1 files changed, 92 insertions(+), 79 deletions(-)
diff --git a/oying-system/src/main/resources/mapper/sh/OrderMapper.xml b/oying-system/src/main/resources/mapper/sh/OrderMapper.xml
index bd2fb2c..6417087 100644
--- a/oying-system/src/main/resources/mapper/sh/OrderMapper.xml
+++ b/oying-system/src/main/resources/mapper/sh/OrderMapper.xml
@@ -4,20 +4,28 @@
<resultMap id="BaseResultMap" type="com.oying.modules.sh.domain.Order">
<id column="order_id" property="orderId"/>
<result column="order_num" property="orderNum"/>
+ <result column="order_store_num" property="orderStoreNum"/>
<result column="order_status" property="orderStatus"/>
<result column="order_status_describe" property="orderStatusDescribe"/>
<result column="order_remark" property="orderRemark"/>
<result column="order_time" property="orderTime"/>
+ <result column="order_finish_time" property="orderFinishTime"/>
+ <result column="packaging_price" property="packagingPrice"/>
+ <result column="send_price" property="sendPrice"/>
+ <result column="send_type" property="sendType"/>
<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="store_address" property="storeAddress"/>
+ <result column="store_longitude" property="storeLongitude"/>
+ <result column="store_latitude" property="storeLatitude"/>
<result column="order_describe" property="orderDescribe"/>
- <result column="original_price" property="originalPrice"/>
- <result column="paid_price" property="paidPrice"/>
- <result column="actually_pay_price" property="actuallyPayPrice"/>
- <result column="pay_state" property="payState"/>
+ <result column="order_original_price" property="originalPrice"/>
+ <result column="order_paid_price" property="paidPrice"/>
+ <result column="order_actually_pay_price" property="actuallyPayPrice"/>
+ <result column="order_pay_state" property="payState"/>
<result column="pay_message" property="payMessage"/>
<result column="pay_type" property="payType"/>
<result column="pay_time" property="payTime"/>
@@ -33,6 +41,9 @@
<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.OrderProductSnapshot">
<id column="snapshot_id" property="snapshotId"/>
<result column="product_id" property="productId"/>
@@ -53,10 +64,13 @@
</resultMap>
<sql id="Base_Column_List">
- o.order_id, o.order_num, o.order_status, o.order_status_describe, o.order_remark, o.order_time, o.user_id, o.username, o.store_id,
- o.store_name, o.store_logo, o.order_describe, o.original_price, o.paid_price, o.actually_pay_price, o.pay_state, o.pay_message,
- o.pay_type, o.pay_time, o.expire_time, o.openid, o.app_id, o.timestamp, o.nonce_str, o.package_val, o.sign_type, o.pay_sign,
- o.create_by, o.create_time, o.update_by, o.update_time
+ o.order_id, o.order_num, o.order_store_num, o.order_status, o.order_status_describe,
+ o.order_remark, o.order_time, o.order_finish_time, o.packaging_price, o.send_price, o.send_type, o.user_id, o.username, o.store_id,
+ o.store_name, o.store_logo, o.store_address, o.store_longitude, o.store_latitude,
+ o.order_describe, o.original_price order_original_price, o.paid_price order_paid_price,
+ o.actually_pay_price order_actually_pay_price, o.pay_state order_pay_state, o.pay_message, o.pay_type, o.pay_time, o.expire_time,
+ o.openid, o.app_id, o.timestamp, o.nonce_str, o.package_val, o.sign_type, o.pay_sign,
+ o.create_by, o.create_time, o.update_by, o.update_time, o.rider_id, o.rider_phone, o.rider_name
</sql>
<sql id="product_Column_List">
@@ -65,33 +79,16 @@
p.actually_pay_price, p.pay_state
</sql>
- <update id="updatePayStatus">
- update sh_order
- set pay_state = #{payState},
- pay_message = #{payMessage},
- pay_time = #{payTime}
- where order_num = #{orderNum}
- </update>
-
- <update id="updateCloseStatus">
- update sh_order
- set pay_state = #{payState}
- where order_num = #{orderNum}
- </update>
-
- <select id="findAll" resultMap="BaseResultMap">
- select o.*,
- <include refid="product_Column_List"/>
- from (
- select
- <include refid="Base_Column_List"/>
- from sh_order as o
+ <sql id="Where_Sql">
<where>
<if test="criteria.orderNum != null and criteria.orderNum != ''">
and o.order_num like concat('%',#{criteria.orderNum},'%')
</if>
- <if test="criteria.orderStatus != null and criteria.orderStatus != ''">
- and o.order_status = #{criteria.orderStatus}
+ <if test="criteria.orderStatus != null and criteria.orderStatus.size() > 0">
+ and o.order_status IN
+ <foreach collection="criteria.orderStatus" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
</if>
<if test="criteria.userId != null and criteria.userId != ''">
and o.user_id = #{criteria.userId}
@@ -118,27 +115,80 @@
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.orderNum like concat('%',#{blurry},'%')
+ or o.order_describe like concat('%',#{blurry},'%')
+ or o.username like concat('%',#{blurry},'%'))
+ </if>
+ </where>
+ </sql>
+
+ <update id="updatePayStatus">
+ update sh_order
+ set pay_state = #{payState},
+ pay_message = #{payMessage},
+ pay_time = #{payTime}
+ where order_num = #{orderNum}
+ </update>
+
+ <update id="updateCloseStatus">
+ update sh_order
+ set pay_state = #{payState},
+ pay_message = #{payMessage}
+ where order_num = #{orderNum}
+ </update>
+
+ <update id="updateOrderStatus">
+ update sh_order
+ set order_status = #{key},
+ order_status_describe = #{value}
+ where order_num = #{orderNum}
+ </update>
+ <update id="updateRider">
+ update sh_order
+ set rider_id = #{riderId},
+ rider_phone = #{phone},
+ rider_name = #{cardName}
+ where order_num = #{orderNum}
+ </update>
+
+ <select id="findAll" resultMap="BaseResultMap">
+ select o.*,
+ <include refid="product_Column_List"/>
+ from (
+ select
+ <include refid="Base_Column_List"/>
+ from sh_order as o
+ <include refid="Where_Sql"/>
order by o.order_id desc
<if test="criteria.offset != null">
limit #{criteria.offset}, #{criteria.size}
</if>
) o
left join sh_order_product_snapshot as p on p.order_num = o.order_num
- where 1=1
- <if test="criteria.blurry != null and criteria.blurry != ''">
- and (o.product_code like concat('%',#{criteria.blurry},'%')
- or o.product_barcode like concat('%',#{criteria.blurry},'%')
- or o.product_name like concat('%',#{criteria.blurry},'%')
- or o.product_title like concat('%',#{criteria.blurry},'%')
- or o.product_description like concat('%',#{criteria.blurry},'%'))
- </if>
+ <include refid="Where_Sql_Product"/>
order by o.order_id desc
</select>
<select id="getByOrderNum" resultMap="BaseResultMap">
+ select o.*,
+ <include refid="product_Column_List"/>
+ from (
select
<include refid="Base_Column_List"/>
from sh_order as o
+ ) o
+ left join sh_order_product_snapshot as p on p.order_num = o.order_num
where o.order_num = #{orderNum}
+ order by o.order_id desc
</select>
<select id="countAll" resultType="java.lang.Long">
select count(1)
@@ -152,47 +202,10 @@
select
<include refid="Base_Column_List"/>
from sh_order as o
- <where>
- <if test="criteria.orderNum != null and criteria.orderNum != ''">
- and o.order_num like concat('%',#{criteria.orderNum},'%')
- </if>
- <if test="criteria.orderStatus != null and criteria.orderStatus != ''">
- and o.order_status = #{criteria.orderStatus}
- </if>
- <if test="criteria.userId != null and criteria.userId != ''">
- and o.user_id = #{criteria.userId}
- </if>
- <if test="criteria.username != null and criteria.username != ''">
- and o.username like concat('%',#{criteria.username},'%')
- </if>
- <if test="criteria.storeId != null and criteria.storeId != ''">
- and o.store_id = #{criteria.storeId}
- </if>
- <if test="criteria.orderDescribe != null and criteria.orderDescribe != ''">
- and o.order_describe like concat('%',#{criteria.orderDescribe},'%')
- </if>
- <if test="criteria.payState != null and criteria.payState != ''">
- and o.pay_state = #{criteria.payState}
- </if>
- <if test="criteria.payType != null and criteria.payType != ''">
- and o.pay_type = #{criteria.payType}
- </if>
- <if test="criteria.payTime != null and criteria.payTime.size() > 0">
- AND o.pay_time BETWEEN #{criteria.payTime[0]} AND #{criteria.payTime[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>
+ <include refid="Where_Sql"/>
) o
left join sh_order_product_snapshot as p on p.order_num = o.order_num
- where 1=1
- <if test="criteria.blurry != null and criteria.blurry != ''">
- and (p.product_code like concat('%',#{criteria.blurry},'%')
- or p.product_barcode like concat('%',#{criteria.blurry},'%')
- or p.product_name like concat('%',#{criteria.blurry},'%')
- or p.product_title like concat('%',#{criteria.blurry},'%')
- or p.product_description like concat('%',#{criteria.blurry},'%'))
- </if>) t
+ <include refid="Where_Sql_Product"/>
+ ) t
</select>
</mapper>
--
Gitblit v1.9.3