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;
 }
  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);
      }
    }
  }