diff --git a/backend/src/main/java/io/metersphere/metadata/controller/FileMetadataController.java b/backend/src/main/java/io/metersphere/metadata/controller/FileMetadataController.java index 8f2a4fdb5d..be3239648a 100644 --- a/backend/src/main/java/io/metersphere/metadata/controller/FileMetadataController.java +++ b/backend/src/main/java/io/metersphere/metadata/controller/FileMetadataController.java @@ -112,4 +112,9 @@ public class FileMetadataController { public boolean exist(@PathVariable("fileId") String fileId) { return fileMetadataService.exist(fileId); } + + @PostMapping(value = "/exists") + public List exist(@RequestBody List fileIds) { + return fileMetadataService.exists(fileIds); + } } diff --git a/backend/src/main/java/io/metersphere/metadata/service/FileMetadataService.java b/backend/src/main/java/io/metersphere/metadata/service/FileMetadataService.java index d08f3f8421..46129afa6c 100644 --- a/backend/src/main/java/io/metersphere/metadata/service/FileMetadataService.java +++ b/backend/src/main/java/io/metersphere/metadata/service/FileMetadataService.java @@ -430,4 +430,14 @@ public class FileMetadataService { public boolean exist(String fileId) { return fileMetadataMapper.selectByPrimaryKey(fileId) != null; } + + public List exists(List fileIds) { + if (CollectionUtils.isEmpty(fileIds)) { + return new LinkedList<>(); + } + FileMetadataExample example = new FileMetadataExample(); + example.createCriteria().andIdIn(fileIds); + List fileMetadataList = fileMetadataMapper.selectByExample(example); + return fileMetadataList.stream().map(FileMetadata::getId).collect(Collectors.toList()); + } } diff --git a/frontend/src/business/components/api/automation/scenario/variable/CsvFileUpload.vue b/frontend/src/business/components/api/automation/scenario/variable/CsvFileUpload.vue index c397a612bb..a09d282718 100644 --- a/frontend/src/business/components/api/automation/scenario/variable/CsvFileUpload.vue +++ b/frontend/src/business/components/api/automation/scenario/variable/CsvFileUpload.vue @@ -35,16 +35,20 @@
{{ file.file && file.file.name ? file.file.name : file.name }} - + - {{ file.isExist ? '文件已经被删除' : '' }} + + {{ file.isExist ? $t('permission.project_file.file_delete_tip') : '' }} + - - + + + + - + @@ -273,4 +277,11 @@ export default { overflow: hidden; width: 180px; } + +.ms-list__item-delete { + margin-top: -10px; + padding-top: -10px; + text-align: center; + vertical-align: middle; +} diff --git a/frontend/src/business/components/api/definition/components/body/ApiBodyFileUpload.vue b/frontend/src/business/components/api/definition/components/body/ApiBodyFileUpload.vue index 223cf04abc..09459573d2 100644 --- a/frontend/src/business/components/api/definition/components/body/ApiBodyFileUpload.vue +++ b/frontend/src/business/components/api/definition/components/body/ApiBodyFileUpload.vue @@ -1,5 +1,5 @@