/** * 删除功能树 * * @param id * @author Administrator * @created 2014年3月8日 下午1:05:57 * @lastModified * @history */ public void deleteFuncTree(String id) { FuncTreeVO funcTreeVO = this.getFuncTree(id); // 校验机构下是否存在机构 if (funcTreeDao.checkFuncTreeHasChild(funcTreeVO)) { throw new BusinessException("{0}功能下存在其他功能,不能删除", new String[] {funcTreeVO.getName()}); } // 删除角色功能树关联表 funcTreeDao.deleteRoleFuncTreeByFuncTreeID(id); // 删除功能 funcTreeDao.remove(id); }
public String saveFuncTree(FuncTreeVO funcTreeVO) { // 校验功能树编码重复 if (funcTreeDao.checkFuncTreeCodeExist(funcTreeVO)) { throw new BusinessException("编码为{0}的功能已存在", new String[] {funcTreeVO.getCode()}); } // 校验功能树名称重复 if (funcTreeDao.checkFuncTreeNameExist(funcTreeVO)) { throw new BusinessException("名称为{0}的功能已存在", new String[] {funcTreeVO.getName()}); } // 生成sort if (StringUtil.isEmpty(funcTreeVO.getId())) { funcTreeVO.setSort(funcTreeDao.generateFuncTreeSort(funcTreeVO)); } return funcTreeDao.saveOrUpdateFuncTree(funcTreeVO); }
/** * 显示功能树 * * @return * @author Administrator * @created 2014年1月1日 下午3:44:53 * @lastModified * @history */ public List<FuncTreeVO> listFuncTrees() { List<FuncTreePO> poList = funcTreeDao.getAllDistinct(); List<FuncTreeVO> voList = new ArrayList<FuncTreeVO>(); FuncTreeVO funcTreeVO; for (FuncTreePO funcTreePO : poList) { funcTreeVO = new FuncTreeVO(); BeanUtils.copyProperties(funcTreePO, funcTreeVO); voList.add(funcTreeVO); } return voList; }
/** * 获取子功能树 * * @param treeNodeID * @return * @author Administrator * @created 2014年1月6日 上午7:56:17 * @lastModified * @history */ public List<FuncTreeVO> listSubFuncTrees(String treeNodeID) { return funcTreeDao.listSubFuncTrees(treeNodeID); }
/** * 获取功能树信息 * * @return * @author Administrator * @created 2014年1月2日 上午7:21:06 * @lastModified * @history */ public FuncTreeVO getFuncTree(String id) { FuncTreePO funcTreePO = funcTreeDao.get(id); FuncTreeVO funcTreeVO = new FuncTreeVO(); BeanUtils.copyProperties(funcTreePO, funcTreeVO); return funcTreeVO; }