fix(sj_1.1.1): 批量删除参数校验
This commit is contained in:
parent
c8dda95bb3
commit
7b2d3838d4
@ -11,7 +11,6 @@ import com.aizuda.snailjob.server.web.model.response.JobResponseVO;
|
||||
import com.aizuda.snailjob.server.web.service.JobService;
|
||||
import com.aizuda.snailjob.server.web.util.ExportUtils;
|
||||
import com.aizuda.snailjob.server.web.util.ImportUtils;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
@ -75,7 +74,7 @@ public class JobController {
|
||||
|
||||
@DeleteMapping("/ids")
|
||||
@LoginRequired
|
||||
public Boolean deleteJobById(@RequestBody @Valid @NotEmpty(message = "ids不能为空") Set<Long> ids) {
|
||||
public Boolean deleteJobById(@RequestBody @NotEmpty(message = "ids不能为空") Set<Long> ids) {
|
||||
return jobService.deleteJobByIds(ids);
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import com.aizuda.snailjob.server.web.model.request.NotifyConfigQueryVO;
|
||||
import com.aizuda.snailjob.server.web.model.request.NotifyConfigRequestVO;
|
||||
import com.aizuda.snailjob.server.web.model.response.NotifyConfigResponseVO;
|
||||
import com.aizuda.snailjob.server.web.service.NotifyConfigService;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -57,7 +58,7 @@ public class NotifyConfigController {
|
||||
|
||||
@LoginRequired
|
||||
@DeleteMapping("ids")
|
||||
public Boolean batchDeleteNotify(@RequestBody Set<Long> ids) {
|
||||
public Boolean batchDeleteNotify(@RequestBody @NotEmpty(message = "ids不能为空") Set<Long> ids) {
|
||||
return notifyConfigService.batchDeleteNotify(ids);
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import com.aizuda.snailjob.server.web.model.response.NotifyRecipientResponseVO;
|
||||
import com.aizuda.snailjob.server.web.service.NotifyRecipientService;
|
||||
import com.aizuda.snailjob.server.web.util.ExportUtils;
|
||||
import com.aizuda.snailjob.server.web.util.ImportUtils;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@ -63,7 +64,7 @@ public class NotifyRecipientController {
|
||||
|
||||
@DeleteMapping("/ids")
|
||||
@LoginRequired
|
||||
public Boolean batchDeleteByIds(@RequestBody Set<Long> ids) {
|
||||
public Boolean batchDeleteByIds(@RequestBody @NotEmpty(message = "ids不能为空") Set<Long> ids) {
|
||||
return notifyRecipientService.batchDeleteByIds(ids);
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,6 @@ import com.aizuda.snailjob.server.web.model.request.RetryTaskLogQueryVO;
|
||||
import com.aizuda.snailjob.server.web.model.response.RetryTaskLogMessageResponseVO;
|
||||
import com.aizuda.snailjob.server.web.model.response.RetryTaskLogResponseVO;
|
||||
import com.aizuda.snailjob.server.web.service.RetryTaskLogService;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -54,7 +53,7 @@ public class RetryTaskLogController {
|
||||
|
||||
@LoginRequired
|
||||
@DeleteMapping("ids")
|
||||
public Boolean batchDelete(@RequestBody @Valid @NotEmpty(message = "ids不能为空") Set<Long> ids) {
|
||||
public Boolean batchDelete(@RequestBody @NotEmpty(message = "ids不能为空") Set<Long> ids) {
|
||||
return retryTaskLogService.batchDelete(ids);
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import com.aizuda.snailjob.server.web.model.response.SceneConfigResponseVO;
|
||||
import com.aizuda.snailjob.server.web.service.SceneConfigService;
|
||||
import com.aizuda.snailjob.server.web.util.ExportUtils;
|
||||
import com.aizuda.snailjob.server.web.util.ImportUtils;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.MediaType;
|
||||
@ -87,7 +86,7 @@ public class SceneConfigController {
|
||||
|
||||
@LoginRequired
|
||||
@DeleteMapping("/ids")
|
||||
public boolean deleteByIds(@RequestBody @Valid @NotEmpty(message = "ids不能为空") Set<Long> ids) {
|
||||
public boolean deleteByIds(@RequestBody @NotEmpty(message = "ids不能为空") Set<Long> ids) {
|
||||
return sceneConfigService.deleteByIds(ids);
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import com.aizuda.snailjob.server.web.model.request.WorkflowBatchQueryVO;
|
||||
import com.aizuda.snailjob.server.web.model.response.WorkflowBatchResponseVO;
|
||||
import com.aizuda.snailjob.server.web.model.response.WorkflowDetailResponseVO;
|
||||
import com.aizuda.snailjob.server.web.service.WorkflowBatchService;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -47,9 +46,9 @@ public class WorkflowBatchController {
|
||||
|
||||
@DeleteMapping("/ids")
|
||||
@LoginRequired(role = RoleEnum.USER)
|
||||
public Boolean deleteByIds(@RequestBody @Valid
|
||||
public Boolean deleteByIds(@RequestBody
|
||||
@NotEmpty(message = "ids不能为空")
|
||||
@Size(max = 100, message = "最多删除5个")
|
||||
@Size(max = 100, message = "最多删除 {max} 个")
|
||||
Set<Long> ids) {
|
||||
return workflowBatchService.deleteByIds(ids);
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package com.aizuda.snailjob.server.web.controller;
|
||||
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import com.aizuda.snailjob.common.core.annotation.OriginalControllerReturnValue;
|
||||
import com.aizuda.snailjob.server.common.dto.DecisionConfig;
|
||||
import com.aizuda.snailjob.server.web.annotation.LoginRequired;
|
||||
import com.aizuda.snailjob.server.web.annotation.RoleEnum;
|
||||
import com.aizuda.snailjob.server.web.model.base.PageResult;
|
||||
@ -15,7 +14,6 @@ import com.aizuda.snailjob.server.web.model.response.WorkflowResponseVO;
|
||||
import com.aizuda.snailjob.server.web.service.WorkflowService;
|
||||
import com.aizuda.snailjob.server.web.util.ExportUtils;
|
||||
import com.aizuda.snailjob.server.web.util.ImportUtils;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.MediaType;
|
||||
@ -72,7 +70,7 @@ public class WorkflowController {
|
||||
|
||||
@DeleteMapping("/ids")
|
||||
@LoginRequired(role = RoleEnum.USER)
|
||||
public Boolean deleteByIds(@RequestBody @Valid @NotEmpty(message = "ids不能为空") Set<Long> ids) {
|
||||
public Boolean deleteByIds(@RequestBody @NotEmpty(message = "ids不能为空") Set<Long> ids) {
|
||||
return workflowService.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
@ -233,11 +233,10 @@ public class WorkflowBatchServiceImpl implements WorkflowBatchService {
|
||||
public Boolean deleteByIds(Set<Long> ids) {
|
||||
String namespaceId = UserSessionUtils.currentUserSession().getNamespaceId();
|
||||
|
||||
Assert.isTrue(ids.size() == workflowTaskBatchMapper.delete(
|
||||
new LambdaQueryWrapper<WorkflowTaskBatch>()
|
||||
Assert.isTrue(ids.size() == workflowTaskBatchMapper.delete(new LambdaQueryWrapper<WorkflowTaskBatch>()
|
||||
.eq(WorkflowTaskBatch::getNamespaceId, namespaceId)
|
||||
.in(WorkflowTaskBatch::getId, ids)
|
||||
), () -> new SnailJobServerException("删除工作流任务失败, 请检查任务状态是否关闭状态"));
|
||||
.in(WorkflowTaskBatch::getId, ids)),
|
||||
() -> new SnailJobServerException("删除工作流任务失败, 请检查任务状态是否关闭状态"));
|
||||
|
||||
List<JobTaskBatch> jobTaskBatches = jobTaskBatchMapper.selectList(new LambdaQueryWrapper<JobTaskBatch>()
|
||||
.eq(JobTaskBatch::getNamespaceId, namespaceId)
|
||||
|
Loading…
Reference in New Issue
Block a user