From 852d05556f73edc09e1d7a4f437ccb74c84e53d5 Mon Sep 17 00:00:00 2001 From: Raod <1130305001@qq.com> Date: Wed, 29 Sep 2021 13:07:12 +0800 Subject: [PATCH] batch --- .../service/impl/ReportDashboardServiceImpl.java | 10 +++++++--- .../dataset/service/impl/DataSetServiceImpl.java | 16 ++++++++++------ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dashboard/service/impl/ReportDashboardServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dashboard/service/impl/ReportDashboardServiceImpl.java index 4210fc0d..a89fc060 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dashboard/service/impl/ReportDashboardServiceImpl.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dashboard/service/impl/ReportDashboardServiceImpl.java @@ -159,7 +159,7 @@ public class ReportDashboardServiceImpl implements ReportDashboardService, Initi .lambda().eq(ReportDashboardWidget::getReportCode, reportCode)); List widgets = dto.getWidgets(); - List reportDashboardWidgetList = new ArrayList<>(); +// List reportDashboardWidgetList = new ArrayList<>(); for (int i = 0; i < widgets.size(); i++) { ReportDashboardWidget reportDashboardWidget = new ReportDashboardWidget(); ReportDashboardWidgetDto reportDashboardWidgetDto = widgets.get(i); @@ -175,9 +175,13 @@ public class ReportDashboardServiceImpl implements ReportDashboardService, Initi reportDashboardWidget.setEnableFlag(1); reportDashboardWidget.setDeleteFlag(0); reportDashboardWidget.setSort((long) (i + 1)); - reportDashboardWidgetList.add(reportDashboardWidget); + + //兼容底层,不采用批量插入 + reportDashboardWidgetService.insert(reportDashboardWidget); + +// reportDashboardWidgetList.add(reportDashboardWidget); } - reportDashboardWidgetService.insertBatch(reportDashboardWidgetList); +// reportDashboardWidgetService.insertBatch(reportDashboardWidgetList); } diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataset/service/impl/DataSetServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataset/service/impl/DataSetServiceImpl.java index 1282bfca..d6ef6248 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataset/service/impl/DataSetServiceImpl.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataset/service/impl/DataSetServiceImpl.java @@ -315,14 +315,16 @@ public class DataSetServiceImpl implements DataSetService { if (null == dataSetParamDtoList || dataSetParamDtoList.size() <= 0) { return; } - List dataSetParamList = new ArrayList<>(); +// List dataSetParamList = new ArrayList<>(); dataSetParamDtoList.forEach(dataSetParamDto -> { DataSetParam dataSetParam = new DataSetParam(); BeanUtils.copyProperties(dataSetParamDto, dataSetParam); dataSetParam.setSetCode(setCode); - dataSetParamList.add(dataSetParam); + //不采用批量 + dataSetParamService.insert(dataSetParam); +// dataSetParamList.add(dataSetParam); }); - dataSetParamService.insertBatch(dataSetParamList); +// dataSetParamService.insertBatch(dataSetParamList); } @@ -335,15 +337,17 @@ public class DataSetServiceImpl implements DataSetService { if (null == dataSetTransformDtoList || dataSetTransformDtoList.size() <= 0) { return; } - List dataSetTransformList = new ArrayList<>(); +// List dataSetTransformList = new ArrayList<>(); for (int i = 0; i < dataSetTransformDtoList.size(); i++) { DataSetTransform dataSetTransform = new DataSetTransform(); BeanUtils.copyProperties(dataSetTransformDtoList.get(i), dataSetTransform); dataSetTransform.setOrderNum(i + 1); dataSetTransform.setSetCode(setCode); - dataSetTransformList.add(dataSetTransform); + //不采用批量 + dataSetTransformService.insert(dataSetTransform); +// dataSetTransformList.add(dataSetTransform); } - dataSetTransformService.insertBatch(dataSetTransformList); +// dataSetTransformService.insertBatch(dataSetTransformList); } }