Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
peizhen-java
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PeiZhen-Java
peizhen-java
Commits
e16c27b6
Commit
e16c27b6
authored
Sep 07, 2023
by
邹磊浩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改代码
parent
bc89217e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
3 deletions
+9
-3
pz-admin/src/main/java/com/pz/web/controller/system/DepartmentController.java
+5
-3
pz-system/src/main/java/com/pz/system/domain/vo/DepartmentVo.java
+2
-0
pz-system/src/main/java/com/pz/system/service/impl/DepartmentServiceImpl.java
+2
-0
No files found.
pz-admin/src/main/java/com/pz/web/controller/system/DepartmentController.java
View file @
e16c27b6
...
...
@@ -4,8 +4,10 @@ import java.util.List;
import
java.util.Arrays
;
import
lombok.RequiredArgsConstructor
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.constraints.*
;
import
cn.dev33.satoken.annotation.SaCheckPermission
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -42,8 +44,8 @@ public class DepartmentController extends BaseController {
*/
@SaCheckPermission
(
"system:department:list"
)
@GetMapping
(
"/list"
)
public
List
<
DepartmentVo
>
list
(
DepartmentBo
bo
)
{
return
iDepartmentService
.
queryPageList
(
bo
);
public
R
<
List
<
DepartmentVo
>
>
list
(
DepartmentBo
bo
)
{
return
R
.
ok
(
iDepartmentService
.
queryPageList
(
bo
)
);
}
/**
...
...
@@ -65,7 +67,7 @@ public class DepartmentController extends BaseController {
@SaCheckPermission
(
"system:department:query"
)
@GetMapping
(
"/{id}"
)
public
R
<
DepartmentVo
>
getInfo
(
@NotNull
(
message
=
"主键不能为空"
)
@PathVariable
Integer
id
)
{
@PathVariable
Integer
id
)
{
return
R
.
ok
(
iDepartmentService
.
queryById
(
id
));
}
...
...
pz-system/src/main/java/com/pz/system/domain/vo/DepartmentVo.java
View file @
e16c27b6
...
...
@@ -47,5 +47,7 @@ public class DepartmentVo {
private
List
<
DepartmentVo
>
children
;
private
String
label
;
}
pz-system/src/main/java/com/pz/system/service/impl/DepartmentServiceImpl.java
View file @
e16c27b6
...
...
@@ -51,12 +51,14 @@ public class DepartmentServiceImpl implements IDepartmentService {
//根节点集合
List
<
DepartmentVo
>
rootMenu
=
new
ArrayList
<>();
for
(
DepartmentVo
entity
:
allMenu
)
{
entity
.
setLabel
(
entity
.
getTitle
());
if
(
entity
.
getParentId
()
==
0
)
{
//父节点是0的,为根节点。
rootMenu
.
add
(
entity
);
}
}
//为根菜单设置子菜单,getClild是递归调用的
for
(
DepartmentVo
entity
:
rootMenu
)
{
entity
.
setLabel
(
entity
.
getTitle
());
/* 获取根节点下的所有子节点 使用getChild方法*/
List
<
DepartmentVo
>
childList
=
getChild
(
entity
.
getId
().
toString
(),
allMenu
);
entity
.
setChildren
(
childList
);
//给根节点设置子节点
...
...
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