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);