diff --git a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/SysUserService.java b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/SysUserService.java index 202c6143c..6f3eff808 100644 --- a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/SysUserService.java +++ b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/SysUserService.java @@ -218,7 +218,7 @@ public interface SysUserService extends IService, UserServiceApi { * @author liuhanqing * @date 2021/1/15 11:16 */ - List getUserTreeNodeList(Long orgId); + List getUserTreeNodeList(Long orgId, List treeNodeList); /** * 用户下拉列表选择 diff --git a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserServiceImpl.java b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserServiceImpl.java index 4f49ac7ee..d26820616 100644 --- a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserServiceImpl.java +++ b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserServiceImpl.java @@ -432,7 +432,7 @@ public class SysUserServiceImpl extends ServiceImpl impl orgTreeNode.setValue(String.valueOf(hrOrganization.getOrgId())); orgTreeNode.setSort(hrOrganization.getOrgSort()); treeNodeList.add(orgTreeNode); - List userNodeList = this.getUserTreeNodeList(hrOrganization.getOrgId()); + List userNodeList = this.getUserTreeNodeList(hrOrganization.getOrgId(), treeNodeList); if (userNodeList.size() > 0) { treeNodeList.addAll(userNodeList); } @@ -477,9 +477,9 @@ public class SysUserServiceImpl extends ServiceImpl impl } @Override - public List getUserTreeNodeList(Long orgId) { + public List getUserTreeNodeList(Long orgId, List treeNodeList) { // 定义返回结果 - List treeNodeList = CollectionUtil.newArrayList(); + List newTreeNodeList = CollectionUtil.newArrayList(); SysUserRequest userRequest = new SysUserRequest(); userRequest.setOrgId(orgId); List userList = this.baseMapper.findUserList(userRequest); @@ -491,9 +491,20 @@ public class SysUserServiceImpl extends ServiceImpl impl userTreeNode.setName(user.getRealName()); userTreeNode.setNodeType(TreeNodeEnum.USER.getCode()); userTreeNode.setValue(String.valueOf(user.getUserId())); - treeNodeList.add(userTreeNode); + + // 判断参数treeNodeList是否包含这个用户,如果包含了就不用返回了 + boolean fillThisUser = true; + for (UserSelectTreeNode userSelectTreeNode : treeNodeList) { + if (userSelectTreeNode.getNodeId().equals(userTreeNode.getId())) { + fillThisUser = false; + break; + } + } + if (fillThisUser) { + newTreeNodeList.add(userTreeNode); + } } - return treeNodeList; + return newTreeNodeList; } @Override