组织人员树避免死循环

This commit is contained in:
sxu 2025-06-17 15:53:40 +08:00
parent 319e98f1a3
commit 1403165f3e
4 changed files with 27 additions and 1 deletions

View File

@ -24,6 +24,11 @@ public class SysDept extends BaseEntity {
*/ */
private Long deptId; private Long deptId;
/**
* 人员部门树节点id
*/
private Long nodeId;
/** /**
* 父部门ID * 父部门ID
*/ */
@ -287,6 +292,14 @@ public class SysDept extends BaseEntity {
this.deptId = deptId; this.deptId = deptId;
} }
public Long getNodeId() {
return nodeId;
}
public void setNodeId(Long nodeId) {
this.nodeId = nodeId;
}
public Long getParentId() { public Long getParentId() {
return parentId; return parentId;
} }

View File

@ -490,7 +490,7 @@ public class SysUserController extends BaseController {
/** /**
* 查询部门人员树列表 * 查询部门人员树列表
*/ */
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:user:list")) //@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:user:list"))
@PostMapping("/deptUserTree") @PostMapping("/deptUserTree")
public AjaxResult deptUserTree(@RequestBody SysUser sysUser) { public AjaxResult deptUserTree(@RequestBody SysUser sysUser) {
try { try {

View File

@ -25,6 +25,8 @@ public class TreeSelect implements Serializable {
/** 父部门ID */ /** 父部门ID */
private Long parentId; private Long parentId;
private Long nodeId;
/** /**
* 节点名称 * 节点名称
*/ */
@ -48,6 +50,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.parentId = dept.getParentId();
this.nodeId = dept.getNodeId();
this.status = dept.getStatus(); this.status = dept.getStatus();
this.label = dept.getDeptName(); this.label = dept.getDeptName();
this.level = dept.getLevel(); this.level = dept.getLevel();
@ -85,6 +88,14 @@ public class TreeSelect implements Serializable {
this.parentId = parentId; this.parentId = parentId;
} }
public Long getNodeId() {
return nodeId;
}
public void setNodeId(Long nodeId) {
this.nodeId = nodeId;
}
public String getLabel() { public String getLabel() {
return label; return label;
} }

View File

@ -115,6 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT SELECT
d.dept_id AS deptId, d.dept_id AS deptId,
d.parent_id AS parentId, d.parent_id AS parentId,
d.dept_id as nodeId,
d.dept_name AS deptName, d.dept_name AS deptName,
LENGTH( d.ancestors ) - LENGTH( LENGTH( d.ancestors ) - LENGTH(
REPLACE ( d.ancestors, ',', '' )) AS LEVEL REPLACE ( d.ancestors, ',', '' )) AS LEVEL
@ -129,6 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT SELECT
CONCAT(sd.dept_id,'9999',su.user_id) AS deptId, CONCAT(sd.dept_id,'9999',su.user_id) AS deptId,
sd.dept_id AS parentId, sd.dept_id AS parentId,
su.user_id as nodeId,
su.nick_name AS deptName, su.nick_name AS deptName,
99 AS LEVEL 99 AS LEVEL
FROM FROM