From 8668e5ce64e1d7b3dbfffc42cf6767cb9ea2d6c0 Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期二, 25 六月 2024 09:54:15 +0800
Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/ERP_override

---
 north-glass-erp/src/main/resources/mapper/sd/CustomerMapper.xml |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/sd/CustomerMapper.xml b/north-glass-erp/src/main/resources/mapper/sd/CustomerMapper.xml
index aa4a38d..a947688 100644
--- a/north-glass-erp/src/main/resources/mapper/sd/CustomerMapper.xml
+++ b/north-glass-erp/src/main/resources/mapper/sd/CustomerMapper.xml
@@ -161,9 +161,30 @@
 
     <select id="getCustomerList">
         select
-            *
+            a.*,
+            b.project,
+            b.salesman_id,
+            b.salesman
         from
-            sd.customer
+            sd.customer as a
+        left join (SELECT
+                       t.*
+                   FROM
+                       (
+                           SELECT
+                               ROW_NUMBER() over ( PARTITION BY o.customer_id ORDER BY o.id DESC ) AS rn,
+                               o.id,
+                               o.project,
+                               o.salesman_id,
+                               o.salesman,
+                               o.customer_id
+                           FROM
+                               sd.ORDER AS o
+                       ) t
+                   WHERE
+                       rn = 1) as b
+        on a.id = b.customer_id
+
     </select>
     <select id="getSelectCustomer">
         select

--
Gitblit v1.8.0