修复文章分类删除bug

This commit is contained in:
TinyAnts 2022-09-21 10:29:58 +08:00
parent f89d34915b
commit 6e0f1ade38
1 changed files with 7 additions and 0 deletions

View File

@ -200,6 +200,13 @@ public class ArticleCategoryServiceImpl implements IArticleCategoryService {
Assert.notNull(model, "分类不存在");
Article article = articleMapper.selectOne(new QueryWrapper<Article>()
.eq("cid", id)
.eq("is_delete", 0)
.last("limit 1"));
Assert.isNull(article, "当前分类已被文章使用,请先移除!");
model.setIsDelete(1);
model.setDeleteTime(TimeUtil.timestamp());
articleCategoryMapper.updateById(model);