修复栏目删除问题

This commit is contained in:
msgroup 2021-05-07 17:04:36 +08:00
parent 7acd23a3d4
commit 4b34472038
1 changed files with 2 additions and 2 deletions

View File

@ -213,12 +213,12 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i
//获取被删节点的父节点 //获取被删节点的父节点
CategoryEntity parentNode = categoryDao.selectById(category.getCategoryId()); CategoryEntity parentNode = categoryDao.selectById(category.getCategoryId());
//清空CategoryParentIds,避免查找不必要的数据只需要当前的父级栏目
parentNode.setCategoryParentIds(null);
//获取被删节点的所属栏目的其他节点 //获取被删节点的所属栏目的其他节点
List<CategoryEntity> childNode = categoryDao.queryChildren(parentNode); List<CategoryEntity> childNode = categoryDao.queryChildren(parentNode);
//判断删除的是否为主节点 //判断删除的是否为主节点
if (parentNode != null) { if (parentNode != null) {
//清空CategoryParentIds,避免查找不必要的数据只需要当前的父级栏目
parentNode.setCategoryParentIds(null);
UpdateWrapper<CategoryEntity> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<CategoryEntity> updateWrapper = new UpdateWrapper<>();
//如果没有子节点进行更新代码 //如果没有子节点进行更新代码
if (childNode.size() == 1) { if (childNode.size() == 1) {