| @@ -134,7 +134,7 @@ public class DatasetController { | |||||
| */ | */ | ||||
| @PostMapping("/upload_pipeline") | @PostMapping("/upload_pipeline") | ||||
| @ApiOperation(value = "从流水线上传数据集", notes = "并将信息存入数据库。") | @ApiOperation(value = "从流水线上传数据集", notes = "并将信息存入数据库。") | ||||
| public ResponseEntity<String> uploadDatasetPipeline(@RequestBody(required =false) DatasetVersion datasetVersion) { | |||||
| public ResponseEntity<String> uploadDatasetPipeline(@RequestBody(required =false) DatasetVersion datasetVersion) throws Exception { | |||||
| return ResponseEntity.ok(this.datasetService.uploadDatasetPipeline(datasetVersion)); | return ResponseEntity.ok(this.datasetService.uploadDatasetPipeline(datasetVersion)); | ||||
| } | } | ||||
| } | } | ||||
| @@ -118,7 +118,7 @@ public class ModelsController { | |||||
| */ | */ | ||||
| @PostMapping("/upload_pipeline") | @PostMapping("/upload_pipeline") | ||||
| @ApiOperation("从流水线上传模型,并将信息存入数据库") | @ApiOperation("从流水线上传模型,并将信息存入数据库") | ||||
| public ResponseEntity<String> uploadModelsPipeline(@RequestBody(required =false) ModelsVersion modelsVersion){ | |||||
| public ResponseEntity<String> uploadModelsPipeline(@RequestBody(required =false) ModelsVersion modelsVersion) throws Exception { | |||||
| return ResponseEntity.ok(this.modelsService.uploadModelsPipeline(modelsVersion)); | return ResponseEntity.ok(this.modelsService.uploadModelsPipeline(modelsVersion)); | ||||
| } | } | ||||
| @@ -69,5 +69,5 @@ public interface DatasetService { | |||||
| String uploadDataset(MultipartFile file, Integer id) throws Exception; | String uploadDataset(MultipartFile file, Integer id) throws Exception; | ||||
| String uploadDatasetPipeline(DatasetVersion datasetVersion); | |||||
| String uploadDatasetPipeline(DatasetVersion datasetVersion) throws Exception; | |||||
| } | } | ||||
| @@ -66,5 +66,5 @@ public interface ModelsService { | |||||
| String uploadModels(MultipartFile file, Integer id) throws Exception; | String uploadModels(MultipartFile file, Integer id) throws Exception; | ||||
| String uploadModelsPipeline(ModelsVersion modelsVersion); | |||||
| String uploadModelsPipeline(ModelsVersion modelsVersion) throws Exception; | |||||
| } | } | ||||
| @@ -270,11 +270,15 @@ public class DatasetServiceImpl implements DatasetService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public String uploadDatasetPipeline(DatasetVersion datasetVersion) { | |||||
| public String uploadDatasetPipeline(DatasetVersion datasetVersion) throws Exception { | |||||
| String username = SecurityUtils.getLoginUser().getUsername(); | String username = SecurityUtils.getLoginUser().getUsername(); | ||||
| // 检查是否存在 | // 检查是否存在 | ||||
| DatasetVersion version = datasetVersionService.queryByDatasetVersion(datasetVersion); | |||||
| Dataset dataset = this.queryById(datasetVersion.getDatasetId()); | Dataset dataset = this.queryById(datasetVersion.getDatasetId()); | ||||
| if (dataset == null) { | |||||
| throw new Exception("数据集不存在,请检查数据集id"); | |||||
| } | |||||
| DatasetVersion version = datasetVersionService.queryByDatasetVersion(datasetVersion); | |||||
| String url = ""; | String url = ""; | ||||
| if (version == null) { | if (version == null) { | ||||
| //插表,因为这里是一次直接插表所以这里定掉date,然后用DAO插入 | //插表,因为这里是一次直接插表所以这里定掉date,然后用DAO插入 | ||||
| @@ -262,11 +262,15 @@ public class ModelsServiceImpl implements ModelsService { | |||||
| @Override | @Override | ||||
| public String uploadModelsPipeline(ModelsVersion modelsVersion) { | |||||
| public String uploadModelsPipeline(ModelsVersion modelsVersion) throws Exception { | |||||
| String username = SecurityUtils.getLoginUser().getUsername(); | String username = SecurityUtils.getLoginUser().getUsername(); | ||||
| // 检查是否存在 | // 检查是否存在 | ||||
| ModelsVersion version = modelsVersionService.queryByModelsVersion(modelsVersion); | |||||
| Models models = this.queryById(modelsVersion.getModelsId()); | Models models = this.queryById(modelsVersion.getModelsId()); | ||||
| if (models == null) { | |||||
| throw new Exception("模型不存在,请检查模型id"); | |||||
| } | |||||
| ModelsVersion version = modelsVersionService.queryByModelsVersion(modelsVersion); | |||||
| String url = ""; | String url = ""; | ||||
| if (version == null) { | if (version == null) { | ||||
| //插表,因为这里是一次直接插表所以这里定掉date,然后用DAO插入 | //插表,因为这里是一次直接插表所以这里定掉date,然后用DAO插入 | ||||
| @@ -40,11 +40,11 @@ | |||||
| from dataset_version | from dataset_version | ||||
| <where> | <where> | ||||
| state = 1 | state = 1 | ||||
| <if test="datasetVersion.datasetId != null"> | |||||
| and dataset_id = #{datasetVersion.datasetId} | |||||
| <if test="datasetId != null"> | |||||
| and dataset_id = #{datasetId} | |||||
| </if> | </if> | ||||
| <if test="datasetVersion.version != null and datasetVersion.version != ''"> | |||||
| and version = #{datasetVersion.version} | |||||
| <if test="version != null and version != ''"> | |||||
| and version = #{version} | |||||
| </if> | </if> | ||||
| </where> | </where> | ||||
| limit 1 | limit 1 | ||||