Browse Source

修改workflow删除报错,copy流水线加-copy

tags/v20240126
fans 2 years ago
parent
commit
73a747845e
3 changed files with 7 additions and 7 deletions
  1. +1
    -1
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/workflow/WorkflowController.java
  2. +1
    -1
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/WorkflowService.java
  3. +5
    -5
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/WorkflowServiceImpl.java

+ 1
- 1
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/workflow/WorkflowController.java View File

@@ -129,7 +129,7 @@ public class WorkflowController {
*/
@DeleteMapping("{id}")
@ApiOperation("删除流水线")
public AjaxResult deleteById(@PathVariable("id") Long id) {
public AjaxResult deleteById(@PathVariable("id") Long id) throws Exception {
return AjaxResult.success(this.workflowService.removeById(id));
}



+ 1
- 1
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/WorkflowService.java View File

@@ -52,7 +52,7 @@ public interface WorkflowService {
* @return 是否成功
*/
boolean deleteById(Long id);
String removeById(Long id);
String removeById(Long id) throws Exception;
/**
* 按流水线名字模糊分页查询
*


+ 5
- 5
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/WorkflowServiceImpl.java View File

@@ -107,7 +107,7 @@ public class WorkflowServiceImpl implements WorkflowService {
return this.workflowDao.deleteById(id) > 0;
}
@Override
public String removeById(Long id) {
public String removeById(Long id) throws Exception {
//先根据id提取出对应的流水线
Workflow workflow = workflowDao.queryById(id);

@@ -116,16 +116,16 @@ public class WorkflowServiceImpl implements WorkflowService {
String username = loginUser.getUsername();
String createdBy = workflow.getCreateBy();
if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){
return "无权限删除该流水线";
throw new Exception("无权限删除该流水线");
}

if (workflow == null){
return "流水线不存在";
throw new Exception("流水线不存在");
}
//判断这个流水线是否有相关实验存在
List<Experiment> experimentList = experimentService.queryByWorkflowId(id);
if (experimentList!=null&&experimentList.size()>0){
return "该流水线存在实验,无法删除";
throw new Exception("该流水线存在实验,无法删除");
}
workflow.setState(0);
return this.workflowDao.update(workflow)>0?"删除成功":"删除失败";
@@ -143,7 +143,7 @@ public class WorkflowServiceImpl implements WorkflowService {
Workflow workflow = this.queryById(id);
if (workflow!= null) {
Workflow duplicateWorkflow = new Workflow();
duplicateWorkflow.setName(workflow.getName());
duplicateWorkflow.setName(workflow.getName()+"-copy");
duplicateWorkflow.setDag(workflow.getDag());
duplicateWorkflow.setDescription(workflow.getDescription());
return this.insert(duplicateWorkflow);


Loading…
Cancel
Save