diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/category/ProductCategoryServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/category/ProductCategoryServiceImpl.java index f0d10b8b8..21dfb9dee 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/category/ProductCategoryServiceImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/category/ProductCategoryServiceImpl.java @@ -77,7 +77,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { throw exception(CATEGORY_PARENT_NOT_EXISTS); } // 父分类不能是二级分类 - if (Objects.equals(id, ProductCategoryDO.PARENT_ID_NULL)) { + if (!Objects.equals(category.getParentId(), ProductCategoryDO.PARENT_ID_NULL)) { throw exception(CATEGORY_PARENT_NOT_FIRST_LEVEL); } }