Commit 5674bfafc89b3b5247ac3007d49c70b3c35d79fd
1 parent
b89d7ff3
[修改][商品分类]分类只能存在2级
Showing
1 changed file
with
1 additions
and
1 deletions
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 { |
| 77 | 77 | throw exception(CATEGORY_PARENT_NOT_EXISTS); |
| 78 | 78 | } |
| 79 | 79 | // 父分类不能是二级分类 |
| 80 | - if (Objects.equals(id, ProductCategoryDO.PARENT_ID_NULL)) { | |
| 80 | + if (!Objects.equals(category.getParentId(), ProductCategoryDO.PARENT_ID_NULL)) { | |
| 81 | 81 | throw exception(CATEGORY_PARENT_NOT_FIRST_LEVEL); |
| 82 | 82 | } |
| 83 | 83 | } | ... | ... |