From 7bcc08ff0e10eb60593260758088d96e36346403 Mon Sep 17 00:00:00 2001 From: "UNISINSIGHT\\rdpnr_jiangpeng" Date: Tue, 17 Mar 2026 16:08:54 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E5=AE=A2=E6=88=B7=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E9=87=8D=E5=90=8D=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/sip/mapper/CustomerInfoMapper.java | 5 +++++ .../sip/service/impl/CustomerInfoServiceImpl.java | 13 ++++++++++++- .../resources/mapper/manage/CustomerInfoMapper.xml | 8 ++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/CustomerInfoMapper.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/CustomerInfoMapper.java index 24b986c3..2f32b5d8 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/CustomerInfoMapper.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/CustomerInfoMapper.java @@ -1,6 +1,7 @@ package com.ruoyi.sip.mapper; import com.ruoyi.sip.domain.CustomerInfo; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -63,4 +64,8 @@ public interface CustomerInfoMapper public int selectCountByCode(CustomerInfo customerInfo); int selectMaxByPrefix(String province); + + int selectCountByName(@Param("name") String name, + @Param("excludeId") Long excludeId); + } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/CustomerInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/CustomerInfoServiceImpl.java index 2b1dd790..f0621290 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/CustomerInfoServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/CustomerInfoServiceImpl.java @@ -79,6 +79,10 @@ public class CustomerInfoServiceImpl implements ICustomerInfoService if (i > 0) { throw new ServiceException("客户编码已存在"); } + i = customerInfoMapper.selectCountByName(customerInfo.getCustomerName(), null); + if (i > 0) { + throw new ServiceException("最终客户名称已存在"); + } return customerInfoMapper.insertCustomerInfo(customerInfo); } finally { lock.unlock(); @@ -147,6 +151,10 @@ public class CustomerInfoServiceImpl implements ICustomerInfoService if (count > 0) { throw new ServiceException("客户编码已存在"); } + count = customerInfoMapper.selectCountByName(customerInfo.getCustomerName(), customerInfo.getId()); + if (count > 0) { + throw new ServiceException("最终客户名称已存在"); + } projectInfoMapper.updateCustomerCodeByCode(oldCustomerInfo.getCustomerCode(), newCustomerCode); return customerInfoMapper.updateCustomerInfo(customerInfo); } finally { @@ -154,7 +162,10 @@ public class CustomerInfoServiceImpl implements ICustomerInfoService } } - + int count = customerInfoMapper.selectCountByName(customerInfo.getCustomerName(), customerInfo.getId()); + if (count > 0) { + throw new ServiceException("最终客户名称已存在"); + } return customerInfoMapper.updateCustomerInfo(customerInfo); } diff --git a/ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml index 20246edf..79966b89 100644 --- a/ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml @@ -155,4 +155,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + \ No newline at end of file