添加根据类型获取算法

This commit is contained in:
wanxiaoli 2026-03-11 16:00:42 +08:00
parent f7d113b71c
commit af36737867

View File

@ -34,6 +34,15 @@ public class AlgorithmController {
return algorithmService.getById(id); return algorithmService.getById(id);
} }
@GetMapping("/type/{type}")
@Operation(summary = "根据算法类型获取算法", description = "路径参数传入算法类型(如GPR),返回算法对象")
public Algorithm getAlgorithmByType(@PathVariable String type) {
QueryWrapper<Algorithm> qw = new QueryWrapper<>();
qw.eq("algorithm_type", type);
qw.last("LIMIT 1");
return algorithmService.getOne(qw);
}
@PostMapping @PostMapping
@Operation(summary = "新增算法", description = "请求体传入算法对象,返回是否新增成功") @Operation(summary = "新增算法", description = "请求体传入算法对象,返回是否新增成功")
public boolean createAlgorithm(@RequestBody Algorithm algorithm) { public boolean createAlgorithm(@RequestBody Algorithm algorithm) {