Ver Fonte

fix(product): 打破 ProductService↔NutritionProductService 循环依赖

Xiaogang Liao há 1 dia atrás
pai
commit
a2e208687d

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/service/NutritionProductService.java

@@ -39,7 +39,7 @@ public class NutritionProductService {
     private NutritionProductReviewMapper reviewMapper;
 
     @Resource
-    private ProductService productService;
+    private ProductMapper productMapper;
 
     /** 分类列表(树结构) */
     public List<NutritionCategory> listCategories() {
@@ -128,7 +128,7 @@ public class NutritionProductService {
         result.put("reviews", reviewMap);
         // 如果有关联的本平台商品,返回其信息
         if (product.getLocalProductId() != null) {
-            Product localProduct = productService.getById(product.getLocalProductId());
+            Product localProduct = productMapper.selectById(product.getLocalProductId());
             if (localProduct != null) {
                 Map<String, Object> localInfo = new HashMap<>();
                 localInfo.put("id", localProduct.getId());