public JSONArray selectSysUrlTreeWithSelect(Long sysId, Long roleId, boolean open) { List<Long> allChecked = this.mapper.selectSysUrlIdByRoleId(roleId); Set<Long> ids = new HashSet<Long>(allChecked); JSONArray tree = new JSONArray(); SysUrl sysUrl = new SysUrl(); sysUrl.setSysId(sysId); 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); if (ids.contains(url.getId())) { one.put("checked", true); } tree.add(one); } return tree; }
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 SysUrl selectSysUrlByPid(Long pid) { // TODO Auto-generated method stub SysUrl url = new SysUrl(); url.setPid(pid); return this.selectObj(url); }