@Override
  public EUDGPagination getRelaPage(Map<String, Object> params, int pageNo, int pageSize) {
    pageNo = pageNo < 1 ? 1 : pageNo;
    pageSize = pageSize < 1 ? 10 : pageSize;

    int count = functionInfoMapper.findRelaCountByCriteria(params);

    RowBounds rowBounds = new RowBounds((pageNo - 1) * pageSize, pageSize);
    List<FunctionRoleRelaBO> boList =
        functionInfoMapper.findRelaPageListByCriteria(params, rowBounds);

    EUDGPagination page = new EUDGPagination(count, boList);
    return page;
  }
  @Override
  public int delete(Long id) {
    if (id == null) return 0;

    int result = functionInfoMapper.delete(id);
    return result;
  }
  @Override
  public String deleteByIDS(Long[] ids, Long operateUser) {
    if (ids == null || ids.length == 0) {
      return "parameter error";
    }

    for (Long id : ids) {
      List<?> ltest0 = catalogInfoMapper.findCatalogInfoByPFId(id, "002");
      if (ltest0 != null && ltest0.size() > 0) {
        return "id=" + id + " 职能已被挂在行业类型之下,请先解除关系";
      }

      int c1 = catalogTypeMapper.countByFunctionId(id);
      if (c1 > 0) {
        return "id=" + id + " 职能已被行业模板使用,不能删除";
      }

      int c2 = userExampleMapper.countByFunctionId(id);
      if (c2 > 0) {
        return "id=" + id + " 职能已被用户使用,不能删除";
      }
    }

    functionInfoMapper.deleteByIDS(ids, operateUser);
    return null;
  }
 @Override
 @Transactional
 public int saveFunctionRoleRelaList(List<FunctionRoleRelaBO> relaList) {
   try {
     for (FunctionRoleRelaBO bo : relaList) {
       int count = functionInfoMapper.findCountByRoleId(bo.getRoleId(), bo.getFunctionId());
       if (count < 1) {
         functionInfoMapper.saveFunctionRoleRela(bo);
       }
     }
   } catch (Exception e) {
     e.printStackTrace();
     return 0;
   }
   return 1;
 }
  @Override
  public int saveFunctionRoleRela(FunctionRoleRelaBO rela) {
    if (rela == null) return 0;

    int result = functionInfoMapper.saveFunctionRoleRela(rela);
    return result;
  }
  @Override
  public int delRelaByIDS(Long[] ids, Long operateUser) {
    if (ids == null) return 0;

    int result = functionInfoMapper.delRelaByIDS(ids, operateUser);
    return result;
  }
  @Override
  public int insert(FunctionInfoBO t) {
    if (t == null) return 0;

    FunctionInfo info = convertToEntityFrom.convertTofuncFunctionInfo(t);
    int result = functionInfoMapper.insert(info);
    return result;
  }
  @Override
  public int update(FunctionInfoBO t) {
    if (t == null || t.getFunctionId() == null || "".equals(t.getFunctionId())) return 0;

    FunctionInfo info = convertToEntityFrom.convertTofuncFunctionInfo(t);
    int result = functionInfoMapper.update(info);
    return result;
  }
  @Override
  public Long saveFunctionInfo(FunctionInfoBO t) {
    if (t == null) return 0L;

    FunctionInfo info = convertToEntityFrom.convertTofuncFunctionInfo(t);
    functionInfoMapper.insert(info);
    return info.getFunctionId();
  }
 @Override
 public FunctionInfoBO findById(Long id) {
   if (id == null) {
     return null;
   }
   FunctionInfo info = functionInfoMapper.findById(id);
   FunctionInfoBO functionInfoBO = convertToEntityFrom.convertToFunctionInfoBO(info);
   return functionInfoBO;
 }
  @Override
  public EUDGPagination getFunctionPage(Map<String, Object> params, int pageNo, int pageSize) {
    pageNo = pageNo < 1 ? 1 : pageNo;
    pageSize = pageSize < 1 ? 10 : pageSize;

    int count = functionInfoMapper.findCountByCriteria(params);

    RowBounds rowBounds = new RowBounds((pageNo - 1) * pageSize, pageSize);
    List<FunctionInfo> list = functionInfoMapper.findPageListByCriteria(params, rowBounds);

    List<FunctionInfoBO> boList = new ArrayList<FunctionInfoBO>();
    for (FunctionInfo info : list) {
      FunctionInfoBO bo = convertToEntityFrom.convertToFunctionInfoBO(info);
      boList.add(bo);
    }

    EUDGPagination page = new EUDGPagination(count, boList);
    return page;
  }