部门人员树

This commit is contained in:
sxu 2024-10-16 17:34:11 +08:00
parent e7ac7bdae0
commit 7a11f91e0d
4 changed files with 31 additions and 3 deletions

View File

@ -127,6 +127,15 @@ public interface RemoteUserService
@GetMapping("/user/deptTree") @GetMapping("/user/deptTree")
public AjaxResult deptTree(SysDept dept, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); public AjaxResult deptTree(SysDept dept, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 获取当前登录用户数据权限范围内的部门权限下的部门人员树列表
* @param dept 部门信息
* @param source 请求来源
* @return 部门人员树列表或失败消息
*/
@GetMapping("/user/deptUserTree")
public AjaxResult deptUserTree(SysDept dept, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/** /**
* 修改用户审批状态 * 修改用户审批状态
* @param user 用户信息 * @param user 用户信息

View File

@ -95,6 +95,11 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
return AjaxResult.error("获取部门权限下的部门树列表:" + throwable.getMessage()); return AjaxResult.error("获取部门权限下的部门树列表:" + throwable.getMessage());
} }
@Override
public AjaxResult deptUserTree(SysDept dept, String source) {
return AjaxResult.error("获取部门权限下的部门人员树列表:" + throwable.getMessage());
}
@Override @Override
public AjaxResult approvalStatus(SysUser user, String source) { public AjaxResult approvalStatus(SysUser user, String source) {
return AjaxResult.error("修改用户审批状态失败:" + throwable.getMessage()); return AjaxResult.error("修改用户审批状态失败:" + throwable.getMessage());

View File

@ -22,6 +22,9 @@ public class TreeSelect implements Serializable {
*/ */
private Long id; private Long id;
/** 父部门ID */
private Long parentId;
/** /**
* 节点名称 * 节点名称
*/ */
@ -44,6 +47,7 @@ public class TreeSelect implements Serializable {
public TreeSelect(SysDept dept) { public TreeSelect(SysDept dept) {
this.id = dept.getDeptId(); this.id = dept.getDeptId();
this.parentId = dept.getParentId();
this.status = dept.getStatus(); this.status = dept.getStatus();
this.label = dept.getDeptName(); this.label = dept.getDeptName();
this.sysUsers = dept.getSysUsers(); this.sysUsers = dept.getSysUsers();
@ -65,6 +69,14 @@ public class TreeSelect implements Serializable {
this.id = id; this.id = id;
} }
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getLabel() { public String getLabel() {
return label; return label;
} }

View File

@ -91,9 +91,11 @@ public class SysDeptServiceImpl implements ISysDeptService
List<SysUser> users = userMapper.selectUserList(paramUser); List<SysUser> users = userMapper.selectUserList(paramUser);
List<SysUser> sysUsers = new ArrayList<>(); List<SysUser> sysUsers = new ArrayList<>();
for (SysUser sysUser : users) { for (SysUser user : users) {
if (sysUser.getDeptId().equals(sysDept.getDeptId())) { List<Long> roleIds = roleMapper.selectRoleListByUserId(user.getUserId());
sysUsers.add(sysUser); user.setRoleIds(roleIds.toArray(new Long[roleIds.size()]));
if (user.getDeptId().equals(sysDept.getDeptId())) {
sysUsers.add(user);
} }
} }
sysDept.setSysUsers(sysUsers); sysDept.setSysUsers(sysUsers);