组织人员树

This commit is contained in:
sxu 2024-11-01 14:01:26 +08:00
parent 84a4e6fc7d
commit 108846a126
5 changed files with 16 additions and 4 deletions

View File

@ -467,10 +467,10 @@ public class SysUserController extends BaseController {
* 根据角色列表获取部门人员树列表 * 根据角色列表获取部门人员树列表
*/ */
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:user:list")) @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:user:list"))
@GetMapping("/deptUserTreeInRoleIds") @GetMapping("/deptUserTree/roleIds/{roleIds}")
public AjaxResult deptUserTreeInRoleIds(SysDept dept, List<Long> roleIds) { public AjaxResult deptUserTreeInRoleIds(@PathVariable("roleIds") Long[] roleIds) {
try { try {
return success(deptService.selectDeptUserTree(dept, roleIds)); return success(deptService.selectDeptUserTree(roleIds));
} catch (Exception e) { } catch (Exception e) {
logger.error(e.toString(), e); logger.error(e.toString(), e);
} }

View File

@ -28,6 +28,8 @@ public interface SysDeptMapper
*/ */
public List<SysDept> selectDeptUserList(SysDept dept, @Param("roleIds") List<Long> roleIds); public List<SysDept> selectDeptUserList(SysDept dept, @Param("roleIds") List<Long> roleIds);
public List<SysDept> selectDeptUserList(@Param("roleIds") Long[] roleIds);
/** /**
* 根据角色ID查询部门树信息 * 根据角色ID查询部门树信息
* *

View File

@ -44,6 +44,8 @@ public interface ISysDeptService
*/ */
public List<TreeSelect> selectDeptUserTree(SysDept dept, List<Long> roleIds); public List<TreeSelect> selectDeptUserTree(SysDept dept, List<Long> roleIds);
public List<TreeSelect> selectDeptUserTree(Long[] roleIds);
/** /**
* 构建前端所需要树结构 * 构建前端所需要树结构
* *

View File

@ -90,6 +90,14 @@ public class SysDeptServiceImpl implements ISysDeptService
return buildDeptTreeSelect(depts); return buildDeptTreeSelect(depts);
} }
@Override
@DataScope(deptAlias = "d")
public List<TreeSelect> selectDeptUserTree(Long[] roleIds)
{
List<SysDept> depts = deptMapper.selectDeptUserList(roleIds);
return buildDeptTreeSelect(depts);
}
/** /**
* 查询部门人员树结构信息 * 查询部门人员树结构信息
* *

View File

@ -47,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by d.parent_id, d.order_num order by d.parent_id, d.order_num
</select> </select>
<select id="selectDeptUserList" parameterType="com.bonus.system.api.domain.SysDept" resultMap="SysDeptResult"> <select id="selectDeptUserList" resultType="com.bonus.system.api.domain.SysDept">
SELECT SELECT
d.dept_id AS deptId, d.dept_id AS deptId,
d.parent_id AS parentId, d.parent_id AS parentId,