|
|
@@ -1,6 +1,8 @@
|
|
|
package cn.reghao.autodop.dmaster.app.controller.crud;
|
|
|
|
|
|
import cn.reghao.autodop.common.result.WebResult;
|
|
|
+import cn.reghao.autodop.dmaster.app.entity.BuildDir;
|
|
|
+import cn.reghao.autodop.dmaster.app.service.crud.build.BuildDirCrudService;
|
|
|
import cn.reghao.autodop.dmaster.common.db.PageList;
|
|
|
import cn.reghao.autodop.common.utils.serializer.JsonConverter;
|
|
|
import cn.reghao.autodop.dmaster.app.entity.config.build.tools.CompilerConfig;
|
|
|
@@ -24,18 +26,49 @@ import org.springframework.web.bind.annotation.*;
|
|
|
@RestController
|
|
|
@RequestMapping("/api/config/build")
|
|
|
public class BuildConfigCrudController {
|
|
|
+ private BuildDirCrudService buildDirCrudService;
|
|
|
private RepoConfigCrudService repoConfigCrudService;
|
|
|
private CompilerConfigCrudService compilerConfigCrudService;
|
|
|
private PackerConfigCrudService packerConfigCrudService;
|
|
|
|
|
|
- public BuildConfigCrudController(RepoConfigCrudService repoConfigCrudService,
|
|
|
+ public BuildConfigCrudController(BuildDirCrudService buildDirCrudService,
|
|
|
+ RepoConfigCrudService repoConfigCrudService,
|
|
|
CompilerConfigCrudService compilerConfigCrudService,
|
|
|
PackerConfigCrudService packerConfigCrudService) {
|
|
|
+ this.buildDirCrudService = buildDirCrudService;
|
|
|
this.repoConfigCrudService = repoConfigCrudService;
|
|
|
this.compilerConfigCrudService = compilerConfigCrudService;
|
|
|
this.packerConfigCrudService = packerConfigCrudService;
|
|
|
}
|
|
|
|
|
|
+ /* 构建目录配置 */
|
|
|
+ @ApiOperation(value = "添加本地目录配置")
|
|
|
+ @PostMapping(value = "/dir", consumes = "application/json")
|
|
|
+ public ResponseEntity<String> addLocalDir(@RequestBody String json) throws Exception {
|
|
|
+ return ResponseEntity.ok().body(WebResult.success("系统已自动创建..."));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "分页获取本地目录配置")
|
|
|
+ @GetMapping("/dir")
|
|
|
+ public ResponseEntity<String> getLocalDirByPage(@RequestParam("page") int page, @RequestParam("size") int size) {
|
|
|
+ PageList<BuildDir> pageList = buildDirCrudService.getByPage(page, size);
|
|
|
+ return ResponseEntity.ok().body(WebResult.success(pageList));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "修改本地目录配置")
|
|
|
+ @PutMapping("/dir")
|
|
|
+ public ResponseEntity<String> modifyLocalDir(@RequestBody String json) throws Exception {
|
|
|
+ BuildDir buildDir = (BuildDir) JsonConverter.jsonToObject(json, BuildDir.class);
|
|
|
+ buildDirCrudService.addOrUpdate(buildDir);
|
|
|
+ return ResponseEntity.ok().body(WebResult.success("ok"));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "删除本地目录配置")
|
|
|
+ @DeleteMapping("/dir/{uniqueKey}")
|
|
|
+ public ResponseEntity<String> deleteLocalDir(@PathVariable("uniqueKey") String uniqueKey) throws Exception {
|
|
|
+ return ResponseEntity.ok().body(WebResult.success("不允许删除..."));
|
|
|
+ }
|
|
|
+
|
|
|
/* 仓库配置 */
|
|
|
@ApiOperation(value = "添加仓库配置")
|
|
|
@PostMapping(value = "/repo", consumes = "application/json")
|
|
|
@@ -128,7 +161,4 @@ public class BuildConfigCrudController {
|
|
|
packerConfigCrudService.delete(uniqueKey);
|
|
|
return ResponseEntity.ok().body(WebResult.success("ok"));
|
|
|
}
|
|
|
-
|
|
|
- /* 构建目录配置 */
|
|
|
-
|
|
|
}
|