2025-05-17 17:13:44 +08:00
|
|
|
package cd.casic.server.controller;
|
|
|
|
|
|
|
|
import cd.casic.ci.common.pipeline.req.target.TargetManagerCreateReq;
|
|
|
|
import cd.casic.ci.common.pipeline.req.target.TargetManagerUpdateReq;
|
|
|
|
import cd.casic.ci.common.pipeline.req.target.TargetQueryReq;
|
|
|
|
import cd.casic.ci.common.pipeline.resp.target.TargetManagerResp;
|
|
|
|
import cd.casic.ci.common.pipeline.utils.PageResult;
|
|
|
|
import cd.casic.ci.process.process.dataObject.base.BaseIdReq;
|
2025-05-17 17:19:06 +08:00
|
|
|
import cd.casic.ci.process.process.dataObject.target.TargetVersion;
|
2025-05-17 17:13:44 +08:00
|
|
|
import cd.casic.ci.process.process.service.target.TargetManagerService;
|
|
|
|
import cd.casic.ci.process.process.service.target.TargetVersionService;
|
|
|
|
import cd.casic.framework.commons.pojo.CommonResult;
|
|
|
|
import jakarta.annotation.Resource;
|
|
|
|
import jakarta.validation.Valid;
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author HopeLi
|
|
|
|
* @version v1.0
|
|
|
|
* @ClassName TargetController
|
|
|
|
* @Date: 2025/5/17 10:15
|
|
|
|
* @Description:
|
|
|
|
*/
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
@RequestMapping("/target")
|
|
|
|
public class TargetController {
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
private TargetManagerService targetManagerService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
private TargetVersionService targetVersionService;
|
|
|
|
|
|
|
|
@PostMapping(value = "/createTarget")
|
|
|
|
public CommonResult<Void> createTarget(@RequestBody @Valid TargetManagerCreateReq req) {
|
|
|
|
|
|
|
|
targetManagerService.createTarget(req);
|
|
|
|
return CommonResult.success();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping(value = "/updateTarget")
|
|
|
|
public CommonResult<Void> updateTarget(@RequestBody @Valid TargetManagerUpdateReq req) {
|
|
|
|
|
|
|
|
targetManagerService.updateTarget(req);
|
|
|
|
return CommonResult.success();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping(value = "/deleteTarget")
|
|
|
|
public CommonResult<Void> deleteTarget(@RequestBody @Valid BaseIdReq req) {
|
|
|
|
|
|
|
|
targetManagerService.deleteTarget(req);
|
|
|
|
return CommonResult.success();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping(path="/findTargetPage")
|
|
|
|
public CommonResult<PageResult<TargetManagerResp>> findTargetPage(@RequestBody @NotNull @Valid TargetQueryReq query){
|
|
|
|
|
|
|
|
PageResult<TargetManagerResp> respPage = targetManagerService.findTargetPage(query);
|
|
|
|
|
|
|
|
return CommonResult.success(respPage);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping(path="/findTargetList")
|
|
|
|
public CommonResult<List<TargetManagerResp>> findTargetList(@RequestBody @Valid TargetQueryReq query){
|
|
|
|
|
|
|
|
List<TargetManagerResp> respList = targetManagerService.findTargetList(query);
|
|
|
|
|
|
|
|
return CommonResult.success(respList);
|
|
|
|
}
|
2025-05-17 17:19:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
@PostMapping(path="/selectListByManagerId")
|
|
|
|
public CommonResult<List<TargetVersion>> selectListByManagerId(@RequestBody @Valid BaseIdReq query){
|
|
|
|
|
|
|
|
List<TargetVersion> respList = targetVersionService.selectListByManagerId(query.getId());
|
|
|
|
|
|
|
|
return CommonResult.success(respList);
|
|
|
|
}
|
2025-05-17 17:13:44 +08:00
|
|
|
}
|