示例#1
0
 @SuppressWarnings("unchecked")
 public List<Department> getParentDeptList(Integer id) {
   List tempList = new ArrayList();
   while (true) {
     // id 为 顶级部门 (父节点)为0
     if (id.intValue() == Department.rootNode.intValue()) {
       break;
     }
     Department dept = entityDao.queryByDepartmentId(id);
     tempList.add(dept);
     if (dept.getParentId().intValue() != Department.rootNode.intValue()) {
       dept = entityDao.queryByDepartmentId(dept.getParentId());
       tempList.add(dept);
     }
     id = dept.getParentId();
   }
   return tempList;
 }
示例#2
0
  public List<Department> getSubDepartmentList(Integer id) {
    List<Integer> idList = new ArrayList<Integer>();
    List<Department> deptList = new ArrayList<Department>();
    List<Department> list = getCurSubDepartmentList(id);
    StringTokenizer st = new StringTokenizer(getSubDeptDepartment(list), "id:");
    while (st.hasMoreTokens()) {
      String deptId = st.nextToken();
      idList.add(new Integer(deptId));
    }
    for (Integer tempId : idList) {
      deptList.add(entityDao.queryByDepartmentId(tempId));
    }

    return deptList;
  }