/** * 根据ID返回详细信息 * * @param * @return * @throws */ public List treeList(IBaseDTO dto, PageInfo pi, String id) { List list = new ArrayList(); LeafRightSearch lrs = new LeafRightSearch(); Object[] result = (Object[]) dao.findEntity(lrs.treeList(dto, pi, id)); num = dao.findEntitySize(lrs.treeList(dto, pi, id)); for (int i = 0, size = result.length; i < size; i++) { SysLeafRight slr = (SysLeafRight) result[i]; DynaBeanDTO dbd = new DynaBeanDTO(); dbd.set("id", slr.getId()); dbd.set("treeId", slr.getId()); dbd.set("treeType", slr.getType()); dbd.set("label", slr.getLabel()); dbd.set("nickName", slr.getNickName()); String remark = slr.getRemark() == null ? "" : slr.getRemark(); if (remark.length() > 15) { remark = remark.substring(0, 15); } dbd.set("remark", remark); dbd.set("icon", slr.getIcon()); list.add(dbd); } return list; }
/** * 根据ID返回详细信息 * * @param * @return * @throws */ public IBaseDTO treeInfo(String id) { SysLeafRight slr = (SysLeafRight) dao.loadEntity(SysLeafRight.class, id); IBaseDTO dto = new DynaBeanDTO(); dto.set("id", slr.getId()); dto.set("treeId", slr.getId()); dto.set("treeType", slr.getType()); dto.set("label", slr.getLabel()); dto.set("nickName", slr.getNickName()); dto.set("remark", slr.getRemark()); return dto; }
/** * 得到叶子节点权限列表 * * @param nodeId * @return List<SysLeafRight> */ public List<DynaBeanDTO> getLeafRightByNodeId(String nodeId) { List<DynaBeanDTO> rights = new ArrayList<DynaBeanDTO>(); if (nodeId != null) { String hql = "from SysLeafRight where a.baseTree.id = '" + nodeId + "' order by a.nickName"; MyQuery mq = new MyQueryImpl(); mq.setHql(hql); Object[] o = dao.findEntity(searchHelp.searchLeafRightByNodeId(nodeId)); DynaBeanDTO dto = null; for (int i = 0; i < o.length; i++) { dto = new DynaBeanDTO(); SysLeafRight right = (SysLeafRight) o[i]; dto.set("id", right.getId()); dto.set("treeId", right.getBaseTree().getId()); dto.set("treeName", right.getBaseTree().getLabel()); dto.set("type", right.getType()); dto.set("nickName", right.getNickName()); dto.set("deleteMark", right.getDeleteMark()); dto.set("remark", right.getRemark()); rights.add(dto); } } return rights; }