From e7369de7f67542b4e14cd8ddfcfded3e8f815362 Mon Sep 17 00:00:00 2001 From: lihongjie <982264618@qq.com> Date: Wed, 2 Oct 2024 12:21:07 +0800 Subject: [PATCH] bugfix --- .../service/CoalWashingDailyAnalysisService.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/service/CoalWashingDailyAnalysisService.java b/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/service/CoalWashingDailyAnalysisService.java index 8ee44a4d..4368c6a2 100644 --- a/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/service/CoalWashingDailyAnalysisService.java +++ b/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/service/CoalWashingDailyAnalysisService.java @@ -16,6 +16,7 @@ import cn.lihongjie.coal.common.FreeMakerUtils; import cn.lihongjie.coal.common.JpaUtils; import cn.lihongjie.coal.exception.BizException; +import cn.lihongjie.coal.product.service.ProductService; import com.google.common.base.CaseFormat; import jakarta.annotation.PostConstruct; @@ -63,7 +64,7 @@ public class CoalWashingDailyAnalysisService validate(entity); if (entity.getProduct()!=null){ - entity.setName(entity.getProduct().getName()); + entity.setName(productService.get(entity.getProduct().getId()).getName()); } this.repository.save(entity); @@ -93,6 +94,9 @@ public class CoalWashingDailyAnalysisService return mapper.toDto(roundMapper.round(entity)); } + @Autowired + ProductService productService; + public CoalWashingDailyAnalysisDto update(UpdateCoalWashingDailyAnalysisDto request) { @@ -108,7 +112,8 @@ public class CoalWashingDailyAnalysisService validate(entity); if (entity.getProduct()!=null){ - entity.setName(entity.getProduct().getName()); + + entity.setName(productService.get(entity.getProduct().getId()).getName()); } this.repository.save(entity);