From 39b565ab0ea5e98a2bb0eb5c78b3c23247dbc2fe Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期一, 01 七月 2024 15:22:10 +0800
Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/ERP_override

---
 north-glass-erp/src/main/resources/mapper/sd/CustomerMapper.xml |   34 +++++++++++++++++++++++++++++-----
 1 files changed, 29 insertions(+), 5 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..e988c89 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
@@ -176,6 +197,9 @@
             </if>
             <if test="customer.customerName != null and customer.customerName != ''">
                 and c.customer_name regexp #{customer.customerName}
+            </if>
+            <if test="customer.customerAbbreviation != null and customer.customerAbbreviation != ''">
+                and c.customer_abbreviation regexp #{customer.customerAbbreviation}
             </if>
             <if test="customer.grade != null and customer.grade != ''">
                 and c.grade regexp #{customer.grade}
@@ -231,15 +255,15 @@
     </select>
 
     <insert id="insertCustomer"  useGeneratedKeys="true" >
-        insert into sd.customer(customer_name,grade,money_limit,address,contact,phone)
+        insert into sd.customer(customer_name,customer_abbreviation,grade,money_limit,address,contact,phone)
         values (
-                   #{customer.customerName},#{customer.grade},#{customer.moneyLimit},
+                   #{customer.customerName},#{customer.customerAbbreviation},#{customer.grade},#{customer.moneyLimit},
                 #{customer.address},#{customer.contact},#{customer.phone}
                )
     </insert>
 
     <update id="updateCustomer"  useGeneratedKeys="true" >
-        update sd.customer set customer_name=#{customer.customerName},grade=#{customer.grade},
+        update sd.customer set customer_name=#{customer.customerName},customer_abbreviation=#{customer.customerAbbreviation},grade=#{customer.grade},
                                     money_limit=#{customer.moneyLimit},address= #{customer.address},
                                     contact=#{customer.contact},phone=#{customer.phone} where id=#{customer.id}
     </update>

--
Gitblit v1.8.0