From 721d342f008c884dae75073ace0ede245dc70f55 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Wed, 28 Sep 2022 18:36:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=95=B0=E6=8D=AE=E9=9B=86=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=B1=95=E7=A4=BA=E4=B8=8B=E6=AC=A1=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataset/DataSetTableTaskController.java | 4 ++-- .../dataease/listener/AppStartListener.java | 3 ++- .../provider/datasource/ApiProvider.java | 2 +- .../dataset/DataSetTableTaskService.java | 19 ++++++++++++------- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/backend/src/main/java/io/dataease/controller/dataset/DataSetTableTaskController.java b/backend/src/main/java/io/dataease/controller/dataset/DataSetTableTaskController.java index 00910fd834..90b7bf6c6e 100644 --- a/backend/src/main/java/io/dataease/controller/dataset/DataSetTableTaskController.java +++ b/backend/src/main/java/io/dataease/controller/dataset/DataSetTableTaskController.java @@ -58,14 +58,14 @@ public class DataSetTableTaskController { @DePermission(type = DePermissionType.DATASET, value = "tableId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE) @ApiOperation("查询") @PostMapping("list") - public List list(@RequestBody DatasetTableTask datasetTableTask) { + public List list(@RequestBody DatasetTableTask datasetTableTask) { return dataSetTableTaskService.list(datasetTableTask); } @DePermission(type = DePermissionType.DATASET, value = "tableId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE) @ApiOperation("分页查询") @PostMapping("list/{goPage}/{pageSize}") - public Pager> list(@RequestBody DatasetTableTask datasetTableTask, @PathVariable int goPage, @PathVariable int pageSize) { + public Pager> list(@RequestBody DatasetTableTask datasetTableTask, @PathVariable int goPage, @PathVariable int pageSize) { Page page = PageHelper.startPage(goPage, pageSize, true); return PageUtils.setPageInfo(page, dataSetTableTaskService.list(datasetTableTask)); } diff --git a/backend/src/main/java/io/dataease/listener/AppStartListener.java b/backend/src/main/java/io/dataease/listener/AppStartListener.java index c19dbb0d8b..b064228641 100644 --- a/backend/src/main/java/io/dataease/listener/AppStartListener.java +++ b/backend/src/main/java/io/dataease/listener/AppStartListener.java @@ -1,6 +1,7 @@ package io.dataease.listener; import io.dataease.commons.utils.LogUtil; +import io.dataease.dto.dataset.DataSetTaskDTO; import io.dataease.plugins.common.base.domain.DatasetTableTask; import io.dataease.commons.constants.ScheduleType; import io.dataease.service.ScheduleService; @@ -26,7 +27,7 @@ public class AppStartListener implements ApplicationListener list = dataSetTableTaskService.list(new DatasetTableTask()); + List list = dataSetTableTaskService.list(new DatasetTableTask()); for (DatasetTableTask task : list) { try { if (!StringUtils.equalsIgnoreCase(task.getRate(), ScheduleType.SIMPLE.toString())) { diff --git a/backend/src/main/java/io/dataease/provider/datasource/ApiProvider.java b/backend/src/main/java/io/dataease/provider/datasource/ApiProvider.java index e592d2c5a2..31f63fbac0 100644 --- a/backend/src/main/java/io/dataease/provider/datasource/ApiProvider.java +++ b/backend/src/main/java/io/dataease/provider/datasource/ApiProvider.java @@ -360,7 +360,7 @@ public class ApiProvider extends Provider { private List fetchResult(String result, ApiDefinition apiDefinition) { List dataList = new LinkedList<>(); - if (StringUtils.isNotEmpty(apiDefinition.getDataPath()) && CollectionUtils.isNotEmpty(apiDefinition.getJsonFields())) { + if (StringUtils.isNotEmpty(apiDefinition.getDataPath()) && CollectionUtils.isEmpty(apiDefinition.getJsonFields())) { List datas = new ArrayList<>(); Object object = JsonPath.read(result, apiDefinition.getDataPath()); if (object instanceof List) { diff --git a/backend/src/main/java/io/dataease/service/dataset/DataSetTableTaskService.java b/backend/src/main/java/io/dataease/service/dataset/DataSetTableTaskService.java index 9c289354aa..758f7582c6 100644 --- a/backend/src/main/java/io/dataease/service/dataset/DataSetTableTaskService.java +++ b/backend/src/main/java/io/dataease/service/dataset/DataSetTableTaskService.java @@ -263,14 +263,19 @@ public class DataSetTableTaskService { datasetTableTaskMapper.updateByExampleSelective(datasetTableTask, datasetTableTaskExample); } - public List list(DatasetTableTask datasetTableTask) { - DatasetTableTaskExample datasetTableTaskExample = new DatasetTableTaskExample(); - DatasetTableTaskExample.Criteria criteria = datasetTableTaskExample.createCriteria(); - if (datasetTableTask != null && StringUtils.isNotEmpty(datasetTableTask.getTableId())) { - criteria.andTableIdEqualTo(datasetTableTask.getTableId()); + public List list(DatasetTableTask datasetTableTask) { + BaseGridRequest request = new BaseGridRequest(); + List conditionEntities = new ArrayList<>(); + if(datasetTableTask != null && StringUtils.isNotEmpty(datasetTableTask.getTableId())){ + ConditionEntity entity = new ConditionEntity(); + entity.setField("table_id"); + entity.setOperator("eq"); + entity.setValue(datasetTableTask.getTableId()); + conditionEntities.add(entity); } - datasetTableTaskExample.setOrderByClause("create_time desc,name asc"); - return datasetTableTaskMapper.selectByExample(datasetTableTaskExample); + request.setConditions(conditionEntities); + GridExample gridExample = request.convertExample(); + return extDataSetTaskMapper.taskList(gridExample); } public List taskList4User(BaseGridRequest request) {