Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
cms_sys
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
西魏
cms_sys
Commits
954b380a
Commit
954b380a
authored
Apr 29, 2021
by
不期而遇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复叶子节点
parent
7dcb9e80
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
CategoryBizImpl.java
src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java
+19
-0
No files found.
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
Markdown
is supported
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