Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
MCMS
Commits
954b380a
Commit
954b380a
authored
Apr 29, 2021
by
不期而遇
Browse files
修复叶子节点
parent
7dcb9e80
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java
View file @
954b380a
...
...
@@ -26,6 +26,7 @@ import cn.hutool.core.lang.Assert;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
net.mingsoft.base.biz.impl.BaseBizImpl
;
import
net.mingsoft.base.dao.IBaseDao
;
import
net.mingsoft.basic.util.PinYinUtil
;
...
...
@@ -207,6 +208,24 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i
categoryDao
.
deleteBatchIds
(
ids
);
// 删除文章
contentDao
.
deleteEntityByCategoryIds
(
ids
.
toArray
(
new
String
[
ids
.
size
()]));
//获取被删节点的父节点
CategoryEntity
parentNode
=
categoryDao
.
selectById
(
category
.
getCategoryId
());
//获取被删节点的所属栏目的其他节点
List
<
CategoryEntity
>
childNode
=
categoryDao
.
queryChildren
(
parentNode
);
//判断删除的是否为主节点
if
(
parentNode
!=
null
)
{
UpdateWrapper
<
CategoryEntity
>
updateWrapper
=
new
UpdateWrapper
<>();
//是否还有子节点
if
(
childNode
.
size
()
>
1
)
updateWrapper
.
eq
(
"id"
,
parentNode
.
getId
()).
set
(
"leaf"
,
0
);
else
updateWrapper
.
eq
(
"id"
,
parentNode
.
getId
()).
set
(
"leaf"
,
1
);
categoryDao
.
update
(
null
,
updateWrapper
);
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment