private void selectSysUrlTree(JSONArray tree, Sys sys, boolean open) { JSONObject parent = new JSONObject(); parent.clear(); parent.put("id", sys.getId()); parent.put("pId", "0"); parent.put("name", sys.getSysChName()); parent.put("noteInfo", sys); parent.put("noteType", "sys"); parent.put("open", open); tree.add(parent); SysUrl sysUrl = new SysUrl(); sysUrl.setSysId(sys.getId()); List<SysUrl> urlList = this.mapper.selectSysUrlList(sysUrl); for (SysUrl url : urlList) { JSONObject one = new JSONObject(); one.put("id", url.getId()); if (url.getUrlLev() < 2) { one.put("pId", url.getSysId()); } else { one.put("pId", url.getPid()); } one.put("name", url.getUrlName()); one.put("noteInfo", url); one.put("noteType", "url"); one.put("open", open); tree.add(one); } }
public JSONArray selectSysUrlTree(List<Sys> sysList) { JSONArray tree = new JSONArray(); for (Sys sys : sysList) { Sys tmp = new Sys(); tmp.setId(sys.getId()); tmp.setDefUrl(sys.getDefUrl()); tmp.setSysChName(sys.getSysChName()); tmp.setIndexStr(sys.getIndexStr()); this.selectSysUrlTree(tree, tmp, true); } return tree; }