From 121fa31482f4f43716b80541db6d849258fed67a Mon Sep 17 00:00:00 2001
From: fengyuan_yang <1976974459@qq.com>
Date: Mon, 22 Dec 2025 17:27:46 +0800
Subject: [PATCH] =?UTF-8?q?2025-12-22=20=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../OutboundNotificationHeadMapper.xml | 31 ++++++++++++-------
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/src/main/resources/mapper/outboundNotification/OutboundNotificationHeadMapper.xml b/src/main/resources/mapper/outboundNotification/OutboundNotificationHeadMapper.xml
index 23654e6..bd15845 100644
--- a/src/main/resources/mapper/outboundNotification/OutboundNotificationHeadMapper.xml
+++ b/src/main/resources/mapper/outboundNotification/OutboundNotificationHeadMapper.xml
@@ -8,12 +8,16 @@
SELECT
a.site,
a.bu_no,
- dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
+ dbo.get_bu_desc(a.site, a.bu_no) AS buDesc,
a.order_no,
a.order_type,
a.order_status,
- a.customer_id,
- b.customerName,
+ COALESCE(NULLIF(LTRIM(RTRIM(a.customer_id)), ''), s.SupplierID) AS customer_id,
+ COALESCE(
+ NULLIF(LTRIM(RTRIM(b.customerName)), ''),
+ NULLIF(LTRIM(RTRIM(s.SupplierName)), ''),
+ ''
+ ) AS customerName,
a.related_order_no,
a.related_order_line_no,
a.required_outbound_date,
@@ -41,19 +45,20 @@
a.out_warehouse,
a.customer_order_no,
a.show_in_query_flag
- FROM outbound_notification_head as a
- left join Customer as b on a.site = b.site and a.customer_id = b.CustomerID
+ FROM outbound_notification_head AS a
+ LEFT JOIN Customer AS b ON a.site = b.site AND LTRIM(RTRIM(a.customer_id)) = b.CustomerID
+ LEFT JOIN Supplier AS s ON a.site = s.site AND (NULLIF(LTRIM(RTRIM(a.customer_id)), '') IS NULL OR b.CustomerID IS NULL) AND LTRIM(RTRIM(a.customer_id)) = s.SupplierID
- a.site in (select site from AccessSite where userID = #{query.userName})
- and a.bu_no in (select bu_no from AccessBu where username = #{query.userName})
+ a.site IN (SELECT site FROM AccessSite WHERE userID = #{query.userName})
+ AND a.bu_no IN (SELECT bu_no FROM AccessBu WHERE username = #{query.userName})
- AND a.order_no like '%' + #{query.orderNo} + '%'
+ AND a.order_no LIKE '%' + #{query.orderNo} + '%'
AND a.order_type = #{query.orderType}
- AND a.order_status in
+ AND a.order_status IN
#{item}
@@ -65,12 +70,16 @@
AND #{query.endDate} >= a.required_outbound_date
- AND a.customer_id like '%' + #{query.customerId} + '%'
+ AND a.customer_id LIKE '%' + #{query.customerId} + '%'
- AND b.customerName like '%' + #{query.customerName} + '%'
+ AND (
+ b.customerName LIKE '%' + #{query.customerName} + '%'
+ OR s.SupplierName LIKE '%' + #{query.customerName} + '%'
+ )
+ ORDER BY a.created_date DESC;