|
|
@ -257,6 +257,14 @@ public class ClassicCategoryApplicationServiceImpl implements ClassicCategoryApp |
|
|
throw new BusinessErrorException("该分类下存在子分类,无法删除"); |
|
|
throw new BusinessErrorException("该分类下存在子分类,无法删除"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
// 如果是二级分类,校验是否存在套题
|
|
|
|
|
|
if (Objects.equals(category.getLevel(), 2)) { |
|
|
|
|
|
long paperSetCount = classicPaperSetBaseService.count( |
|
|
|
|
|
new LambdaQueryWrapper<ClassicPaperSetEntity>().eq(ClassicPaperSetEntity::getClassicCategoryId, id)); |
|
|
|
|
|
if (paperSetCount > 0) { |
|
|
|
|
|
throw new BusinessErrorException("该分类下存在套题,无法删除"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
classicCategoryBaseService.removeById(id); |
|
|
classicCategoryBaseService.removeById(id); |
|
|
return Result.success("删除成功"); |
|
|
return Result.success("删除成功"); |
|
|
} |
|
|
} |
|
|
|