From 3bce279d7b56b56e178762344d718b9ce9dc47a7 Mon Sep 17 00:00:00 2001 From: daiyongfei <974332738@qq.com> Date: Tue, 22 Jul 2025 09:58:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=A2=E6=88=B7-=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=90=8D=E9=87=8D=E5=A4=8D=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CustomerServiceImpl.java | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/fys-modules/fys-customer/src/main/java/com/fuyuanshen/customer/service/impl/CustomerServiceImpl.java b/fys-modules/fys-customer/src/main/java/com/fuyuanshen/customer/service/impl/CustomerServiceImpl.java index ac996d4..10e1e7f 100644 --- a/fys-modules/fys-customer/src/main/java/com/fuyuanshen/customer/service/impl/CustomerServiceImpl.java +++ b/fys-modules/fys-customer/src/main/java/com/fuyuanshen/customer/service/impl/CustomerServiceImpl.java @@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fuyuanshen.common.core.domain.model.LoginUser; +import com.fuyuanshen.common.core.utils.StringUtils; import com.fuyuanshen.common.mybatis.core.page.TableDataInfo; import com.fuyuanshen.common.satoken.utils.LoginHelper; import com.fuyuanshen.customer.constant.ArrayConstants; @@ -107,17 +108,27 @@ public class CustomerServiceImpl extends ServiceImpl i /** * 修改客户 * - * @param resources / + * @param customer / */ @Override @Transactional(rollbackFor = Exception.class) - public void updateCustomer(Customer resources) throws Exception { - if (resources.getEnabled()) { - resources.setStatus("0"); - } else { - resources.setStatus("1"); + public void updateCustomer(Customer customer) throws Exception { + + UserQueryCriteria userQueryCriteria = new UserQueryCriteria(); + if (StringUtils.isNotEmpty(customer.getUserName())) { + userQueryCriteria.setCustomerName(customer.getUserName()); + List customers = customerMapper.queryCustomers(userQueryCriteria); + if (!customers.isEmpty()) { + throw new BadRequestException("用户名已存在!!!"); + } } - saveOrUpdate(resources); + + if (customer.getEnabled()) { + customer.setStatus("0"); + } else { + customer.setStatus("1"); + } + saveOrUpdate(customer); }