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
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
2 deletions
+8
-2
pz-admin/src/main/java/com/pz/web/controller/system/DepartmentController.java
+4
-2
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;
...
@@ -4,8 +4,10 @@ import java.util.List;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.constraints.*
;
import
javax.validation.constraints.*
;
import
cn.dev33.satoken.annotation.SaCheckPermission
;
import
cn.dev33.satoken.annotation.SaCheckPermission
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
...
@@ -42,8 +44,8 @@ public class DepartmentController extends BaseController {
...
@@ -42,8 +44,8 @@ public class DepartmentController extends BaseController {
*/
*/
@SaCheckPermission
(
"system:department:list"
)
@SaCheckPermission
(
"system:department:list"
)
@GetMapping
(
"/list"
)
@GetMapping
(
"/list"
)
public
List
<
DepartmentVo
>
list
(
DepartmentBo
bo
)
{
public
R
<
List
<
DepartmentVo
>
>
list
(
DepartmentBo
bo
)
{
return
iDepartmentService
.
queryPageList
(
bo
);
return
R
.
ok
(
iDepartmentService
.
queryPageList
(
bo
)
);
}
}
/**
/**
...
...
pz-system/src/main/java/com/pz/system/domain/vo/DepartmentVo.java
View file @
e16c27b6
...
@@ -47,5 +47,7 @@ public class DepartmentVo {
...
@@ -47,5 +47,7 @@ public class DepartmentVo {
private
List
<
DepartmentVo
>
children
;
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 {
...
@@ -51,12 +51,14 @@ public class DepartmentServiceImpl implements IDepartmentService {
//根节点集合
//根节点集合
List
<
DepartmentVo
>
rootMenu
=
new
ArrayList
<>();
List
<
DepartmentVo
>
rootMenu
=
new
ArrayList
<>();
for
(
DepartmentVo
entity
:
allMenu
)
{
for
(
DepartmentVo
entity
:
allMenu
)
{
entity
.
setLabel
(
entity
.
getTitle
());
if
(
entity
.
getParentId
()
==
0
)
{
//父节点是0的,为根节点。
if
(
entity
.
getParentId
()
==
0
)
{
//父节点是0的,为根节点。
rootMenu
.
add
(
entity
);
rootMenu
.
add
(
entity
);
}
}
}
}
//为根菜单设置子菜单,getClild是递归调用的
//为根菜单设置子菜单,getClild是递归调用的
for
(
DepartmentVo
entity
:
rootMenu
)
{
for
(
DepartmentVo
entity
:
rootMenu
)
{
entity
.
setLabel
(
entity
.
getTitle
());
/* 获取根节点下的所有子节点 使用getChild方法*/
/* 获取根节点下的所有子节点 使用getChild方法*/
List
<
DepartmentVo
>
childList
=
getChild
(
entity
.
getId
().
toString
(),
allMenu
);
List
<
DepartmentVo
>
childList
=
getChild
(
entity
.
getId
().
toString
(),
allMenu
);
entity
.
setChildren
(
childList
);
//给根节点设置子节点
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