示例#1
0
 /**
  * 获取用户某个分类下的全部分类节点
  *
  * @param parentId 父节点编号
  * @param userId 用户登录账号
  * @return
  */
 public List<TreeModel> getTreeModels(long parentId, String actorId) {
   List<TreeModel> treeModels = new java.util.ArrayList<TreeModel>();
   SysUser user = sysUserService.findByAccount(actorId);
   if (user != null) {
     user = sysUserService.getUserPrivileges(user);
     TreeModel root = sysTreeService.findById(parentId);
     if (user.isSystemAdministrator()) {
       this.loadChildrenTreeModels(treeModels, parentId, user);
       // SysTreeQuery query = new SysTreeQuery();
       // query.treeIdLike(root.getTreeId() + "%");
       // List<SysTree> trees = sysTreeMapper.getSysTrees(query);
       // if (trees != null && !trees.isEmpty()) {
       // for (SysTree tree : trees) {
       // treeModels.add(tree);
       // }
       // }
     } else {
       this.loadChildrenTreeModels(treeModels, parentId, user);
       // SysTreeQuery query = new SysTreeQuery();
       // query.treeIdLike(root.getTreeId() + "%");
       // query.setActorId(actorId);
       // List<SysTree> trees =
       // sysTreeMapper.getTreeListByUsers(query);
       // if (trees != null && !trees.isEmpty()) {
       // for (SysTree tree : trees) {
       // treeModels.add(tree);
       // }
       // }
     }
     treeModels.remove(root);
   }
   return treeModels;
 }
示例#2
0
 /**
  * 获取某个模块的角色及用户
  *
  * @param appId
  * @return
  */
 public List<SysRole> getApplicationRoleWithUsers(long appId) {
   List<SysRole> roles = sysRoleService.getSysRolesByAppId(appId);
   if (roles != null && !roles.isEmpty()) {
     for (SysRole role : roles) {
       List<SysUser> users = sysUserService.getSysUsersByRoleId(role.getId());
       role.setUsers(users);
     }
   }
   return roles;
 }