Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vehicle-quality-review
Project
Project
Details
Activity
Releases
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
王飞
vehicle-quality-review
Commits
f5e6c9bc
Commit
f5e6c9bc
authored
Apr 08, 2024
by
wdy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://gitlab.91isoft.com:90/wangfei/vehicle-quality-review
into wangdingyi
parents
4de9ba8b
50d0b217
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
32 deletions
+81
-32
SysUserController.java
...va/com/ruoyi/web/controller/system/SysUserController.java
+1
-1
ISysUserService.java
...c/main/java/com/ruoyi/system/service/ISysUserService.java
+6
-0
SysUserServiceImpl.java
...ava/com/ruoyi/system/service/impl/SysUserServiceImpl.java
+74
-31
No files found.
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
View file @
f5e6c9bc
...
@@ -90,7 +90,7 @@ public class SysUserController extends BaseController
...
@@ -90,7 +90,7 @@ public class SysUserController extends BaseController
role
.
setRoleName
(
request
.
getRoleName
());
role
.
setRoleName
(
request
.
getRoleName
());
List
<
SysRole
>
roleList
=
roleService
.
selectRoleList
(
role
);
List
<
SysRole
>
roleList
=
roleService
.
selectRoleList
(
role
);
if
(
CollUtil
.
isNotEmpty
(
roleList
))
{
if
(
CollUtil
.
isNotEmpty
(
roleList
))
{
List
<
SysUser
>
list
=
userService
.
selectUser
ListByRoleId
(
roleList
.
get
(
0
).
getRoleId
());
List
<
SysUser
>
list
=
userService
.
selectUser
ByRoleInDept
(
roleList
.
get
(
0
).
getRoleId
());
return
R
.
ok
(
list
);
return
R
.
ok
(
list
);
}
else
{
}
else
{
return
R
.
fail
(
"角色不存在"
);
return
R
.
fail
(
"角色不存在"
);
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
View file @
f5e6c9bc
...
@@ -219,4 +219,10 @@ public interface ISysUserService
...
@@ -219,4 +219,10 @@ public interface ISysUserService
*/
*/
public
String
importUser
(
List
<
SysUser
>
userList
,
Boolean
isUpdateSupport
,
String
operName
);
public
String
importUser
(
List
<
SysUser
>
userList
,
Boolean
isUpdateSupport
,
String
operName
);
/**
* 通过角色ID查询在同部门下的所有用户
* @param roleId
* @return
*/
List
<
SysUser
>
selectUserByRoleInDept
(
Long
roleId
);
}
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
View file @
f5e6c9bc
...
@@ -4,6 +4,9 @@ import java.util.ArrayList;
...
@@ -4,6 +4,9 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
javax.validation.Validator
;
import
javax.validation.Validator
;
import
com.ruoyi.common.core.domain.entity.SysDept
;
import
com.ruoyi.system.mapper.*
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -22,11 +25,6 @@ import com.ruoyi.common.utils.spring.SpringUtils;
...
@@ -22,11 +25,6 @@ import com.ruoyi.common.utils.spring.SpringUtils;
import
com.ruoyi.system.domain.SysPost
;
import
com.ruoyi.system.domain.SysPost
;
import
com.ruoyi.system.domain.SysUserPost
;
import
com.ruoyi.system.domain.SysUserPost
;
import
com.ruoyi.system.domain.SysUserRole
;
import
com.ruoyi.system.domain.SysUserRole
;
import
com.ruoyi.system.mapper.SysPostMapper
;
import
com.ruoyi.system.mapper.SysRoleMapper
;
import
com.ruoyi.system.mapper.SysUserMapper
;
import
com.ruoyi.system.mapper.SysUserPostMapper
;
import
com.ruoyi.system.mapper.SysUserRoleMapper
;
import
com.ruoyi.system.service.ISysConfigService
;
import
com.ruoyi.system.service.ISysConfigService
;
import
com.ruoyi.system.service.ISysUserService
;
import
com.ruoyi.system.service.ISysUserService
;
...
@@ -61,6 +59,9 @@ public class SysUserServiceImpl implements ISysUserService
...
@@ -61,6 +59,9 @@ public class SysUserServiceImpl implements ISysUserService
@Autowired
@Autowired
protected
Validator
validator
;
protected
Validator
validator
;
@Autowired
private
SysDeptMapper
sysDeptMapper
;
@Override
@Override
public
List
<
SysUser
>
selectUserListByRoleId
(
Long
roleId
)
{
public
List
<
SysUser
>
selectUserListByRoleId
(
Long
roleId
)
{
return
userMapper
.
selectUserListByRoleId
(
roleId
);
return
userMapper
.
selectUserListByRoleId
(
roleId
);
...
@@ -552,4 +553,46 @@ public class SysUserServiceImpl implements ISysUserService
...
@@ -552,4 +553,46 @@ public class SysUserServiceImpl implements ISysUserService
}
}
return
successMsg
.
toString
();
return
successMsg
.
toString
();
}
}
/**
* 通过角色ID查询在同部门下的所有用户
* @param roleId
* @return
*/
@Override
public
List
<
SysUser
>
selectUserByRoleInDept
(
Long
roleId
)
{
List
<
SysUser
>
list
=
new
ArrayList
<>();
// 获取当前登陆用户的部门
Long
deptId
=
SecurityUtils
.
getDeptId
();
// 获取当前角色下的所有用户
List
<
SysUser
>
userList
=
selectUserListByRoleId
(
roleId
);
// 查询出当前用户所在部门以及所有子部门
List
<
SysDept
>
deptList
=
sysDeptMapper
.
selectDeptList
(
new
SysDept
());
List
<
Long
>
userListInDept
=
new
ArrayList
<>();
userListInDept
.
add
(
deptId
);
getAllDeptId
(
deptList
,
deptId
,
userListInDept
);
for
(
SysUser
user
:
userList
)
{
if
(
userListInDept
.
contains
(
user
.
getDeptId
()))
{
list
.
add
(
user
);
}
}
return
list
;
}
/**
* 递归
* 查询出当前用户所在部门以及所有子部门
* @param deptList 传入的部门集合
* @param deptId 查询需要的部门ID
* @param userListInDept 存入的指定部门集合
*/
private
void
getAllDeptId
(
List
<
SysDept
>
deptList
,
Long
deptId
,
List
<
Long
>
userListInDept
)
{
deptList
.
stream
()
.
filter
(
dept
->
dept
.
getParentId
().
equals
(
deptId
))
.
forEach
(
dept
->
{
userListInDept
.
add
(
dept
.
getDeptId
());
getAllDeptId
(
deptList
,
dept
.
getDeptId
(),
userListInDept
);
});
}
}
}
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