From a3fc41ec8cb6c6001bd57032018c642ce7e9da19 Mon Sep 17 00:00:00 2001 From: PQZ Date: Wed, 30 Oct 2024 14:33:47 +0800 Subject: [PATCH] 1 --- .../service/impl/CustomerMainServiceImpl.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerMainServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerMainServiceImpl.java index f33d9e9b..93c60d2b 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerMainServiceImpl.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerMainServiceImpl.java @@ -34,6 +34,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; @@ -171,7 +172,29 @@ public class CustomerMainServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(CustomerMain::getPhoneNumber,main.getPhoneNumber()); + List list = list(lambdaQueryWrapper); + if (list.isEmpty()){ + //如不存在插入 + this.save(main); + } else { + if (StringUtils.isNotEmpty(main.getCusName())) { + //如存在,更新用户名称 + CustomerMain updateCust = list.get(0); + updateCust.setCusName(main.getCusName()); + this.updateById(updateCust); + } + } + } else { + //存在id直接更行 + this.updateById(main); + } + /*4、保存扩展表信息*/ if ( null!=saveReqVO.getItemList() && !saveReqVO.getItemList().isEmpty()) {