From fc1a066edd335345167df7573f9119ef8dd1689a Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Thu, 10 Jul 2025 17:36:47 +0800
Subject: [PATCH] 小程序:微信授权登录角色处理

---
 oying-system/src/main/resources/mapper/sh/OrderMapper.xml |   35 +++++++++++++++++++++++++++--------
 1 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/oying-system/src/main/resources/mapper/sh/OrderMapper.xml b/oying-system/src/main/resources/mapper/sh/OrderMapper.xml
index 6a09cbc..7162d03 100644
--- a/oying-system/src/main/resources/mapper/sh/OrderMapper.xml
+++ b/oying-system/src/main/resources/mapper/sh/OrderMapper.xml
@@ -7,6 +7,7 @@
         <result column="order_status" property="orderStatus"/>
         <result column="order_status_describe" property="orderStatusDescribe"/>
         <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"/>
@@ -33,33 +34,45 @@
     </resultMap>
 
     <sql id="Base_Column_List">
-        order_id, order_num, order_status, order_status_describe, user_id, store_id, store_name, store_logo, order_describe, original_price, paid_price, actually_pay_price, pay_state, pay_message, pay_type, pay_time, expire_time, openid, app_id, timestamp, nonce_str, package_val, sign_type, pay_sign, create_by, create_time, update_by, update_time
+        order_id, order_num, order_status, order_status_describe, user_id, username, store_id, store_name, store_logo, order_describe, original_price, paid_price, actually_pay_price, pay_state, pay_message, pay_type, pay_time, expire_time, openid, app_id, timestamp, nonce_str, package_val, sign_type, pay_sign, create_by, create_time, update_by, update_time
     </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
         <include refid="Base_Column_List"/>
         from sh_order
         <where>
-            <if test="criteria.orderNum != null">
+            <if test="criteria.orderNum != null and criteria.orderNum != ''">
                 and order_num like concat('%',#{criteria.orderNum},'%')
             </if>
-            <if test="criteria.orderStatus != null">
+            <if test="criteria.orderStatus != null and criteria.orderStatus != ''">
                 and order_status = #{criteria.orderStatus}
             </if>
-            <if test="criteria.userId != null">
+            <if test="criteria.userId != null and criteria.userId != ''">
                 and user_id = #{criteria.userId}
             </if>
-            <if test="criteria.storeId != null">
+            <if test="criteria.username != null and criteria.username != ''">
+                and username like concat('%',#{criteria.username},'%')
+            </if>
+            <if test="criteria.storeId != null and criteria.storeId != ''">
                 and store_id = #{criteria.storeId}
             </if>
-            <if test="criteria.orderDescribe != null">
+            <if test="criteria.orderDescribe != null and criteria.orderDescribe != ''">
                 and order_describe like concat('%',#{criteria.orderDescribe},'%')
             </if>
-            <if test="criteria.payState != null">
+            <if test="criteria.payState != null and criteria.payState != ''">
                 and pay_state = #{criteria.payState}
             </if>
-            <if test="criteria.payType != null">
+            <if test="criteria.payType != null and criteria.payType != ''">
                 and pay_type = #{criteria.payType}
             </if>
             <if test="criteria.payTime != null and criteria.payTime.size() > 0">
@@ -71,4 +84,10 @@
         </where>
         order by order_id desc
     </select>
+    <select id="getByOrderNum" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from sh_order
+        where order_num = #{orderNum}
+    </select>
 </mapper>

--
Gitblit v1.9.3