Merge pull request #2870 from dataease/pr@dev@feat_dataset_task_batch_del

feat(系统管理-任务管理): 数据同步列表增加批量删除api
This commit is contained in:
fit2cloud-chenyw 2022-08-18 10:49:50 +08:00 committed by GitHub
commit 3460451799
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

View File

@ -49,6 +49,12 @@ public class DataSetTableTaskController {
dataSetTableTaskService.delete(id);
}
@ApiOperation("批量删除")
@PostMapping("batchDelete/{id}")
public void batchDelete(@RequestBody List<String> ids) {
dataSetTableTaskService.batchDelete(ids);
}
@DePermission(type = DePermissionType.DATASET, value = "tableId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("查询")
@PostMapping("list")

View File

@ -149,6 +149,19 @@ public class DataSetTableTaskService {
dataSetTableTaskLogService.deleteByTaskId(id);
}
@Transactional
public void batchDelete(List<String> ids) {
if (CollectionUtils.isNotEmpty(ids)){
for (int i = 0; i < ids.size(); i++) {
String id = ids.get(i);
DatasetTableTask datasetTableTask = datasetTableTaskMapper.selectByPrimaryKey(id);
datasetTableTaskMapper.deleteByPrimaryKey(id);
scheduleService.deleteSchedule(datasetTableTask);
dataSetTableTaskLogService.deleteByTaskId(id);
}
}
}
public void delete(DatasetTableTask task) {
datasetTableTaskMapper.deleteByPrimaryKey(task.getId());
scheduleService.deleteSchedule(task);