From f5f3214271596567980c88172d67681771399931 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 11 Sep 2023 17:24:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=9A=E6=97=B6=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3sql-inject?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataset/DataSetTableTaskController.java | 4 +- .../DataSetTableTaskLogController.java | 11 +- .../DataSetTaskInstanceGridRequest.java | 20 +++ .../request/DatasetTaskGridRequest.java | 22 +++ .../io/dataease/ext/ExtDataSetTaskMapper.java | 13 +- .../io/dataease/ext/ExtDataSetTaskMapper.xml | 167 ++++++++++++------ .../plugins/server/XEmailTaskServer.java | 19 +- .../service/dataset/DataSetTableService.java | 98 +++++----- .../dataset/DataSetTableTaskLogService.java | 37 +--- .../dataset/DataSetTableTaskService.java | 80 +++------ .../src/views/dataset/data/UpdateInfo.vue | 9 +- .../src/views/dataset/data/UpdateRecords.vue | 2 +- .../src/views/system/task/DatasetTaskList.vue | 23 +-- .../src/views/system/task/FilterUser.vue | 2 +- .../views/system/task/FilterUserRecord.vue | 2 +- .../src/views/system/task/TaskRecord.vue | 59 ++----- .../XpackEmailInstanceGridRequest.java | 16 ++ .../request/XpackEmailTaskGridRequest.java | 13 ++ .../email/service/EmailXpackService.java | 6 +- 19 files changed, 311 insertions(+), 292 deletions(-) create mode 100644 core/backend/src/main/java/io/dataease/controller/dataset/request/DataSetTaskInstanceGridRequest.java create mode 100644 core/backend/src/main/java/io/dataease/controller/dataset/request/DatasetTaskGridRequest.java create mode 100644 sdk/dataease-plugin-interface/src/main/java/io/dataease/plugins/xpack/email/dto/request/XpackEmailInstanceGridRequest.java create mode 100644 sdk/dataease-plugin-interface/src/main/java/io/dataease/plugins/xpack/email/dto/request/XpackEmailTaskGridRequest.java diff --git a/core/backend/src/main/java/io/dataease/controller/dataset/DataSetTableTaskController.java b/core/backend/src/main/java/io/dataease/controller/dataset/DataSetTableTaskController.java index a4a36265ee..3799547ebf 100644 --- a/core/backend/src/main/java/io/dataease/controller/dataset/DataSetTableTaskController.java +++ b/core/backend/src/main/java/io/dataease/controller/dataset/DataSetTableTaskController.java @@ -8,8 +8,8 @@ import io.dataease.commons.constants.DePermissionType; import io.dataease.commons.constants.ResourceAuthLevel; import io.dataease.commons.utils.PageUtils; import io.dataease.commons.utils.Pager; +import io.dataease.controller.dataset.request.DatasetTaskGridRequest; import io.dataease.controller.request.dataset.DataSetTaskRequest; -import io.dataease.controller.sys.base.BaseGridRequest; import io.dataease.dto.dataset.DataSetTaskDTO; import io.dataease.plugins.common.base.domain.DatasetTableTask; import io.dataease.service.dataset.DataSetTableTaskLogService; @@ -77,7 +77,7 @@ public class DataSetTableTaskController { @ApiOperation("分页查询") @PostMapping("/pageList/{goPage}/{pageSize}") - public Pager> taskList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody BaseGridRequest request) { + public Pager> taskList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody DatasetTaskGridRequest request) { Page page = PageHelper.startPage(goPage, pageSize, true); Pager> listPager = PageUtils.setPageInfo(page, dataSetTableTaskService.taskList4User(request)); diff --git a/core/backend/src/main/java/io/dataease/controller/dataset/DataSetTableTaskLogController.java b/core/backend/src/main/java/io/dataease/controller/dataset/DataSetTableTaskLogController.java index 33608e5123..62e2cabc8e 100644 --- a/core/backend/src/main/java/io/dataease/controller/dataset/DataSetTableTaskLogController.java +++ b/core/backend/src/main/java/io/dataease/controller/dataset/DataSetTableTaskLogController.java @@ -4,16 +4,15 @@ import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.github.xiaoymin.knife4j.annotations.ApiSupport; import io.dataease.auth.annotation.DePermission; -import io.dataease.plugins.common.base.domain.DatasetTableTaskLog; import io.dataease.commons.constants.DePermissionType; import io.dataease.commons.constants.ResourceAuthLevel; import io.dataease.commons.utils.PageUtils; import io.dataease.commons.utils.Pager; -import io.dataease.controller.sys.base.BaseGridRequest; +import io.dataease.controller.dataset.request.DataSetTaskInstanceGridRequest; import io.dataease.dto.dataset.DataSetTaskLogDTO; +import io.dataease.plugins.common.base.domain.DatasetTableTaskLog; import io.dataease.service.dataset.DataSetTableTaskLogService; import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; @@ -41,14 +40,14 @@ public class DataSetTableTaskLogController { @ApiOperation("分页查询") @PostMapping("list/{type}/{goPage}/{pageSize}") - public Pager> list(@RequestBody BaseGridRequest request, @PathVariable String type, @PathVariable int goPage, @PathVariable int pageSize) { + public Pager> list(@RequestBody DataSetTaskInstanceGridRequest request, @PathVariable String type, @PathVariable int goPage, @PathVariable int pageSize) { Page page = PageHelper.startPage(goPage, pageSize, true); return PageUtils.setPageInfo(page, dataSetTableTaskLogService.listTaskLog(request, type)); } @ApiOperation("分页查询") @PostMapping("listForDataset/{type}/{goPage}/{pageSize}") - public Pager> listForDataset(@RequestBody BaseGridRequest request, @PathVariable String type, @PathVariable int goPage, @PathVariable int pageSize) { + public Pager> listForDataset(@RequestBody DataSetTaskInstanceGridRequest request, @PathVariable String type, @PathVariable int goPage, @PathVariable int pageSize) { Page page = PageHelper.startPage(goPage, pageSize, true); return PageUtils.setPageInfo(page, dataSetTableTaskLogService.listTaskLog(request, type)); } @@ -56,7 +55,7 @@ public class DataSetTableTaskLogController { @ApiOperation("导出同步日志") @PostMapping("export") - public void export(@RequestBody BaseGridRequest request) throws Exception{ + public void export(@RequestBody DataSetTaskInstanceGridRequest request) throws Exception { dataSetTableTaskLogService.exportExcel(request); } diff --git a/core/backend/src/main/java/io/dataease/controller/dataset/request/DataSetTaskInstanceGridRequest.java b/core/backend/src/main/java/io/dataease/controller/dataset/request/DataSetTaskInstanceGridRequest.java new file mode 100644 index 0000000000..61891f093e --- /dev/null +++ b/core/backend/src/main/java/io/dataease/controller/dataset/request/DataSetTaskInstanceGridRequest.java @@ -0,0 +1,20 @@ +package io.dataease.controller.dataset.request; + +import io.dataease.plugins.common.request.KeywordRequest; +import lombok.Data; + +import java.util.List; + +@Data +public class DataSetTaskInstanceGridRequest extends KeywordRequest { + + private String id; + + private List lastExecStatus; + + private Long[] lastExecTime; + + private List tableId; + + private List excludedIdList; +} diff --git a/core/backend/src/main/java/io/dataease/controller/dataset/request/DatasetTaskGridRequest.java b/core/backend/src/main/java/io/dataease/controller/dataset/request/DatasetTaskGridRequest.java new file mode 100644 index 0000000000..8f5fe748d6 --- /dev/null +++ b/core/backend/src/main/java/io/dataease/controller/dataset/request/DatasetTaskGridRequest.java @@ -0,0 +1,22 @@ +package io.dataease.controller.dataset.request; + +import io.dataease.plugins.common.request.KeywordRequest; +import lombok.Data; + +import java.util.List; + +@Data +public class DatasetTaskGridRequest extends KeywordRequest { + + private List rate; + + private List status; + + private List lastExecStatus; + + private List tableId; + + private Long[] lastExecTime; + + private String id; +} diff --git a/core/backend/src/main/java/io/dataease/ext/ExtDataSetTaskMapper.java b/core/backend/src/main/java/io/dataease/ext/ExtDataSetTaskMapper.java index 91ff96757e..64e1b4170f 100644 --- a/core/backend/src/main/java/io/dataease/ext/ExtDataSetTaskMapper.java +++ b/core/backend/src/main/java/io/dataease/ext/ExtDataSetTaskMapper.java @@ -1,8 +1,9 @@ package io.dataease.ext; +import io.dataease.controller.dataset.request.DataSetTaskInstanceGridRequest; +import io.dataease.controller.dataset.request.DatasetTaskGridRequest; import io.dataease.dto.dataset.DataSetTaskDTO; import io.dataease.dto.dataset.DataSetTaskLogDTO; -import io.dataease.ext.query.GridExample; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -14,15 +15,15 @@ import java.util.List; */ @Mapper public interface ExtDataSetTaskMapper { - List listTaskLog(GridExample example); + List listTaskLog(DataSetTaskInstanceGridRequest request); - List listUserTaskLog(GridExample example); + List listUserTaskLog(DataSetTaskInstanceGridRequest request); - List taskList(GridExample example); + List taskList(DatasetTaskGridRequest request); - List userTaskList(GridExample example); + List userTaskList(DatasetTaskGridRequest request); - List taskWithTriggers(GridExample example); + List taskWithTriggers(DatasetTaskGridRequest request); List findByPanelId(@Param("panelId") String panelId); diff --git a/core/backend/src/main/java/io/dataease/ext/ExtDataSetTaskMapper.xml b/core/backend/src/main/java/io/dataease/ext/ExtDataSetTaskMapper.xml index 8f95bdb498..316b283d18 100644 --- a/core/backend/src/main/java/io/dataease/ext/ExtDataSetTaskMapper.xml +++ b/core/backend/src/main/java/io/dataease/ext/ExtDataSetTaskMapper.xml @@ -21,15 +21,32 @@ FROM dataset_table_task_log LEFT JOIN dataset_table_task ON dataset_table_task_log.task_id = dataset_table_task.id LEFT JOIN dataset_table ON dataset_table_task_log.table_id = dataset_table.id - - + + where 1=1 + + and dataset_table_task.id = #{id} - - order by ${orderByClause} + + and dataset_table_task_log.status in + + #{status} + - - ORDER BY dataset_table_task_log.create_time desc + + and dataset_table.id in + + #{tid} + + + and (dataset_table_task.last_exec_time between #{lastExecTime.[0]} and #{lastExecTime.[1]}) + + + + and dataset_table_task.name like concat('%', #{keyword}, '%') + + + ORDER BY dataset_table_task_log.create_time desc - SELECT dataset_table.name as table_name, 'grant,manage,use' as `privileges`,dataset_table_task.* , qrtz_triggers.NEXT_FIRE_TIME FROM dataset_table_task left join dataset_table on dataset_table.id=dataset_table_task.table_id left join qrtz_triggers on dataset_table_task.id=qrtz_triggers.TRIGGER_NAME - - + where 1=1 + + and dataset_table_task.rate in + + #{rateItem} + - - order by ${orderByClause} + + and dataset_table_task.status in + + #{statusItem} + - - order by dataset_table_task.create_time desc + + and dataset_table_task.last_exec_status in + + #{lastExecStatusItem} + + + and dataset_table.id in + + #{tid} + + + + and dataset_table_task.id = #{id} + + + and (dataset_table_task.last_exec_time between #{lastExecTime.[0]} and #{lastExecTime.[1]}) + + + and dataset_table_task.name like concat('%', #{keyword}, '%') + + order by dataset_table_task.create_time desc - SELECT dataset_table.name as table_name, get_auths(dataset_table_task.table_id,'dataset', #{extendCondition}) as `privileges`,dataset_table_task.* , qrtz_triggers.NEXT_FIRE_TIME FROM dataset_table_task left join dataset_table on dataset_table.id=dataset_table_task.table_id left join qrtz_triggers on dataset_table_task.id=qrtz_triggers.TRIGGER_NAME - - + + where 1=1 + + and dataset_table_task.rate in + + #{rateItem} + - - order by ${orderByClause} + + and dataset_table_task.status in + + #{statusItem} + - - order by dataset_table_task.create_time desc + + and dataset_table_task.last_exec_status in + + #{lastExecStatusItem} + + + and dataset_table_task.id = #{id} + + + and dataset_table.id in + + #{tid} + + + + and (dataset_table_task.last_exec_time between #{lastExecTime.[0]} and #{lastExecTime.[1]}) + + + and dataset_table_task.name like concat('%', #{keyword}, '%') + + order by dataset_table_task.create_time desc - - SELECT dataset_table.name as table_name, get_auths(dataset_table_task.table_id,'dataset', #{extendCondition}) as `privileges`,dataset_table_task.* , qrtz_triggers.NEXT_FIRE_TIME FROM dataset_table_task left join dataset_table on dataset_table.id=dataset_table_task.table_id left join qrtz_triggers on dataset_table_task.id=qrtz_triggers.TRIGGER_NAME - - - - - order by ${orderByClause} - - - order by dataset_table_task.create_time desc + + and dataset_table_task.id = #{id} + order by dataset_table_task.create_time desc