From 1cda9be49d77c83bdab4cfea7e3558fd4064bdb1 Mon Sep 17 00:00:00 2001
From: seatonwan9
Date: 星期四, 28 八月 2025 02:03:11 +0800
Subject: [PATCH] 更新代码

---
 src/main/resources/mapper/OrderInfoMapper.xml |  135 +++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 130 insertions(+), 5 deletions(-)

diff --git a/src/main/resources/mapper/OrderInfoMapper.xml b/src/main/resources/mapper/OrderInfoMapper.xml
index 0d38b6a..d65043b 100644
--- a/src/main/resources/mapper/OrderInfoMapper.xml
+++ b/src/main/resources/mapper/OrderInfoMapper.xml
@@ -37,12 +37,12 @@
     <select id="selectBuyerOrderPage" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM order_info
+        FROM tb_order_info
         WHERE deleted = 0
         <if test="userId != null">
             AND user_id = #{userId}
         </if>
-        <if test="unitId != null">
+        <if test="unitId != null and unitId != ''">
             AND unit_id = #{unitId}
         </if>
         <if test="orderStatus != null and orderStatus != ''">
@@ -98,9 +98,9 @@
     <select id="selectSellerOrderPage" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM order_info
+        FROM tb_order_info
         WHERE deleted = 0
-        <if test="providerId != null">
+        <if test="providerId != null and providerId != ''">
             AND provider_id = #{providerId}
         </if>
         <if test="orderStatus != null and orderStatus != ''">
@@ -150,7 +150,7 @@
     <select id="selectPendingApprovalOrderPage" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM order_info
+        FROM tb_order_info
         WHERE deleted = 0
         AND order_status IN ('寰呬笂浼犳枃浠�', '寰呮巿鏉�', '寰呬氦鏄撶‘璁�', '宸插畬鎴�', '宸茶瘎浠�')
         <if test="orderStatus != null and orderStatus != ''">
@@ -190,4 +190,129 @@
         </choose>
     </select>
 
+    <!-- 鍒嗛〉鏌ヨ涔板璁㈠崟鍒楄〃锛堟敮鎸佷骇鍝佹潯浠讹級 -->
+    <select id="selectBuyerOrderPageWithProductConditions" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM tb_order_info
+        WHERE deleted = 0
+        <if test="userId != null">
+            AND user_id = #{userId}
+        </if>
+        <if test="unitId != null and unitId != ''">
+            AND unit_id = #{unitId}
+        </if>
+        <if test="orderStatus != null and orderStatus != ''">
+            AND order_status = #{orderStatus}
+        </if>
+        <if test="paymentStatus != null and paymentStatus != ''">
+            AND payment_status = #{paymentStatus}
+        </if>
+        <if test="paymentType != null and paymentType != ''">
+            AND payment_type = #{paymentType}
+        </if>
+        <if test="productName != null and productName != ''">
+            AND product_name LIKE CONCAT('%', #{productName}, '%')
+        </if>
+        <if test="providerName != null and providerName != ''">
+            AND provider_name LIKE CONCAT('%', #{providerName}, '%')
+        </if>
+        <if test="orderId != null and orderId != ''">
+            AND order_id LIKE CONCAT('%', #{orderId}, '%')
+        </if>
+        <if test="applyTimeStart != null and applyTimeStart != ''">
+            AND apply_time >= #{applyTimeStart}::timestamp
+        </if>
+        <if test="applyTimeEnd != null and applyTimeEnd != ''">
+            AND apply_time &lt;= #{applyTimeEnd}::timestamp
+        </if>
+        <if test="createTimeStart != null and createTimeStart != ''">
+            AND created_at >= #{createTimeStart}::timestamp
+        </if>
+        <if test="createTimeEnd != null and createTimeEnd != ''">
+            AND created_at &lt;= #{createTimeEnd}::timestamp
+        </if>
+        <if test="productIds != null and productIds.size() > 0">
+            AND product_id IN
+            <foreach collection="productIds" item="productId" open="(" separator="," close=")">
+                #{productId}
+            </foreach>
+        </if>
+        ORDER BY
+        <choose>
+            <when test="orderBy != null and orderBy != ''">
+                ${orderBy}
+            </when>
+            <otherwise>
+                created_at
+            </otherwise>
+        </choose>
+        <choose>
+            <when test="orderDirection != null and orderDirection == 'asc'">
+                ASC
+            </when>
+            <otherwise>
+                DESC
+            </otherwise>
+        </choose>
+    </select>
+
+    <!-- 鍒嗛〉鏌ヨ鍗栧璁㈠崟鍒楄〃锛堟敮鎸佷骇鍝佹潯浠讹級 -->
+    <select id="selectSellerOrderPageWithProductConditions" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM tb_order_info
+        WHERE deleted = 0
+        <if test="providerId != null and providerId != ''">
+            AND provider_id = #{providerId}
+        </if>
+        <if test="orderStatus != null and orderStatus != ''">
+            AND order_status = #{orderStatus}
+        </if>
+        <if test="paymentStatus != null and paymentStatus != ''">
+            AND payment_status = #{paymentStatus}
+        </if>
+        <if test="productName != null and productName != ''">
+            AND product_name LIKE CONCAT('%', #{productName}, '%')
+        </if>
+        <if test="orderId != null and orderId != ''">
+            AND order_id LIKE CONCAT('%', #{orderId}, '%')
+        </if>
+        <if test="applyTimeStart != null and applyTimeStart != ''">
+            AND apply_time >= #{applyTimeStart}::timestamp
+        </if>
+        <if test="applyTimeEnd != null and applyTimeEnd != ''">
+            AND apply_time &lt;= #{applyTimeEnd}::timestamp
+        </if>
+        <if test="createTimeStart != null and createTimeStart != ''">
+            AND created_at >= #{createTimeStart}::timestamp
+        </if>
+        <if test="createTimeEnd != null and createTimeEnd != ''">
+            AND created_at &lt;= #{createTimeEnd}::timestamp
+        </if>
+        <if test="productIds != null and productIds.size() > 0">
+            AND product_id IN
+            <foreach collection="productIds" item="productId" open="(" separator="," close=")">
+                #{productId}
+            </foreach>
+        </if>
+        ORDER BY
+        <choose>
+            <when test="orderBy != null and orderBy != ''">
+                ${orderBy}
+            </when>
+            <otherwise>
+                created_at
+            </otherwise>
+        </choose>
+        <choose>
+            <when test="orderDirection != null and orderDirection == 'asc'">
+                ASC
+            </when>
+            <otherwise>
+                DESC
+            </otherwise>
+        </choose>
+    </select>
+
 </mapper>

--
Gitblit v1.8.0