Explorar o código

完成商品分类重构

tsurumure hai 1 mes
pai
achega
350e1f54e6

+ 2 - 0
src/main/java/com/backendsys/modules/b2c/good/entity/GoodCategory.java

@@ -25,6 +25,8 @@ public class GoodCategory {
 
     @TableId(type = IdType.AUTO)
     private Long id;
+
+    @TableField("id")
     @NotNull(message = "分类ID不能为空", groups = { Detail.class, Update.class, Delete.class })
     private Long good_category_id;
 

+ 2 - 0
src/main/java/com/backendsys/modules/b2c/good/service/impl/GoodCategoryServiceImpl.java

@@ -60,6 +60,7 @@ public class GoodCategoryServiceImpl implements GoodCategoryService {
         Long good_category_id = goodCategory.getId();
         List<GoodCategoryI18n> translations = goodCategory.getTranslations().stream()
                 .peek(item -> { ValidationUtil.validateObject(item, GoodCategoryI18n.Create.class); })
+                .map(item -> { item.setGood_category_id(good_category_id); return item; })
                 .collect(Collectors.toList());
         goodCategoryI18nDao.insertBatch(translations);
 
@@ -85,6 +86,7 @@ public class GoodCategoryServiceImpl implements GoodCategoryService {
         // 批量更新 (翻译字段)
         List<GoodCategoryI18n> translations = goodCategory.getTranslations().stream()
             .peek(item -> { ValidationUtil.validateObject(item, GoodCategoryI18n.Update.class); })
+            .map(item -> { item.setGood_category_id(good_category_id); return item; })
             .collect(Collectors.toList());
 
         goodCategoryI18nDao.updateBatch(translations);