Browse Source

controller格式返回

pull/7/head
西大锐 1 year ago
parent
commit
abb485b2c1
11 changed files with 228 additions and 212 deletions
  1. +27
    -24
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/dataset/DatasetVersionController.java
  2. +13
    -12
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/experiment/ExperimentController.java
  3. +27
    -26
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/experiment/ExperimentInsController.java
  4. +20
    -20
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/icon/AssetIconController.java
  5. +30
    -33
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/image/ImageController.java
  6. +15
    -16
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/image/ImageVersionController.java
  7. +10
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/WorkflowParam.java
  8. +4
    -4
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/WorkflowParamDao.java
  9. +2
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java
  10. +1
    -1
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/WorkflowParamServiceImpl.java
  11. +79
    -76
      ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/WorkflowParamDaoMapper.xml

+ 27
- 24
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/dataset/DatasetVersionController.java View File

@@ -1,14 +1,17 @@
package com.ruoyi.platform.controller.dataset;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.GenericsAjaxResult;
import com.ruoyi.platform.domain.DatasetVersion;
import com.ruoyi.platform.service.DatasetVersionService;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
* (DatasetVersion)表控制层
@@ -19,7 +22,7 @@ import java.util.List;
@RestController
@RequestMapping("datasetVersion")
@ApiOperation(value = "数据集版本管理")
public class DatasetVersionController {
public class DatasetVersionController extends BaseController {
/**
* 服务对象
*/
@@ -30,15 +33,15 @@ public class DatasetVersionController {
* 分页查询
*
* @param datasetVersion 筛选条件
* @param page 页数
* @param size 大小
* @param page 页数
* @param size 大小
* @return 查询结果
*/
@GetMapping
@ApiOperation("分页查询")
public AjaxResult queryByPage(DatasetVersion datasetVersion, int page,int size) {
public GenericsAjaxResult<Page<DatasetVersion>> queryByPage(DatasetVersion datasetVersion, int page, int size) {
PageRequest pageRequest = PageRequest.of(page,size);
return AjaxResult.success(this.datasetVersionService.queryByPage(datasetVersion, pageRequest));
return genericsSuccess(this.datasetVersionService.queryByPage(datasetVersion, pageRequest));
}


@@ -50,22 +53,22 @@ public class DatasetVersionController {
*/
@GetMapping("{id}")
@ApiOperation("根据id查询数据集版本")
public AjaxResult queryById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.datasetVersionService.queryById(id));
public GenericsAjaxResult<DatasetVersion> queryById(@PathVariable("id") Integer id) {
return genericsSuccess(this.datasetVersionService.queryById(id));
}

/**
* 通过数据集id和version查询版本列表
*
* @param datasetId 数据集ID
* @param version 数据集版本
* @param version 数据集版本
* @return 匹配的数据集版本记录列表
*/
@GetMapping("/versions")
@ApiOperation("通过数据集id和version查询版本文件列表")
public AjaxResult queryByDatasetIdAndVersion(@RequestParam("dataset_id") Integer datasetId,
@RequestParam("version") String version) {
return AjaxResult.success(this.datasetVersionService.queryByDatasetIdAndVersion(datasetId, version));
public GenericsAjaxResult<List<DatasetVersion>> queryByDatasetIdAndVersion(@RequestParam("dataset_id") Integer datasetId,
@RequestParam("version") String version) {
return genericsSuccess(this.datasetVersionService.queryByDatasetIdAndVersion(datasetId, version));
}


@@ -77,8 +80,8 @@ public class DatasetVersionController {
*/
@PostMapping
@ApiOperation("添加数据集版本")
public AjaxResult add(@RequestBody DatasetVersion datasetVersion) throws Exception {
return AjaxResult.success(this.datasetVersionService.insert(datasetVersion));
public GenericsAjaxResult<DatasetVersion> add(@RequestBody DatasetVersion datasetVersion) throws Exception {
return genericsSuccess(this.datasetVersionService.insert(datasetVersion));
}

/**
@@ -89,8 +92,8 @@ public class DatasetVersionController {
*/
@PostMapping("/addDatasetVersions")
@ApiOperation("添加数据集版本")
public AjaxResult addDatasetVersions(@RequestBody List<DatasetVersion> datasetVersions) throws Exception {
return AjaxResult.success(this.datasetVersionService.addDatasetVersions(datasetVersions));
public GenericsAjaxResult<String> addDatasetVersions(@RequestBody List<DatasetVersion> datasetVersions) throws Exception {
return genericsSuccess(this.datasetVersionService.addDatasetVersions(datasetVersions));
}


@@ -102,8 +105,8 @@ public class DatasetVersionController {
*/
@PutMapping
@ApiOperation("编辑数据集版本")
public AjaxResult edit(@RequestBody DatasetVersion datasetVersion) {
return AjaxResult.success(this.datasetVersionService.update(datasetVersion));
public GenericsAjaxResult<DatasetVersion> edit(@RequestBody DatasetVersion datasetVersion) {
return genericsSuccess(this.datasetVersionService.update(datasetVersion));
}

/**
@@ -114,22 +117,22 @@ public class DatasetVersionController {
*/
@DeleteMapping({"{id}"})
@ApiOperation("删除数据集版本")
public AjaxResult deleteById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.datasetVersionService.removeById(id));
public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) {
return genericsSuccess(this.datasetVersionService.removeById(id));
}

/**
* 删除版本下的所有数据
*
* @param datasetId 模型主键
* @param version 版本
* @param version 版本
* @return 删除是否成功
*/
@DeleteMapping("/deleteVersion")
@ApiOperation(value = "逻辑删除模型版本", notes = "根据数据集ID和版本逻辑删除模型版本记录。")
public AjaxResult deleteDatasetVersion(@RequestParam("dataset_id") Integer datasetId,
@RequestParam("version") String version) {
return AjaxResult.success(this.datasetVersionService.deleteDatasetVersion(datasetId, version));
public GenericsAjaxResult<Map<Integer, String>> deleteDatasetVersion(@RequestParam("dataset_id") Integer datasetId,
@RequestParam("version") String version) {
return genericsSuccess(this.datasetVersionService.deleteDatasetVersion(datasetId, version));
}

}


+ 13
- 12
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/experiment/ExperimentController.java View File

@@ -47,13 +47,14 @@ public class ExperimentController extends BaseController {

@GetMapping(("/status"))
@ApiOperation("查询实验状态")
public AjaxResult selectStatus(@RequestBody Experiment experiment, PageRequest pageRequest) throws IOException {
return AjaxResult.success(this.experimentService.selectStatus(experiment, pageRequest));
public GenericsAjaxResult<Page<Experiment>> selectStatus(@RequestBody Experiment experiment, PageRequest pageRequest) throws IOException {
return genericsSuccess(this.experimentService.selectStatus(experiment, pageRequest));
}



@GetMapping(("/configuration"))
@ApiOperation("查询实验配置")
public GenericsAjaxResult<ResponseEntity<Experiment>> showExperimentConfig(@RequestBody Experiment experiment){
return genericsSuccess(this.experimentService.showExperimentConfig(experiment));
}
@@ -78,8 +79,8 @@ public class ExperimentController extends BaseController {
*/
@PostMapping
@ApiOperation("新增实验")
public AjaxResult add(@RequestBody Experiment experiment) {
return AjaxResult.success(this.experimentService.insert(experiment));
public GenericsAjaxResult<Experiment> add(@RequestBody Experiment experiment) {
return genericsSuccess(this.experimentService.insert(experiment));
}

/**
@@ -90,8 +91,8 @@ public class ExperimentController extends BaseController {
*/
@PutMapping
@ApiOperation("编辑实验")
public AjaxResult edit(@RequestBody Experiment experiment) throws IOException {
return AjaxResult.success(this.experimentService.update(experiment));
public GenericsAjaxResult<Experiment> edit(@RequestBody Experiment experiment) throws IOException {
return genericsSuccess(this.experimentService.update(experiment));
}

/**
@@ -102,8 +103,8 @@ public class ExperimentController extends BaseController {
*/
@DeleteMapping("{id}")
@ApiOperation("删除流水线")
public AjaxResult deleteById(@PathVariable("id") Integer id) throws Exception {
return AjaxResult.success(this.experimentService.removeById(id));
public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) throws Exception {
return genericsSuccess(this.experimentService.removeById(id));
}


@@ -118,8 +119,8 @@ public class ExperimentController extends BaseController {
*/
@PutMapping("/experiments/{id}")
@ApiOperation("运行实验")
public AjaxResult runExperiment(@PathVariable("id") Integer id) throws Exception {
return AjaxResult.success(this.experimentService.runExperiment(id));
public GenericsAjaxResult<Experiment> runExperiment(@PathVariable("id") Integer id) throws Exception {
return genericsSuccess(this.experimentService.runExperiment(id));
}

/**
@@ -130,8 +131,8 @@ public class ExperimentController extends BaseController {
*/
@PostMapping("/addAndRunExperiment")
@ApiOperation("实验创建页面确定并运行")
public AjaxResult addAndRunExperiment(@RequestBody Experiment experiment) {
return AjaxResult.success(this.experimentService.addAndRunExperiment(experiment));
public GenericsAjaxResult<Experiment> addAndRunExperiment(@RequestBody Experiment experiment) {
return genericsSuccess(this.experimentService.addAndRunExperiment(experiment));
}
}


+ 27
- 26
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/experiment/ExperimentInsController.java View File

@@ -1,18 +1,19 @@
package com.ruoyi.platform.controller.experiment;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.GenericsAjaxResult;
import com.ruoyi.platform.domain.ExperimentIns;
import com.ruoyi.platform.service.ExperimentInsService;
import com.ruoyi.platform.vo.LogRequestVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.ws.rs.POST;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
@@ -24,7 +25,7 @@ import java.util.Map;
@RestController
@RequestMapping("experimentIns")
@Api("实验实例管理")
public class ExperimentInsController {
public class ExperimentInsController extends BaseController {
/**
* 服务对象
*/
@@ -39,9 +40,9 @@ public class ExperimentInsController {
*/
@GetMapping
@ApiOperation("分页查询")
public AjaxResult queryByPage(ExperimentIns experimentIns, int page, int size) throws IOException {
public GenericsAjaxResult<Page<ExperimentIns>> queryByPage(ExperimentIns experimentIns, int page, int size) throws IOException {
PageRequest pageRequest = PageRequest.of(page,size);
return AjaxResult.success(this.experimentInsService.queryByPage(experimentIns, pageRequest));
return genericsSuccess(this.experimentInsService.queryByPage(experimentIns, pageRequest));
}

/**
@@ -52,8 +53,8 @@ public class ExperimentInsController {
*/
@GetMapping("{id}")
@ApiOperation("通过id查询实验实例")
public AjaxResult queryById(@PathVariable("id") Integer id) throws IOException {
return AjaxResult.success(this.experimentInsService.queryById(id));
public GenericsAjaxResult<ExperimentIns> queryById(@PathVariable("id") Integer id) throws IOException {
return genericsSuccess(this.experimentInsService.queryById(id));
}

/**
@@ -64,8 +65,8 @@ public class ExperimentInsController {
*/
@GetMapping("/queryByExperimentId/{Experiment_id}")
@ApiOperation("通过实验id查询查询实验实例列表")
public AjaxResult queryByExperimentId(@PathVariable("Experiment_id") Integer experimentId) throws IOException {
return AjaxResult.success(this.experimentInsService.getByExperimentId(experimentId));
public GenericsAjaxResult<List<ExperimentIns>> queryByExperimentId(@PathVariable("Experiment_id") Integer experimentId) throws IOException {
return genericsSuccess(this.experimentInsService.getByExperimentId(experimentId));
}

/**
@@ -76,8 +77,8 @@ public class ExperimentInsController {
*/
@PostMapping
@ApiOperation("新增实验实例")
public AjaxResult add(@RequestBody ExperimentIns experimentIns) {
return AjaxResult.success(this.experimentInsService.insert(experimentIns));
public GenericsAjaxResult<ExperimentIns> add(@RequestBody ExperimentIns experimentIns) {
return genericsSuccess(this.experimentInsService.insert(experimentIns));
}

/**
@@ -88,8 +89,8 @@ public class ExperimentInsController {
*/
@PutMapping
@ApiOperation("编辑实验实例")
public AjaxResult edit(@RequestBody ExperimentIns experimentIns) throws IOException {
return AjaxResult.success(this.experimentInsService.update(experimentIns));
public GenericsAjaxResult<ExperimentIns> edit(@RequestBody ExperimentIns experimentIns) throws IOException {
return genericsSuccess(this.experimentInsService.update(experimentIns));
}

/**
@@ -100,8 +101,8 @@ public class ExperimentInsController {
*/
@DeleteMapping("{id}")
@ApiOperation("删除实验实例")
public AjaxResult deleteById( @PathVariable("id") Integer id) {
return AjaxResult.success(this.experimentInsService.removeById(id));
public GenericsAjaxResult<String> deleteById( @PathVariable("id") Integer id) {
return genericsSuccess(this.experimentInsService.removeById(id));
}

/**
@@ -112,8 +113,8 @@ public class ExperimentInsController {
*/
@PutMapping("{id}")
@ApiOperation("终止实验实例")
public AjaxResult terminateExperimentIns(@PathVariable("id") Integer id) {
return AjaxResult.success(this.experimentInsService.terminateExperimentIns(id));
public GenericsAjaxResult<Boolean> terminateExperimentIns(@PathVariable("id") Integer id) {
return genericsSuccess(this.experimentInsService.terminateExperimentIns(id));
}

/**
@@ -124,9 +125,9 @@ public class ExperimentInsController {

@GetMapping("/log")
@ApiOperation("查询实例日志")
public AjaxResult showExperimentInsLog(@RequestParam("id") Integer id,
public GenericsAjaxResult<String> showExperimentInsLog(@RequestParam("id") Integer id,
@RequestParam("component_id") String componentId){
return AjaxResult.success(this.experimentInsService.showExperimentInsLog(id,componentId));
return genericsSuccess(this.experimentInsService.showExperimentInsLog(id,componentId));
}

/**
@@ -137,9 +138,9 @@ public class ExperimentInsController {

@GetMapping("/pods/log")
@ApiOperation("获取pod实时日志请求")
public AjaxResult getRealtimePodLog(@RequestParam("pod_name") String podName,
public GenericsAjaxResult<Map> getRealtimePodLog(@RequestParam("pod_name") String podName,
@RequestParam("start_time") String startTime){
return AjaxResult.success(this.experimentInsService.getRealtimePodLog(podName,startTime));
return genericsSuccess(this.experimentInsService.getRealtimePodLog(podName,startTime));
}

/**
@@ -150,8 +151,8 @@ public class ExperimentInsController {

@PostMapping("/realTimeLog")
@ApiOperation("查询实验实例实时日志")
public AjaxResult getRealtimeWorkflowLog(@RequestBody LogRequestVo logRequest){
return AjaxResult.success(this.experimentInsService.getRealtimeWorkflowLog(logRequest));
public GenericsAjaxResult<Map<String, Object>> getRealtimeWorkflowLog(@RequestBody LogRequestVo logRequest){
return genericsSuccess(this.experimentInsService.getRealtimeWorkflowLog(logRequest));
}


@@ -165,8 +166,8 @@ public class ExperimentInsController {
*/
@GetMapping("/nodeResult")
@ApiOperation("查询实例节点结果")
public AjaxResult getNodeResult(@RequestParam("id") Integer id,@RequestParam("node_id") String nodeId) throws Exception {
return AjaxResult.success(this.experimentInsService.getNodeResult(id,nodeId));
public GenericsAjaxResult<List> getNodeResult(@RequestParam("id") Integer id, @RequestParam("node_id") String nodeId) throws Exception {
return genericsSuccess(this.experimentInsService.getNodeResult(id,nodeId));
}

}


+ 20
- 20
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/icon/AssetIconController.java View File

@@ -1,17 +1,17 @@
package com.ruoyi.platform.controller.icon;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.GenericsAjaxResult;
import com.ruoyi.platform.domain.AssetIcon;
import com.ruoyi.platform.domain.Models;
import com.ruoyi.platform.service.AssetIconService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
* (AssetIcon)表控制层
@@ -22,7 +22,7 @@ import javax.annotation.Resource;
@RestController
@RequestMapping("assetIcon")
@Api("图标管理")
public class AssetIconController {
public class AssetIconController extends BaseController {
/**
* 服务对象
*/
@@ -33,15 +33,15 @@ public class AssetIconController {
* 分页查询
*
* @param assetIcon 筛选条件
* @param page 分页对象
* @param size 分页对象
* @param page 分页对象
* @param size 分页对象
* @return 查询结果
*/
@GetMapping
@ApiOperation("分页查询")
public AjaxResult queryByPage(AssetIcon assetIcon, int page, int size) {
public GenericsAjaxResult<Page<AssetIcon>> queryByPage(AssetIcon assetIcon, int page, int size) {
PageRequest pageRequest = PageRequest.of(page,size);
return AjaxResult.success(this.assetIconService.queryByPage(assetIcon, pageRequest));
return genericsSuccess(this.assetIconService.queryByPage(assetIcon, pageRequest));
}

/**
@@ -52,8 +52,8 @@ public class AssetIconController {
*/
@GetMapping("{id}")
@ApiOperation("根据id查询")
public AjaxResult queryById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.assetIconService.queryById(id));
public GenericsAjaxResult<AssetIcon> queryById(@PathVariable("id") Integer id) {
return genericsSuccess(this.assetIconService.queryById(id));
}

/**
@@ -64,8 +64,8 @@ public class AssetIconController {
*/
@GetMapping("category/{id}")
@ApiOperation("根据图标类别id查询")
public AjaxResult queryByCategoryId(@PathVariable("id") Integer categoryId) {
return AjaxResult.success(this.assetIconService.queryByCategoryId(categoryId));
public GenericsAjaxResult<List<AssetIcon>> queryByCategoryId(@PathVariable("id") Integer categoryId) {
return genericsSuccess(this.assetIconService.queryByCategoryId(categoryId));


}
@@ -78,8 +78,8 @@ public class AssetIconController {
*/
@GetMapping("name/{name}")
@ApiOperation("按名字模糊查询图标名字")
public AjaxResult queryByName(@PathVariable("name") String name) {
return AjaxResult.success(this.assetIconService.queryByName(name));
public GenericsAjaxResult<List<AssetIcon>> queryByName(@PathVariable("name") String name) {
return genericsSuccess(this.assetIconService.queryByName(name));
}

/**
@@ -90,8 +90,8 @@ public class AssetIconController {
*/
@PostMapping
@ApiOperation("新增图标")
public AjaxResult add(@RequestBody AssetIcon assetIcon) {
return AjaxResult.success(this.assetIconService.insert(assetIcon));
public GenericsAjaxResult<AssetIcon> add(@RequestBody AssetIcon assetIcon) {
return genericsSuccess(this.assetIconService.insert(assetIcon));
}

/**
@@ -102,8 +102,8 @@ public class AssetIconController {
*/
@PutMapping
@ApiOperation("更新图标")
public AjaxResult edit(@RequestBody AssetIcon assetIcon) {
return AjaxResult.success(this.assetIconService.update(assetIcon));
public GenericsAjaxResult<AssetIcon> edit(@RequestBody AssetIcon assetIcon) {
return genericsSuccess(this.assetIconService.update(assetIcon));
}

/**
@@ -114,8 +114,8 @@ public class AssetIconController {
*/
@DeleteMapping("{id}")
@ApiOperation("删除图标")
public AjaxResult deleteById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.assetIconService.removeById(id));
public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) {
return genericsSuccess(this.assetIconService.removeById(id));
}

}


+ 30
- 33
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/image/ImageController.java View File

@@ -1,20 +1,19 @@
package com.ruoyi.platform.controller.image;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.GenericsAjaxResult;
import com.ruoyi.platform.domain.Image;
import com.ruoyi.platform.domain.Models;
import com.ruoyi.platform.service.ImageService;
import com.ruoyi.platform.vo.DatasetVo;
import com.ruoyi.platform.vo.ImageVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.Map;

/**
* (Image)表控制层
@@ -25,7 +24,7 @@ import javax.annotation.Resource;
@RestController
@RequestMapping("image")
@Api("镜像管理")
public class ImageController {
public class ImageController extends BaseController {
/**
* 服务对象
*/
@@ -36,15 +35,15 @@ public class ImageController {
* 分页查询
*
* @param image 筛选条件
* @param page 分页对象
* @param size 分页对象
* @param page 分页对象
* @param size 分页对象
* @return 查询结果
*/
@GetMapping
@ApiOperation("分页查询")
public AjaxResult queryByPage(Image image, int page, int size) {
public GenericsAjaxResult<Page<Image>> queryByPage(Image image, int page, int size) {
PageRequest pageRequest = PageRequest.of(page,size);
return AjaxResult.success(this.imageService.queryByPage(image, pageRequest));
return genericsSuccess(this.imageService.queryByPage(image, pageRequest));
}

/**
@@ -55,8 +54,8 @@ public class ImageController {
*/
@GetMapping("{id}")
@ApiOperation("按id查询镜像")
public AjaxResult queryById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.imageService.queryById(id));
public GenericsAjaxResult<Image> queryById(@PathVariable("id") Integer id) {
return genericsSuccess(this.imageService.queryById(id));
}

/**
@@ -67,8 +66,8 @@ public class ImageController {
*/
@GetMapping("name/{name}")
@ApiOperation("按名字模糊查询镜像")
public AjaxResult queryByName(@PathVariable("name") String name) {
return AjaxResult.success(this.imageService.queryByName(name));
public GenericsAjaxResult<Page<Image>> queryByName(@PathVariable("name") String name) {
return genericsSuccess(this.imageService.queryByName(name));
}
/**
* 新增数据
@@ -78,8 +77,8 @@ public class ImageController {
*/
@PostMapping
@ApiOperation("新增镜像")
public AjaxResult add(@RequestBody Image image) {
return AjaxResult.success(this.imageService.insert(image));
public GenericsAjaxResult<Image> add(@RequestBody Image image) {
return genericsSuccess(this.imageService.insert(image));
}

/**
@@ -90,8 +89,8 @@ public class ImageController {
*/
@PostMapping("/addImageAndVersion")
@ApiOperation("添加镜像和版本")
public AjaxResult addImageAndVersion(@RequestBody ImageVo imageVo) throws Exception {
return AjaxResult.success(this.imageService.insertImageAndVersion(imageVo));
public GenericsAjaxResult<String> addImageAndVersion(@RequestBody ImageVo imageVo) throws Exception {
return genericsSuccess(this.imageService.insertImageAndVersion(imageVo));

}

@@ -102,36 +101,35 @@ public class ImageController {
* @return 编辑结果
*/
@PutMapping
public AjaxResult edit(@RequestBody Image image) {
return AjaxResult.success(this.imageService.update(image));
public GenericsAjaxResult<Image> edit(@RequestBody Image image) {
return genericsSuccess(this.imageService.update(image));
}

/**
* 删除数据
*
* @param id 主键
*
* @return 删除是否成功
*/
@DeleteMapping("{id}")
public AjaxResult deleteById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.imageService.removeById(id));
public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) {
return genericsSuccess(this.imageService.removeById(id));
}

@PostMapping("/net")
@ApiOperation("从本地上传构建镜像")
public AjaxResult createImageFromNet(@RequestParam("name") String imageName,
@RequestParam("tag") String imageTag,
@RequestParam("path") String path) throws Exception {
return AjaxResult.success(this.imageService.createImageFromNet(imageName,imageTag,path));
public GenericsAjaxResult<String> createImageFromNet(@RequestParam("name") String imageName,
@RequestParam("tag") String imageTag,
@RequestParam("path") String path) throws Exception {
return genericsSuccess(this.imageService.createImageFromNet(imageName,imageTag,path));
}

@PostMapping("/local")
@ApiOperation("从本地上传构建镜像")
public AjaxResult createImageFromLocal(@RequestParam("name") String imageName,
@RequestParam("tag") String imageTag,
@RequestParam("path") String path) throws Exception {
return AjaxResult.success(this.imageService.createImageFromLocal(imageName,imageTag,path));
public GenericsAjaxResult<String> createImageFromLocal(@RequestParam("name") String imageName,
@RequestParam("tag") String imageTag,
@RequestParam("path") String path) throws Exception {
return genericsSuccess(this.imageService.createImageFromLocal(imageName,imageTag,path));
}


@@ -139,13 +137,12 @@ public class ImageController {
/**
* 镜像上传
*
*
* @return 上传结果
*/
@PostMapping("/upload")
@ApiOperation(value = "上传镜像文件", notes = "上传镜像tar包,返回存储路径")
public AjaxResult uploadImageFiles(@RequestParam("file") MultipartFile file) throws Exception {
return AjaxResult.success(this.imageService.uploadImageFiles(file));
public GenericsAjaxResult<Map<String, String>> uploadImageFiles(@RequestParam("file") MultipartFile file) throws Exception {
return genericsSuccess(this.imageService.uploadImageFiles(file));
}

}


+ 15
- 16
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/image/ImageVersionController.java View File

@@ -1,13 +1,12 @@
package com.ruoyi.platform.controller.image;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.platform.domain.Image;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.GenericsAjaxResult;
import com.ruoyi.platform.domain.ImageVersion;
import com.ruoyi.platform.service.ImageVersionService;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
@@ -20,7 +19,7 @@ import javax.annotation.Resource;
*/
@RestController
@RequestMapping("imageVersion")
public class ImageVersionController {
public class ImageVersionController extends BaseController {
/**
* 服务对象
*/
@@ -31,15 +30,15 @@ public class ImageVersionController {
* 分页查询
*
* @param imageVersion 筛选条件
* @param page 分页对象
* @param size 分页对象
* @param page 分页对象
* @param size 分页对象
* @return 查询结果
*/
@GetMapping
@ApiOperation("分页查询")
public AjaxResult queryByPage(ImageVersion imageVersion, int page, int size) {
public GenericsAjaxResult<Page<ImageVersion>> queryByPage(ImageVersion imageVersion, int page, int size) {
PageRequest pageRequest = PageRequest.of(page,size);
return AjaxResult.success(this.imageVersionService.queryByPage(imageVersion, pageRequest));
return genericsSuccess(this.imageVersionService.queryByPage(imageVersion, pageRequest));
}

/**
@@ -49,8 +48,8 @@ public class ImageVersionController {
* @return 单条数据
*/
@GetMapping("{id}")
public AjaxResult queryById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.imageVersionService.queryById(id));
public GenericsAjaxResult<ImageVersion> queryById(@PathVariable("id") Integer id) {
return genericsSuccess(this.imageVersionService.queryById(id));
}

/**
@@ -60,8 +59,8 @@ public class ImageVersionController {
* @return 新增结果
*/
@PostMapping
public AjaxResult add(@RequestBody ImageVersion imageVersion) {
return AjaxResult.success(this.imageVersionService.insert(imageVersion));
public GenericsAjaxResult<ImageVersion> add(@RequestBody ImageVersion imageVersion) {
return genericsSuccess(this.imageVersionService.insert(imageVersion));
}

/**
@@ -71,8 +70,8 @@ public class ImageVersionController {
* @return 编辑结果
*/
@PutMapping
public AjaxResult edit(@RequestBody ImageVersion imageVersion) {
return AjaxResult.success(this.imageVersionService.update(imageVersion));
public GenericsAjaxResult<ImageVersion> edit(@RequestBody ImageVersion imageVersion) {
return genericsSuccess(this.imageVersionService.update(imageVersion));
}

/**
@@ -82,8 +81,8 @@ public class ImageVersionController {
* @return 删除是否成功
*/
@DeleteMapping("{id}")
public AjaxResult deleteById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.imageVersionService.removeById(id));
public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) {
return genericsSuccess(this.imageVersionService.removeById(id));
}

}


+ 10
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/WorkflowParam.java View File

@@ -3,6 +3,7 @@ package com.ruoyi.platform.domain;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.Date;
import java.io.Serializable;
@@ -20,30 +21,39 @@ public class WorkflowParam implements Serializable {
/**
* 主键
*/
@ApiModelProperty(name = "id")
private Integer id;
/**
* 流水线id
*/
@ApiModelProperty(value = "对应流水线id",required = true)
private Long workflowId;
/**
* 参数名称
*/
@ApiModelProperty(value = "参数名称",required = true)
private String paramName;
/**
* 参数描述
*/

@ApiModelProperty(value = "参数描述",required = true)
private String description;
/**
* 参数类型,1字符串,2整形,3布尔型
*/

@ApiModelProperty(value = "参数类型",required = true)
private Integer paramType;
/**
* 参数的值
*/
@ApiModelProperty(value = "参数的值",required = true)
private String paramValue;
/**
* 0失效,1生效
*/
@ApiModelProperty(value = "是否敏感",required = true)
private Integer isSensitive;
/**
* 创建者


+ 4
- 4
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/WorkflowParamDao.java View File

@@ -28,7 +28,7 @@ public interface WorkflowParamDao {
* @param pageable 分页对象
* @return 对象列表
*/
List<WorkflowParam> queryAllByLimit(WorkflowParam workflowParam, @Param("pageable") Pageable pageable);
List<WorkflowParam> queryAllByLimit(@Param("workflowParam") WorkflowParam workflowParam, @Param("pageable") Pageable pageable);

/**
* 统计总行数
@@ -36,7 +36,7 @@ public interface WorkflowParamDao {
* @param workflowParam 查询条件
* @return 总行数
*/
long count(WorkflowParam workflowParam);
long count(@Param("workflowParam") WorkflowParam workflowParam);

/**
* 新增数据
@@ -44,7 +44,7 @@ public interface WorkflowParamDao {
* @param workflowParam 实例对象
* @return 影响行数
*/
int insert(WorkflowParam workflowParam);
int insert(@Param("workflowParam") WorkflowParam workflowParam);

/**
* 批量新增数据(MyBatis原生foreach方法)
@@ -69,7 +69,7 @@ public interface WorkflowParamDao {
* @param workflowParam 实例对象
* @return 影响行数
*/
int update(WorkflowParam workflowParam);
int update(@Param("workflowParam") WorkflowParam workflowParam);

/**
* 通过主键删除数据


+ 2
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java View File

@@ -524,6 +524,8 @@ public class ExperimentInsServiceImpl implements ExperimentInsService {
//如果跟node_status里面不一样,就要去更新node_status的信息
String nodesStatus = ins.getNodesStatus();
Map<String, Object> nodeMap = JsonUtils.jsonToMap(nodesStatus);


String keyStartsWithWorkflow = nodeMap.keySet().stream()
.filter(key -> key.startsWith("workflow-"))
.findFirst()


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

@@ -83,7 +83,7 @@ public class WorkflowParamServiceImpl implements WorkflowParamService {
public String removeById(Integer id) {
WorkflowParam workflowParam = this.workflowParamDao.queryById(id);
if (workflowParam == null){
return "图标不存在";
return "流水线参数不存在";
}

//判断权限,只有admin和创建者本身可以删除


+ 79
- 76
ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/WorkflowParamDaoMapper.xml View File

@@ -28,106 +28,108 @@
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="WorkflowParamMap">
select
id,workflow_id,param_name,description,param_type,param_value,is_sensitive,create_by,create_time,update_by,update_time,state
id, workflow_id, param_name, description, param_type, param_value, is_sensitive, create_by, create_time, update_by, update_time, state
from workflow_param
<where>
state = 1
<if test="id != null">
and id = #{id}
<if test="workflowParam.id != null">
and id = #{workflowParam.id}
</if>
<if test="workflowId != null">
and workflow_id = #{workflowId}
<if test="workflowParam.workflowId != null">
and workflow_id = #{workflowParam.workflowId}
</if>
<if test="paramName != null and paramName != ''">
and param_name = #{paramName}
<if test="workflowParam.paramName != null and workflowParam.paramName != ''">
and param_name = #{workflowParam.paramName}
</if>
<if test="description != null and description != ''">
and description = #{description}
<if test="workflowParam.description != null and workflowParam.description != ''">
and description = #{workflowParam.description}
</if>
<if test="paramType != null">
and param_type = #{paramType}
<if test="workflowParam.paramType != null">
and param_type = #{workflowParam.paramType}
</if>
<if test="paramValue != null and paramValue != ''">
and param_value = #{paramValue}
<if test="workflowParam.paramValue != null and workflowParam.paramValue != ''">
and param_value = #{workflowParam.paramValue}
</if>
<if test="isSensitive != null">
and is_sensitive = #{isSensitive}
<if test="workflowParam.isSensitive != null">
and is_sensitive = #{workflowParam.isSensitive}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
<if test="workflowParam.createBy != null and workflowParam.createBy != ''">
and create_by = #{workflowParam.createBy}
</if>
<if test="createTime != null">
and create_time = #{createTime}
<if test="workflowParam.createTime != null">
and create_time = #{workflowParam.createTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
<if test="workflowParam.updateBy != null and workflowParam.updateBy != ''">
and update_by = #{workflowParam.updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
<if test="workflowParam.updateTime != null">
and update_time = #{workflowParam.updateTime}
</if>
<if test="state != null">
and state = #{state}
<if test="workflowParam.state != null">
and state = #{workflowParam.state}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>


<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from workflow_param
<where>
state = 1
<if test="id != null">
and id = #{id}
<if test="workflowParam.id != null">
and id = #{workflowParam.id}
</if>
<if test="workflowId != null">
and workflow_id = #{workflowId}
<if test="workflowParam.workflowId != null">
and workflow_id = #{workflowParam.workflowId}
</if>
<if test="paramName != null and paramName != ''">
and param_name = #{paramName}
<if test="workflowParam.paramName != null and workflowParam.paramName != ''">
and param_name = #{workflowParam.paramName}
</if>
<if test="description != null and description != ''">
and description = #{description}
<if test="workflowParam.description != null and workflowParam.description != ''">
and description = #{workflowParam.description}
</if>
<if test="paramType != null">
and param_type = #{paramType}
<if test="workflowParam.paramType != null">
and param_type = #{workflowParam.paramType}
</if>
<if test="paramValue != null and paramValue != ''">
and param_value = #{paramValue}
<if test="workflowParam.paramValue != null and workflowParam.paramValue != ''">
and param_value = #{workflowParam.paramValue}
</if>
<if test="isSensitive != null">
and is_sensitive = #{isSensitive}
<if test="workflowParam.isSensitive != null">
and is_sensitive = #{workflowParam.isSensitive}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
<if test="workflowParam.createBy != null and workflowParam.createBy != ''">
and create_by = #{workflowParam.createBy}
</if>
<if test="createTime != null">
and create_time = #{createTime}
<if test="workflowParam.createTime != null">
and create_time = #{workflowParam.createTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
<if test="workflowParam.updateBy != null and workflowParam.updateBy != ''">
and update_by = #{workflowParam.updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
<if test="workflowParam.updateTime != null">
and update_time = #{workflowParam.updateTime}
</if>
<if test="state != null">
and state = #{state}
<if test="workflowParam.state != null">
and state = #{workflowParam.state}
</if>
</where>
</select>

<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into workflow_param(workflow_id,param_name,description,param_type,param_value,is_sensitive,create_by,create_time,update_by,update_time,state)
values (#{workflowId}#{paramName}#{description}#{paramType}#{paramValue}#{isSensitive}#{createBy}#{createTime}#{updateBy}#{updateTime}#{state})
insert into workflow_param(workflow_id, param_name, description, param_type, param_value, is_sensitive, create_by, create_time, update_by, update_time, state)
values (#{workflowParam.workflowId}, #{workflowParam.paramName}, #{workflowParam.description}, #{workflowParam.paramType}, #{workflowParam.paramValue}, #{workflowParam.isSensitive}, #{workflowParam.createBy}, #{workflowParam.createTime}, #{workflowParam.updateBy}, #{workflowParam.updateTime}, #{workflowParam.state})
</insert>


<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into workflow_param(workflow_id,param_name,description,param_type,param_value,is_sensitive,create_by,create_time,update_by,update_time,state)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.workflowId}#{entity.paramName}#{entity.description}#{entity.paramType}#{entity.paramValue}#{entity.isSensitive}#{entity.createBy}#{entity.createTime}#{entity.updateBy}#{entity.updateTime}#{entity.state})
(#{entity.workflowId},#{entity.paramName},#{entity.description},#{entity.paramType},#{entity.paramValue},#{entity.isSensitive},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.state})
</foreach>
</insert>

@@ -135,7 +137,7 @@
insert into workflow_param(workflow_id,param_name,description,param_type,param_value,is_sensitive,create_by,create_time,update_by,update_time,state)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.workflowId}#{entity.paramName}#{entity.description}#{entity.paramType}#{entity.paramValue}#{entity.isSensitive}#{entity.createBy}#{entity.createTime}#{entity.updateBy}#{entity.updateTime}#{entity.state})
(#{entity.workflowId},#{entity.paramName},#{entity.description},#{entity.paramType},#{entity.paramValue},#{entity.isSensitive},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.state})
</foreach>
on duplicate key update
workflow_id = values(workflow_id)param_name = values(param_name)description = values(description)param_type = values(param_type)param_value = values(param_value)is_sensitive = values(is_sensitive)create_by = values(create_by)create_time = values(create_time)update_by = values(update_by)update_time = values(update_time)state = values(state)
@@ -145,43 +147,44 @@ workflow_id = values(workflow_id)param_name = values(param_name)description = va
<update id="update">
update workflow_param
<set>
<if test="workflowId != null">
workflow_id = #{workflowId},
<if test="workflowParam.workflowId != null">
workflow_id = #{workflowParam.workflowId},
</if>
<if test="paramName != null and paramName != ''">
param_name = #{paramName},
<if test="workflowParam.paramName != null and workflowParam.paramName != ''">
param_name = #{workflowParam.paramName},
</if>
<if test="description != null and description != ''">
description = #{description},
<if test="workflowParam.description != null and workflowParam.description != ''">
description = #{workflowParam.description},
</if>
<if test="paramType != null">
param_type = #{paramType},
<if test="workflowParam.paramType != null">
param_type = #{workflowParam.paramType},
</if>
<if test="paramValue != null and paramValue != ''">
param_value = #{paramValue},
<if test="workflowParam.paramValue != null and workflowParam.paramValue != ''">
param_value = #{workflowParam.paramValue},
</if>
<if test="isSensitive != null">
is_sensitive = #{isSensitive},
<if test="workflowParam.isSensitive != null">
is_sensitive = #{workflowParam.isSensitive},
</if>
<if test="createBy != null and createBy != ''">
create_by = #{createBy},
<if test="workflowParam.createBy != null and workflowParam.createBy != ''">
create_by = #{workflowParam.createBy},
</if>
<if test="createTime != null">
create_time = #{createTime},
<if test="workflowParam.createTime != null">
create_time = #{workflowParam.createTime},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
<if test="workflowParam.updateBy != null and workflowParam.updateBy != ''">
update_by = #{workflowParam.updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
<if test="workflowParam.updateTime != null">
update_time = #{workflowParam.updateTime},
</if>
<if test="state != null">
state = #{state},
<if test="workflowParam.state != null">
state = #{workflowParam.state},
</if>
</set>
where id = #{id}
where id = #{workflowParam.id}
</update>


<!--通过主键删除-->
<delete id="deleteById">
delete from workflow_param where id = #{id}


Loading…
Cancel
Save