@Override public List<Menu> allTreeNode() { List<Menu> nl = new ArrayList<Menu>(); String hql = "from Tmenu t order by t.seq"; List<Tmenu> l = menuDao.find(hql); if (l != null && l.size() > 0) { for (Tmenu t : l) { Menu m = new Menu(); BeanUtils.copyProperties(t, m); Map<String, Object> attributes = new HashMap<String, Object>(); attributes.put("url", t.getUrl()); m.setAttributes(attributes); Tmenu tm = t.getTmenu(); // 获得当前节点的父节点对象 if (tm != null) { m.setPid(tm.getId()); } m.setIconCls(t.getIconcls()); nl.add(m); } } Branch branch = new Branch(); branch.setBranchId("1234"); branch.setBranchAddr("abcdefg"); branch.setBranchArea("aggdfg"); branch.setBrancheTel("asdfadsf"); branchDao.saveOrUpdate(branch); return nl; }
@Override public List<Menu> treegrid() { List<Tmenu> l = menuDao.find("from Tmenu t order by t.seq"); List<Menu> nl = new ArrayList<Menu>(); if (l != null && l.size() > 0) { for (Tmenu t : l) { Menu r = new Menu(); BeanUtils.copyProperties(t, r); if (t.getTmenu() != null) { r.setPid(t.getTmenu().getId()); r.setPname(t.getTmenu().getText()); } r.setIconCls(t.getIconcls()); nl.add(r); } } return nl; }