diff --git a/youlai-admin/admin-api/src/main/java/com/youlai/admin/dto/UserAuthDTO.java b/youlai-admin/admin-api/src/main/java/com/youlai/admin/dto/UserAuthDTO.java index a1283c79b..de4da74cc 100644 --- a/youlai-admin/admin-api/src/main/java/com/youlai/admin/dto/UserAuthDTO.java +++ b/youlai-admin/admin-api/src/main/java/com/youlai/admin/dto/UserAuthDTO.java @@ -38,6 +38,11 @@ public class UserAuthDTO { */ private List roles; + /** + * 部门ID + */ + private Long deptId; + } diff --git a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/service/impl/SysDeptServiceImpl.java b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/service/impl/SysDeptServiceImpl.java index 070a10fde..5f013cefb 100644 --- a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/service/impl/SysDeptServiceImpl.java +++ b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/service/impl/SysDeptServiceImpl.java @@ -120,9 +120,8 @@ public class SysDeptServiceImpl extends ServiceImpl impl .eq(SysDept::getStatus, GlobalConstants.STATUS_YES) .orderByAsc(SysDept::getSort) ); - Long userId = JwtUtils.getUserId(); - SysUser user = iSysUserService.getById(userId); - List deptSelectList = recursionTreeSelectList(user.getDeptId(), deptList); + + List deptSelectList = recursionTreeSelectList(JwtUtils.getJwtPayload().getLong("deptId"), deptList); return deptSelectList; } diff --git a/youlai-admin/admin-boot/src/main/resources/mapper/SysUserMapper.xml b/youlai-admin/admin-boot/src/main/resources/mapper/SysUserMapper.xml index ffe920e86..4788bc963 100644 --- a/youlai-admin/admin-boot/src/main/resources/mapper/SysUserMapper.xml +++ b/youlai-admin/admin-boot/src/main/resources/mapper/SysUserMapper.xml @@ -37,13 +37,14 @@ +