/** * 单选 * * @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; }