Exemplo n.º 1
0
 /**
  * 获取某个分类下的全部分类节点
  *
  * @param parentId 父节点编号
  * @return
  */
 public List<TreeModel> getTreeModels(long parentId) {
   List<TreeModel> treeModels = new java.util.ArrayList<TreeModel>();
   TreeModel root = sysTreeService.findById(parentId);
   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);
     }
   }
   treeModels.remove(root);
   return treeModels;
 }
Exemplo n.º 2
0
  protected void loadChildrenTreeModels(List<TreeModel> treeModels, long parentId, SysUser user) {
    List<SysApplication> list = null;
    if (user.isSystemAdmin()) {
      logger.debug("#admin user="******"#user="******"#app list=" + list);
    }
    if (list != null && list.size() > 0) {
      Iterator<SysApplication> iter = list.iterator();
      while (iter.hasNext()) {
        SysApplication bean = (SysApplication) iter.next();
        if (bean.getLocked() == 1) {
          continue;
        }
        TreeModel treeModel = new BaseTree();
        treeModel.setCode(bean.getCode());
        treeModel.setId(bean.getId());
        treeModel.setParentId(parentId);
        treeModel.setName(bean.getName());
        treeModel.setLocked(bean.getLocked());
        treeModel.setDescription(bean.getDesc());
        treeModel.setUrl(bean.getUrl());
        treeModel.setSortNo(bean.getSort());

        List<SysApplication> childrenNodes = null;
        if (user.isSystemAdmin()) {
          childrenNodes = getApplicationList((int) bean.getId());
        } else {
          childrenNodes = getAccessAppList(bean.getId(), user);
        }
        if (childrenNodes != null && childrenNodes.size() > 0) { // 有子菜单
          this.loadChildrenTreeModels(treeModels, bean.getId(), user);
        }
        treeModels.add(treeModel);
      }
    }
  }
Exemplo n.º 3
0
 public TreeModel getTreeModelByAppId(long appId) {
   SysApplication bean = this.findById(appId);
   if (bean != null) {
     TreeModel treeModel = sysTreeService.findById(bean.getNodeId());
     treeModel.setCode(bean.getCode());
     treeModel.setName(bean.getName());
     treeModel.setLocked(bean.getLocked());
     treeModel.setDescription(bean.getDesc());
     treeModel.setUrl(bean.getUrl());
     treeModel.setSortNo(bean.getSort());
     return treeModel;
   }
   return null;
 }