From 4c42afc6b9e45aff43847381bab5b4a2805fc162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Tue, 24 Mar 2026 16:05:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(repository):=20=E6=9B=B4=E6=96=B0=E6=8A=A5?= =?UTF-8?q?=E4=BB=B7=E6=A8=A1=E5=9E=8B=E9=85=8D=E7=BD=AE=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=92=8C=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 IQuotationModelConfigService 接口中为 getEffectives 方法添加 configId 参数 - 在 QuotationModelConfigMapper 中同步更新 getEffectives 方法签名 - 重构 QuotationModelConfigMapper.xml 中的 SQL 查询逻辑,使用 LEFT JOIN 替代 INNER JOIN - 在 QuotationModelConfigServiceImpl 中更新方法实现以匹配新的参数列表 - 在 ShoppingController 中调用时传递新增的 configId 参数 - 在 RatioConfigController 中添加空集合检查以避免 NPE 异常 --- .../admin/RatioConfigController.java | 52 ++++++++++--------- .../controller/app/ShoppingController.java | 2 +- .../mapper/QuotationModelConfigMapper.java | 2 +- .../service/IQuotationModelConfigService.java | 2 +- .../impl/QuotationModelConfigServiceImpl.java | 4 +- .../mapper/QuotationModelConfigMapper.xml | 20 ++++--- 6 files changed, 45 insertions(+), 37 deletions(-) diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/RatioConfigController.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/RatioConfigController.java index 12332941..bb2b8075 100644 --- a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/RatioConfigController.java +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/RatioConfigController.java @@ -71,31 +71,35 @@ public class RatioConfigController extends ControllerBase { TargetUserVO vo = new TargetUserVO(); if (isMarketingDirector) { List agentItems = ratioAgentItemService.getEffectives(); - vo.setAppUsers( - appUserService.lambdaQuery() - .in(AppUser::getId, agentItems.stream().map(QuotationModelRatioAgentItemDTO::getUserId).collect(Collectors.toList())) - .list() - .stream() - .map(u -> new TargetUserItemVO() - .setUserType(1) - .setUserId(u.getId()) - .setUserName(u.getName()) - ) - .collect(Collectors.toList()) - ); + if (CollectionUtil.isNotEmpty(agentItems)) { + vo.setAppUsers( + appUserService.lambdaQuery() + .in(AppUser::getId, agentItems.stream().map(QuotationModelRatioAgentItemDTO::getUserId).collect(Collectors.toList())) + .list() + .stream() + .map(u -> new TargetUserItemVO() + .setUserType(1) + .setUserId(u.getId()) + .setUserName(u.getName()) + ) + .collect(Collectors.toList()) + ); + } List directItems = ratioDirectItemService.getEffectives(); - vo.setAdminUsers( - adminUserService.lambdaQuery() - .in(AdminUser::getId, directItems.stream().map(QuotationModelRatioDirectItemDTO::getUserId).collect(Collectors.toList())) - .list() - .stream() - .map(u -> new TargetUserItemVO() - .setUserType(0) - .setUserId(u.getId()) - .setUserName(u.getUserName()) - ) - .collect(Collectors.toList()) - ); + if (CollectionUtil.isNotEmpty(directItems)) { + vo.setAdminUsers( + adminUserService.lambdaQuery() + .in(AdminUser::getId, directItems.stream().map(QuotationModelRatioDirectItemDTO::getUserId).collect(Collectors.toList())) + .list() + .stream() + .map(u -> new TargetUserItemVO() + .setUserType(0) + .setUserId(u.getId()) + .setUserName(u.getUserName()) + ) + .collect(Collectors.toList()) + ); + } } return ApiResult.success(vo); } diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ShoppingController.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ShoppingController.java index 1fe69b5e..cd1bd81a 100644 --- a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ShoppingController.java +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ShoppingController.java @@ -212,7 +212,7 @@ public class ShoppingController extends ControllerBase { vo.setDiscount(vo.getTotalFee().subtract(vo.getActualFee())); log.debug("机型【{}】价格为{},优惠{}", request.getModelNo(), vo.getActualFee(), vo.getDiscount()); //获取部件配置 - List parts = modelConfigService.getEffectives(modelPrice.getPriceId(), categoryId, MultilingualUtil.getLanguage()); + List parts = modelConfigService.getEffectives(modelPrice.getConfigId(),modelPrice.getPriceId(), categoryId, MultilingualUtil.getLanguage()); VUtils.trueThrowBusinessError(CollectionUtil.isEmpty(parts)).throwMessage("未获取到部件信息"); vo.setStandardParts(parts.stream() .filter(part -> part.getParentId() == 0L && part.getType() == 1) diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/QuotationModelConfigMapper.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/QuotationModelConfigMapper.java index 2dfbee16..20868526 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/QuotationModelConfigMapper.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/QuotationModelConfigMapper.java @@ -23,5 +23,5 @@ public interface QuotationModelConfigMapper extends BaseMapper search(ModelConfigSearchRequest request, Page objectPage); - List getEffectives(Long priceId, Long categoryId, String language); + List getEffectives(Long configId,Long priceId, Long categoryId, String language); } diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IQuotationModelConfigService.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IQuotationModelConfigService.java index dade5ac1..46a1e45d 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IQuotationModelConfigService.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IQuotationModelConfigService.java @@ -22,5 +22,5 @@ public interface IQuotationModelConfigService extends IService search(ModelConfigSearchRequest request); - List getEffectives(Long priceId, Long categoryId, String language); + List getEffectives(Long configId,Long priceId, Long categoryId, String language); } diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/QuotationModelConfigServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/QuotationModelConfigServiceImpl.java index 3dbe198c..b3a6edcb 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/QuotationModelConfigServiceImpl.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/QuotationModelConfigServiceImpl.java @@ -31,7 +31,7 @@ public class QuotationModelConfigServiceImpl extends ServiceImpl getEffectives(Long priceId, Long categoryId, String language) { - return baseMapper.getEffectives(priceId,categoryId,language); + public List getEffectives(Long configId,Long priceId, Long categoryId, String language) { + return baseMapper.getEffectives(configId,priceId,categoryId,language); } } diff --git a/nflg-mobilebroken-repository/src/main/resources/mapper/QuotationModelConfigMapper.xml b/nflg-mobilebroken-repository/src/main/resources/mapper/QuotationModelConfigMapper.xml index 295a96bd..1849d89d 100644 --- a/nflg-mobilebroken-repository/src/main/resources/mapper/QuotationModelConfigMapper.xml +++ b/nflg-mobilebroken-repository/src/main/resources/mapper/QuotationModelConfigMapper.xml @@ -28,13 +28,17 @@