Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fgqyxxlr
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yaru
fgqyxxlr
Commits
59e2d4a2
Commit
59e2d4a2
authored
May 15, 2020
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改上级部门(选择项排除本身和下级)
parent
dc6fe4c9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
4 deletions
+62
-4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
+20
-2
ruoyi-admin/src/main/resources/templates/system/dept/edit.html
+2
-1
ruoyi-admin/src/main/resources/templates/system/dept/tree.html
+4
-1
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java
+8
-0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
+28
-0
No files found.
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
View file @
59e2d4a2
...
...
@@ -153,11 +153,16 @@ public class SysDeptController extends BaseController
/**
* 选择部门树
*
* @param deptId 部门ID
* @param excludeId 排除ID
*/
@GetMapping
(
"/selectDeptTree/{deptId}"
)
public
String
selectDeptTree
(
@PathVariable
(
"deptId"
)
Long
deptId
,
ModelMap
mmap
)
@GetMapping
(
value
=
{
"/selectDeptTree/{deptId}"
,
"/selectDeptTree/{deptId}/{excludeId}"
})
public
String
selectDeptTree
(
@PathVariable
(
"deptId"
)
Long
deptId
,
@PathVariable
(
value
=
"excludeId"
,
required
=
false
)
String
excludeId
,
ModelMap
mmap
)
{
mmap
.
put
(
"dept"
,
deptService
.
selectDeptById
(
deptId
));
mmap
.
put
(
"excludeId"
,
excludeId
);
return
prefix
+
"/tree"
;
}
...
...
@@ -173,6 +178,19 @@ public class SysDeptController extends BaseController
}
/**
* 加载部门列表树(排除下级)
*/
@GetMapping
(
"/treeData/{excludeId}"
)
@ResponseBody
public
List
<
Ztree
>
treeDataExcludeChild
(
@PathVariable
(
value
=
"excludeId"
,
required
=
false
)
Long
excludeId
)
{
SysDept
dept
=
new
SysDept
();
dept
.
setDeptId
(
excludeId
);
List
<
Ztree
>
ztrees
=
deptService
.
selectDeptTreeExcludeChild
(
dept
);
return
ztrees
;
}
/**
* 加载角色部门(数据权限)列表树
*/
@GetMapping
(
"/roleDeptTreeData"
)
...
...
ruoyi-admin/src/main/resources/templates/system/dept/edit.html
View file @
59e2d4a2
...
...
@@ -113,11 +113,12 @@
/*部门管理-修改-选择部门树*/
function
selectDeptTree
()
{
var
deptId
=
$
(
"#treeId"
).
val
();
var
excludeId
=
$
(
"input[name='deptId']"
).
val
();
if
(
deptId
>
0
)
{
var
options
=
{
title
:
'部门选择'
,
width
:
"380"
,
url
:
prefix
+
"/selectDeptTree/"
+
$
(
"#treeId"
).
val
(),
url
:
prefix
+
"/selectDeptTree/"
+
$
(
"#treeId"
).
val
()
+
"/"
+
excludeId
,
callBack
:
doSubmit
};
$
.
modal
.
openOptions
(
options
);
...
...
ruoyi-admin/src/main/resources/templates/system/dept/tree.html
View file @
59e2d4a2
...
...
@@ -28,8 +28,11 @@
<th:block
th:include=
"include :: footer"
/>
<th:block
th:include=
"include :: ztree-js"
/>
<script
th:inline=
"javascript"
>
var
prefix
=
ctx
+
"system/dept"
var
deptId
=
[[
$
{
deptId
}]];
var
excludeId
=
[[
$
{
excludeId
}]];
$
(
function
()
{
var
url
=
ctx
+
"system/dept/treeData"
;
var
url
=
$
.
common
.
isEmpty
(
excludeId
)
?
prefix
+
"/treeData"
:
prefix
+
"/treeData/"
+
excludeId
;
var
options
=
{
url
:
url
,
expandLevel
:
2
,
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java
View file @
59e2d4a2
...
...
@@ -29,6 +29,14 @@ public interface ISysDeptService
public
List
<
Ztree
>
selectDeptTree
(
SysDept
dept
);
/**
* 查询部门管理树(排除下级)
*
* @param dept 部门信息
* @return 所有部门信息
*/
public
List
<
Ztree
>
selectDeptTreeExcludeChild
(
SysDept
dept
);
/**
* 根据角色ID查询菜单
*
* @param role 角色对象
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
View file @
59e2d4a2
package
com
.
ruoyi
.
system
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.List
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -55,6 +57,32 @@ public class SysDeptServiceImpl implements ISysDeptService
}
/**
* 查询部门管理树(排除下级)
*
* @param deptId 部门ID
* @return 所有部门信息
*/
@Override
@DataScope
(
deptAlias
=
"d"
)
public
List
<
Ztree
>
selectDeptTreeExcludeChild
(
SysDept
dept
)
{
Long
deptId
=
dept
.
getDeptId
();
List
<
SysDept
>
deptList
=
deptMapper
.
selectDeptList
(
dept
);
Iterator
<
SysDept
>
it
=
deptList
.
iterator
();
while
(
it
.
hasNext
())
{
SysDept
d
=
(
SysDept
)
it
.
next
();
if
(
d
.
getDeptId
().
intValue
()
==
deptId
||
ArrayUtils
.
contains
(
StringUtils
.
split
(
d
.
getAncestors
(),
","
),
deptId
+
""
))
{
it
.
remove
();
}
}
List
<
Ztree
>
ztrees
=
initZtree
(
deptList
);
return
ztrees
;
}
/**
* 根据角色ID查询部门(数据权限)
*
* @param role 角色对象
...
...
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