Просмотр исходного кода

fix: NutritionProductService 字段名冲突导致 Bean 注入失败

iwt 1 месяц назад
Родитель
Сommit
e81af27c63

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

@@ -24,7 +24,7 @@ public class NutritionProductService {
     private NutritionBrandMapper brandMapper;
 
     @Resource
-    private NutritionProductMapper productMapper;
+    private NutritionProductMapper nutritionProductMapper;
 
     @Resource
     private NutritionIngredientMapper ingredientMapper;
@@ -52,7 +52,7 @@ public class NutritionProductService {
         List<NutritionBrand> brands = brandMapper.selectList(null);
         List<Map<String, Object>> result = new ArrayList<>();
         for (NutritionBrand brand : brands) {
-            Long count = productMapper.selectCount(
+            Long count = nutritionProductMapper.selectCount(
                 new LambdaQueryWrapper<NutritionProduct>()
                     .eq(NutritionProduct::getBrandId, brand.getId())
             );
@@ -81,12 +81,12 @@ public class NutritionProductService {
         }
         wrapper.eq(NutritionProduct::getStatus, 1);
         wrapper.orderByDesc(NutritionProduct::getUpdateTime);
-        return productMapper.selectList(wrapper);
+        return nutritionProductMapper.selectList(wrapper);
     }
 
     /** 产品详情(含成分、各平台价格、评价) */
     public Map<String, Object> detail(Long productId) {
-        NutritionProduct product = productMapper.selectById(productId);
+        NutritionProduct product = nutritionProductMapper.selectById(productId);
         if (product == null) {
             return null;
         }