/**
   * 保存
   *
   * @return
   */
  public String save() {
    if (vo.getId() == null) {
      if (vo.getId() == null) {
        String seqname = ("DEPARTMENT");

        if (vo.getDepartment() != null && vo.getDepartment().getId() != null) {
          Department parent = departmentDAO.findById(Department.class, vo.getDepartment().getId());
          String code =
              sysAppSequenceDAO.getNotPrefixSeqVal(seqname + "_" + parent.getCode(), 2, "部门编号");
          vo.setCode(parent.getCode() + code);
        } else {
          String code = sysAppSequenceDAO.getNotPrefixSeqVal(seqname, 2, "部门编号");
          vo.setCode(code);
        }
      }
    }

    departmentDAO.saveOrUpdate(vo);
    return redirectSuccess("/basic/department/index.jhtml", "数据保存成功");
  }
  /**
   * 单选
   *
   * @return
   */
  public String single() {
    if (vo == null) {
      vo = new DepartmentSO();
    }
    vo.setPageNumber(1);
    vo.setObjectsPerPage(Integer.MAX_VALUE);
    List<Department> list = departmentDAO.getList(vo);

    if (list != null && list.size() > 0) {
      JSONArray array = new JSONArray();
      for (Department dep : list) {
        JSONObject json = new JSONObject();
        json.put("id", dep.getId());

        if (dep.getDepartment() == null) {
          json.put("pId", 0);
        } else {
          json.put("pId", dep.getDepartment().getId());
          json.put("open", true);
        }

        json.put("name", dep.getName());

        if (id != null) {
          if (id.equals(dep.getId())) {
            json.put("checked", true);
          }
        }

        array.add(json);
      }
      nodes = array.toString();
    }
    return Constants.SINGLE;
  }