From 6db03250bcbf51193b8dd71a698ea2b202c6d6ad Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期五, 26 十二月 2025 15:59:20 +0800
Subject: [PATCH] 班组产量汇总报表,客户名称不能重复创建显示

---
 north-glass-erp/src/main/java/com/example/erp/service/sd/CustomerService.java |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/north-glass-erp/src/main/java/com/example/erp/service/sd/CustomerService.java b/north-glass-erp/src/main/java/com/example/erp/service/sd/CustomerService.java
index 6589b2a..e751c03 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/sd/CustomerService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/sd/CustomerService.java
@@ -55,14 +55,19 @@
         try {
             Customer customer = JSONObject.parseObject(JSONObject.toJSONString(object.get("customer")), Customer.class);
            if(customer!=null){
-               if (customer.getId()!=null && customer.getId()!=0){
-                   customerMapper.updateCustomer(customer);
-                   log.setFunction("insertCustomer淇敼");
-               }else{
-                   customerMapper.insertCustomer(customer);
-                   log.setFunction("insertCustomer鏂板");
+               Integer count = customerMapper.countByCustomerName(customer);
+               if (count > 0) {
+                   saveState = false;
+               }else {
+                   if (customer.getId()!=null && customer.getId()!=0){
+                       customerMapper.updateCustomer(customer);
+                       log.setFunction("insertCustomer淇敼");
+                   }else{
+                       customerMapper.insertCustomer(customer);
+                       log.setFunction("insertCustomer鏂板");
+                   }
+                   logService.saveLog(log);
                }
-               logService.saveLog(log);
            }
         } catch (Exception e) {
             TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);

--
Gitblit v1.8.0