diff --git a/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/StoreCategoryController.java b/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/StoreCategoryController.java index 22c6b8f2..fa245983 100644 --- a/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/StoreCategoryController.java +++ b/yshop-shop/src/main/java/co/yixiang/modules/shop/rest/StoreCategoryController.java @@ -104,6 +104,11 @@ public class StoreCategoryController { if(resources.getPid() > 0 && StrUtil.isBlank(resources.getPic())) { throw new BadRequestException("子分类图片必传"); } + + if(resources.getId().equals(resources.getPid())){ + throw new BadRequestException("自己不能选择自己哦"); + } + boolean checkResult = yxStoreCategoryService.checkCategory(resources.getPid()); if(!checkResult) throw new BadRequestException("分类最多能添加2级哦");