diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/base/mapper/ext/BaseFileMetadataMapper.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/base/mapper/ext/BaseFileMetadataMapper.java index bc56ee6b32..9d7b729722 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/base/mapper/ext/BaseFileMetadataMapper.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/base/mapper/ext/BaseFileMetadataMapper.java @@ -25,4 +25,6 @@ public interface BaseFileMetadataMapper { List selectRefIdsByIds(@Param("ids") List nodeIds); List selectIllegalModuleIdListByProjectId(String projectId); + + long countRepositoryFileByIds(@Param("ids") List metadataIds); } \ No newline at end of file diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/base/mapper/ext/BaseFileMetadataMapper.xml b/framework/sdk-parent/sdk/src/main/java/io/metersphere/base/mapper/ext/BaseFileMetadataMapper.xml index 172326d524..b212c04ff0 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/base/mapper/ext/BaseFileMetadataMapper.xml +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/base/mapper/ext/BaseFileMetadataMapper.xml @@ -165,6 +165,15 @@ WHERE project_id = #{0} AND module_id = ''; + update file_metadata diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/metadata/service/FileMetadataService.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/metadata/service/FileMetadataService.java index 72b0ec7a95..4c589f2fe6 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/metadata/service/FileMetadataService.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/metadata/service/FileMetadataService.java @@ -233,10 +233,15 @@ public class FileMetadataService { public void move(MoveFIleMetadataRequest request) { //不可移动到存储库模块节点 FileModule fileModule = fileModuleService.get(request.getModuleId()); - if (fileModule != null && !org.apache.commons.collections.CollectionUtils.isEmpty(request.getMetadataIds()) && StringUtils.isNotEmpty(request.getModuleId())) { - if (StringUtils.equals(fileModule.getModuleType(), FileModuleTypeConstants.REPOSITORY.getValue())) { + if (fileModule != null && CollectionUtils.isNotEmpty(request.getMetadataIds())) { + if (fileModule.getModuleType() != null && StringUtils.equals(fileModule.getModuleType(), FileModuleTypeConstants.REPOSITORY.getValue())) { MSException.throwException(Translator.get("can_not_move_to_repository_node")); } else { + //检查所选id中是否含有存储库文件 + long repositoryFileCount = baseFileMetadataMapper.countRepositoryFileByIds(request.getMetadataIds()); + if (repositoryFileCount > 0) { + MSException.throwException(Translator.get("can_not_move_to_repository_file")); + } baseFileMetadataMapper.move(request); } } diff --git a/framework/sdk-parent/sdk/src/main/resources/i18n/commons_en_US.properties b/framework/sdk-parent/sdk/src/main/resources/i18n/commons_en_US.properties index 5f13bd6487..f19d6d836f 100644 --- a/framework/sdk-parent/sdk/src/main/resources/i18n/commons_en_US.properties +++ b/framework/sdk-parent/sdk/src/main/resources/i18n/commons_en_US.properties @@ -397,6 +397,7 @@ no_tcp_mock_port=No idle tcp port, please contact administrators. name_already_exists_in_module=Name already exists in same module repository_module_already_exists=The repository name already exists at the same project can_not_move_to_repository_node=Can not move to repository node +can_not_move_to_repository_file=Can not move repository file # issue template copy target_issue_template_not_checked=Cannot copy, target project not checked copy_template_name_too_long=Copy error, template name too long diff --git a/framework/sdk-parent/sdk/src/main/resources/i18n/commons_zh_CN.properties b/framework/sdk-parent/sdk/src/main/resources/i18n/commons_zh_CN.properties index 605d089f42..8100c9f2f4 100644 --- a/framework/sdk-parent/sdk/src/main/resources/i18n/commons_zh_CN.properties +++ b/framework/sdk-parent/sdk/src/main/resources/i18n/commons_zh_CN.properties @@ -405,4 +405,6 @@ version_name_is_null=版本名称不能为空 current_version_already_exists=当前版本已存在 Prepare=未开始 Underway=进行中 -Completed=已完成 \ No newline at end of file +Completed=已完成 +can_not_move_to_repository_node=不能移动到存储库节点 +can_not_move_to_repository_file=不能移动存储库中的文件 \ No newline at end of file diff --git a/framework/sdk-parent/sdk/src/main/resources/i18n/commons_zh_TW.properties b/framework/sdk-parent/sdk/src/main/resources/i18n/commons_zh_TW.properties index cb3ccc2522..12676d3b5f 100644 --- a/framework/sdk-parent/sdk/src/main/resources/i18n/commons_zh_TW.properties +++ b/framework/sdk-parent/sdk/src/main/resources/i18n/commons_zh_TW.properties @@ -404,4 +404,6 @@ version_name_is_null=版本名稱不能為空 current_version_already_exists=當前版本已存在 Prepare=未開始 Underway=進行中 -Completed=已完成 \ No newline at end of file +Completed=已完成 +can_not_move_to_repository_node=不能移動到存儲庫節點 +can_not_move_to_repository_file=不能移動存儲庫中的文件 \ No newline at end of file