部门人员树
This commit is contained in:
parent
2173dbfb42
commit
c2bee1ceb9
|
|
@ -55,6 +55,8 @@ public class SysDept extends BaseEntity
|
||||||
/** 子部门 */
|
/** 子部门 */
|
||||||
private List<SysDept> children = new ArrayList<SysDept>();
|
private List<SysDept> children = new ArrayList<SysDept>();
|
||||||
|
|
||||||
|
private List<SysUser> sysUsers;
|
||||||
|
|
||||||
public Long getDeptId()
|
public Long getDeptId()
|
||||||
{
|
{
|
||||||
return deptId;
|
return deptId;
|
||||||
|
|
@ -181,6 +183,14 @@ public class SysDept extends BaseEntity
|
||||||
this.children = children;
|
this.children = children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<SysUser> getSysUsers() {
|
||||||
|
return sysUsers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSysUsers(List<SysUser> sysUsers) {
|
||||||
|
this.sysUsers = sysUsers;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
|
|
||||||
|
|
@ -397,6 +397,21 @@ public class SysUserController extends BaseController {
|
||||||
return error("系统异常,请联系管理员");
|
return error("系统异常,请联系管理员");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部门人员树列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:user:list"))
|
||||||
|
@GetMapping("/deptUserTree")
|
||||||
|
public AjaxResult deptUserTree(SysDept dept) {
|
||||||
|
try {
|
||||||
|
return success(deptService.selectDeptUserTreeList(dept));
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.toString(), e);
|
||||||
|
}
|
||||||
|
return error("系统异常,请联系管理员");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改用户审批状态
|
* 修改用户审批状态
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.bonus.system.api.domain.SysMenu;
|
import com.bonus.system.api.domain.SysMenu;
|
||||||
|
import com.bonus.system.api.domain.SysUser;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.bonus.system.api.domain.SysDept;
|
import com.bonus.system.api.domain.SysDept;
|
||||||
|
|
||||||
|
|
@ -28,6 +29,8 @@ public class TreeSelect implements Serializable {
|
||||||
|
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
private List<SysUser> sysUsers;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 子节点
|
* 子节点
|
||||||
|
|
@ -43,6 +46,7 @@ public class TreeSelect implements Serializable {
|
||||||
this.id = dept.getDeptId();
|
this.id = dept.getDeptId();
|
||||||
this.status = dept.getStatus();
|
this.status = dept.getStatus();
|
||||||
this.label = dept.getDeptName();
|
this.label = dept.getDeptName();
|
||||||
|
this.sysUsers = dept.getSysUsers();
|
||||||
this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -84,4 +88,12 @@ public class TreeSelect implements Serializable {
|
||||||
public void setStatus(String status) {
|
public void setStatus(String status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<SysUser> getSysUsers() {
|
||||||
|
return sysUsers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSysUsers(List<SysUser> sysUsers) {
|
||||||
|
this.sysUsers = sysUsers;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,14 @@ public interface ISysDeptService
|
||||||
*/
|
*/
|
||||||
public List<TreeSelect> selectDeptTreeList(SysDept dept);
|
public List<TreeSelect> selectDeptTreeList(SysDept dept);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门人员树结构信息
|
||||||
|
*
|
||||||
|
* @param dept 部门信息
|
||||||
|
* @return 部门树信息集合
|
||||||
|
*/
|
||||||
|
public List<TreeSelect> selectDeptUserTreeList(SysDept dept);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建前端所需要树结构
|
* 构建前端所需要树结构
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.bonus.common.core.web.domain.BaseEntity;
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
|
import com.bonus.system.mapper.SysUserMapper;
|
||||||
import com.bonus.system.utils.CommonDataPermissionInfo;
|
import com.bonus.system.utils.CommonDataPermissionInfo;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -36,6 +37,9 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysDeptMapper deptMapper;
|
private SysDeptMapper deptMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysUserMapper userMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysRoleMapper roleMapper;
|
private SysRoleMapper roleMapper;
|
||||||
|
|
||||||
|
|
@ -71,6 +75,32 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||||
return buildDeptTreeSelect(depts);
|
return buildDeptTreeSelect(depts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门人员树结构信息
|
||||||
|
*
|
||||||
|
* @param dept 部门信息
|
||||||
|
* @return 部门树信息集合
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<TreeSelect> selectDeptUserTreeList(SysDept dept)
|
||||||
|
{
|
||||||
|
List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
|
||||||
|
for (SysDept sysDept : depts) {
|
||||||
|
SysUser paramUser = new SysUser();
|
||||||
|
paramUser.setDeptId(sysDept.getDeptId());
|
||||||
|
List<SysUser> users = userMapper.selectUserList(paramUser);
|
||||||
|
|
||||||
|
List<SysUser> sysUsers = new ArrayList<>();
|
||||||
|
for (SysUser sysUser : users) {
|
||||||
|
if (sysUser.getDeptId().equals(sysDept.getDeptId())) {
|
||||||
|
sysUsers.add(sysUser);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sysDept.setSysUsers(sysUsers);
|
||||||
|
}
|
||||||
|
return buildDeptTreeSelect(depts);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建前端所需要树结构
|
* 构建前端所需要树结构
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue