|
|
@ -9,6 +9,7 @@ import com.qyft.gd.service.TasksService; |
|
|
|
import com.qyft.gd.system.common.base.BasePageQuery; |
|
|
|
import com.qyft.gd.system.common.result.PageResult; |
|
|
|
import com.qyft.gd.system.common.result.Result; |
|
|
|
import com.qyft.gd.system.common.result.ResultCode; |
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
import io.swagger.v3.oas.annotations.Parameter; |
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
|
@ -37,9 +38,18 @@ public class TasksController { |
|
|
|
return Result.success(tasksService.selectById(id)); |
|
|
|
} |
|
|
|
|
|
|
|
@Operation(summary = "获取正在进行的实验") |
|
|
|
@GetMapping("/getIngTask") |
|
|
|
public Result<Tasks> getIngTask() { |
|
|
|
return Result.success(tasksService.getIngTask()); |
|
|
|
} |
|
|
|
|
|
|
|
@Operation(summary = "添加新实验") |
|
|
|
@PostMapping("/") |
|
|
|
public Result<Tasks> addTask(@RequestBody TaskDTO dto) { |
|
|
|
if (tasksService.getIngTask() != null) { |
|
|
|
return Result.failed("存在正在运行的实验,请先停止"); |
|
|
|
} |
|
|
|
return Result.success(tasksService.addTask(dto.getName())); |
|
|
|
} |
|
|
|
|
|
|
|