Ejemplo n.º 1
0
  /**
   * 删除功能树
   *
   * @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);
  }
Ejemplo n.º 2
0
  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);
  }