com.baomidou.mybatisplus.extension.service.IService Java Examples
The following examples show how to use
com.baomidou.mybatisplus.extension.service.IService.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImportExcelUtil.java From jeecg-cloud with Apache License 2.0 | 6 votes |
public static List<String> importDateSaveOne(Object obj, Class serviceClass,List<String> errorMessage,int i,String errorFlag) { IService bean =(IService) SpringContextUtils.getBean(serviceClass); try { boolean save = bean.save(obj); if(!save){ throw new Exception(errorFlag); } } catch (Exception e) { String message = e.getMessage(); int lineNumber = i + 1; // 通过索引名判断出错信息 if (message.contains(CommonConstant.SQL_INDEX_UNIQ_SYS_ROLE_CODE)) { errorMessage.add("第 " + lineNumber + " 行:角色编码已经存在,忽略导入。"); } else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_JOB_CLASS_NAME)) { errorMessage.add("第 " + lineNumber + " 行:任务类名已经存在,忽略导入。"); }else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_CODE)) { errorMessage.add("第 " + lineNumber + " 行:职务编码已经存在,忽略导入。"); }else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_DEPART_ORG_CODE)) { errorMessage.add("第 " + lineNumber + " 行:部门编码已经存在,忽略导入。"); }else { errorMessage.add("第 " + lineNumber + " 行:未知错误,忽略导入"); log.error(e.getMessage(), e); } } return errorMessage; }
Example #2
Source File: ImportExcelUtil.java From jeecg-boot with Apache License 2.0 | 6 votes |
public static List<String> importDateSaveOne(Object obj, Class serviceClass,List<String> errorMessage,int i,String errorFlag) { IService bean =(IService) SpringContextUtils.getBean(serviceClass); try { boolean save = bean.save(obj); if(!save){ throw new Exception(errorFlag); } } catch (Exception e) { String message = e.getMessage(); int lineNumber = i + 1; // 通过索引名判断出错信息 if (message.contains(CommonConstant.SQL_INDEX_UNIQ_SYS_ROLE_CODE)) { errorMessage.add("第 " + lineNumber + " 行:角色编码已经存在,忽略导入。"); } else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_JOB_CLASS_NAME)) { errorMessage.add("第 " + lineNumber + " 行:任务类名已经存在,忽略导入。"); }else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_CODE)) { errorMessage.add("第 " + lineNumber + " 行:职务编码已经存在,忽略导入。"); }else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_DEPART_ORG_CODE)) { errorMessage.add("第 " + lineNumber + " 行:部门编码已经存在,忽略导入。"); }else { errorMessage.add("第 " + lineNumber + " 行:未知错误,忽略导入"); log.error(e.getMessage(), e); } } return errorMessage; }
Example #3
Source File: ImportExcelUtil.java From jeecg-cloud with Apache License 2.0 | 5 votes |
public static List<String> importDateSave(List<Object> list, Class serviceClass,List<String> errorMessage,String errorFlag) { IService bean =(IService) SpringContextUtils.getBean(serviceClass); for (int i = 0; i < list.size(); i++) { try { boolean save = bean.save(list.get(i)); if(!save){ throw new Exception(errorFlag); } } catch (Exception e) { String message = e.getMessage(); int lineNumber = i + 1; // 通过索引名判断出错信息 if (message.contains(CommonConstant.SQL_INDEX_UNIQ_SYS_ROLE_CODE)) { errorMessage.add("第 " + lineNumber + " 行:角色编码已经存在,忽略导入。"); } else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_JOB_CLASS_NAME)) { errorMessage.add("第 " + lineNumber + " 行:任务类名已经存在,忽略导入。"); }else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_CODE)) { errorMessage.add("第 " + lineNumber + " 行:职务编码已经存在,忽略导入。"); }else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_DEPART_ORG_CODE)) { errorMessage.add("第 " + lineNumber + " 行:部门编码已经存在,忽略导入。"); }else { errorMessage.add("第 " + lineNumber + " 行:未知错误,忽略导入"); log.error(e.getMessage(), e); } } } return errorMessage; }
Example #4
Source File: ImportExcelUtil.java From jeecg-boot with Apache License 2.0 | 5 votes |
public static List<String> importDateSave(List<Object> list, Class serviceClass,List<String> errorMessage,String errorFlag) { IService bean =(IService) SpringContextUtils.getBean(serviceClass); for (int i = 0; i < list.size(); i++) { try { boolean save = bean.save(list.get(i)); if(!save){ throw new Exception(errorFlag); } } catch (Exception e) { String message = e.getMessage(); int lineNumber = i + 1; // 通过索引名判断出错信息 if (message.contains(CommonConstant.SQL_INDEX_UNIQ_SYS_ROLE_CODE)) { errorMessage.add("第 " + lineNumber + " 行:角色编码已经存在,忽略导入。"); } else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_JOB_CLASS_NAME)) { errorMessage.add("第 " + lineNumber + " 行:任务类名已经存在,忽略导入。"); }else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_CODE)) { errorMessage.add("第 " + lineNumber + " 行:职务编码已经存在,忽略导入。"); }else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_DEPART_ORG_CODE)) { errorMessage.add("第 " + lineNumber + " 行:部门编码已经存在,忽略导入。"); }else { errorMessage.add("第 " + lineNumber + " 行:未知错误,忽略导入"); log.error(e.getMessage(), e); } } } return errorMessage; }