| @@ -100,6 +100,7 @@ public class ModelsVersionController extends BaseController { | |||||
| * @return 编辑结果 | * @return 编辑结果 | ||||
| */ | */ | ||||
| @PutMapping | @PutMapping | ||||
| @ApiOperation("编辑模型") | |||||
| public GenericsAjaxResult<ModelsVersion> edit(@RequestBody ModelsVersion modelsVersion) { | public GenericsAjaxResult<ModelsVersion> edit(@RequestBody ModelsVersion modelsVersion) { | ||||
| return genericsSuccess(this.modelsVersionService.update(modelsVersion)); | return genericsSuccess(this.modelsVersionService.update(modelsVersion)); | ||||
| } | } | ||||
| @@ -111,6 +112,7 @@ public class ModelsVersionController extends BaseController { | |||||
| * @return 删除是否成功 | * @return 删除是否成功 | ||||
| */ | */ | ||||
| @DeleteMapping("{id}") | @DeleteMapping("{id}") | ||||
| @ApiOperation("删除模型") | |||||
| public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) { | public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) { | ||||
| return genericsSuccess(this.modelsVersionService.removeById(id)); | return genericsSuccess(this.modelsVersionService.removeById(id)); | ||||
| } | } | ||||
| @@ -80,4 +80,5 @@ public interface ModelsService { | |||||
| String insertModelAndVersion(ModelsVo modelsVo) throws Exception; | String insertModelAndVersion(ModelsVo modelsVo) throws Exception; | ||||
| String readFileContent(Integer modelsId, String version) throws Exception; | String readFileContent(Integer modelsId, String version) throws Exception; | ||||
| } | } | ||||
| @@ -306,6 +306,7 @@ public class DatasetServiceImpl implements DatasetService { | |||||
| // 使用Stream API提取version字段,并去重 | // 使用Stream API提取version字段,并去重 | ||||
| return versions.stream() | return versions.stream() | ||||
| .map(DatasetVersion::getVersion) // 提取每个DatasetVersion对象的version属性 | .map(DatasetVersion::getVersion) // 提取每个DatasetVersion对象的version属性 | ||||
| .filter(version -> version != null && !version.isEmpty()) //忽略null或空字符串的version | |||||
| .distinct() // 去重 | .distinct() // 去重 | ||||
| .collect(Collectors.toList()); // 收集到List中 | .collect(Collectors.toList()); // 收集到List中 | ||||
| } | } | ||||
| @@ -229,8 +229,10 @@ public class ExperimentServiceImpl implements ExperimentService { | |||||
| //这里全局参数是一个json数组,需要转换成一个list<Map> | //这里全局参数是一个json数组,需要转换成一个list<Map> | ||||
| List<Map<String, Object>> params = JacksonUtil.parseJSONStr2MapList(StringUtils.isEmpty(experiment.getGlobalParam()) ? "[]" : experiment.getGlobalParam()); | List<Map<String, Object>> params = JacksonUtil.parseJSONStr2MapList(StringUtils.isEmpty(experiment.getGlobalParam()) ? "[]" : experiment.getGlobalParam()); | ||||
| runReqMap.put("params", params); | runReqMap.put("params", params); | ||||
| runReqMap.put("experiment", new HashMap<String, Object>().put("name", "experiment-"+experiment.getId())); | |||||
| //// 实验字段的Map,不要写成一行! | |||||
| Map<String, Object> experimentMap = new HashMap<>(); | |||||
| experimentMap.put("name", "experiment-"+experiment.getId()); | |||||
| runReqMap.put("experiment", experimentMap); | |||||
| Map<String ,Object> output = (Map<String, Object>) converMap.get("output"); | Map<String ,Object> output = (Map<String, Object>) converMap.get("output"); | ||||
| // 调argo运行接口 | // 调argo运行接口 | ||||
| @@ -354,6 +354,7 @@ public class ModelsServiceImpl implements ModelsService { | |||||
| // 使用Stream API提取version字段,并去重 | // 使用Stream API提取version字段,并去重 | ||||
| return versions.stream() | return versions.stream() | ||||
| .map(ModelsVersion::getVersion) // 提取每个ModelVersion对象的version属性 | .map(ModelsVersion::getVersion) // 提取每个ModelVersion对象的version属性 | ||||
| .filter(version -> version != null && !version.isEmpty()) //忽略null或空字符串的version | |||||
| .distinct() // 去重 | .distinct() // 去重 | ||||
| .collect(Collectors.toList()); // 收集到List中 | .collect(Collectors.toList()); // 收集到List中 | ||||
| } | } | ||||
| @@ -169,7 +169,7 @@ | |||||
| <!--新增所有列--> | <!--新增所有列--> | ||||
| <insert id="insert" keyProperty="id" useGeneratedKeys="true"> | <insert id="insert" keyProperty="id" useGeneratedKeys="true"> | ||||
| insert into models_version(models_id, version, url, file_name, file_size, status, description, create_by, create_time, update_by, update_time, state) | insert into models_version(models_id, version, url, file_name, file_size, status, description, create_by, create_time, update_by, update_time, state) | ||||
| values (#{modelsVersion.modelsId}, #{modelsVersion.version}, #{modelsVersion.url}, #{modelsVersion.fileName}, #{modelsVersion.fileSize}, #{modelsVersion.status}, #{modelsVersion.createBy}, #{modelsVersion.createTime}, #{modelsVersion.updateBy}, #{modelsVersion.updateTime}, #{modelsVersion.state}) | |||||
| values (#{modelsVersion.modelsId}, #{modelsVersion.version}, #{modelsVersion.url}, #{modelsVersion.fileName}, #{modelsVersion.fileSize}, #{modelsVersion.status}, #{modelsVersion.description}, #{modelsVersion.createBy}, #{modelsVersion.createTime}, #{modelsVersion.updateBy}, #{modelsVersion.updateTime}, #{modelsVersion.state}) | |||||
| </insert> | </insert> | ||||
| @@ -178,7 +178,7 @@ | |||||
| (models_id, version, url, file_name, file_size, status, description, create_by, create_time, update_by, update_time, state) | (models_id, version, url, file_name, file_size, status, description, create_by, create_time, update_by, update_time, state) | ||||
| values | values | ||||
| <foreach collection="entities" item="entity" separator=","> | <foreach collection="entities" item="entity" separator=","> | ||||
| (#{entity.modelsId}, #{entity.version}, #{entity.url}, #{entity.fileName}, #{entity.fileSize}, #{entity.status}, #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime}, #{entity.state}) | |||||
| (#{entity.modelsId}, #{entity.version}, #{entity.url}, #{entity.fileName}, #{entity.fileSize}, #{entity.status}, #{entity.description},#{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime}, #{entity.state}) | |||||
| </foreach> | </foreach> | ||||
| </insert> | </insert> | ||||
| @@ -188,7 +188,7 @@ | |||||
| (models_id, version, url, file_name, file_size, status, description, create_by, create_time, update_by, update_time, state) | (models_id, version, url, file_name, file_size, status, description, create_by, create_time, update_by, update_time, state) | ||||
| values | values | ||||
| <foreach collection="entities" item="entity" separator=","> | <foreach collection="entities" item="entity" separator=","> | ||||
| (#{entity.modelsId}, #{entity.version}, #{entity.url}, #{entity.fileName}, #{entity.fileSize}, #{entity.status}, #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime}, #{entity.state}) | |||||
| (#{entity.modelsId}, #{entity.version}, #{entity.url}, #{entity.fileName}, #{entity.fileSize}, #{entity.status},#{entity.description}, #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime}, #{entity.state}) | |||||
| </foreach> | </foreach> | ||||
| on duplicate key update | on duplicate key update | ||||
| models_id = values(models_id), | models_id = values(models_id), | ||||