diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index 76624c50f3..d72eae0d1c 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -1174,7 +1174,7 @@ public class ApiDefinitionService { .build(); noticeSendService.send(NoticeConstants.Mode.SCHEDULE, "", noticeModel); } - }catch (Exception e){ + } catch (Exception e) { LogUtil.error(e); MSException.throwException(Translator.get("user_import_format_wrong")); } @@ -1809,13 +1809,14 @@ public class ApiDefinitionService { public ApiDefinitionResult getById(String id) { ApiDefinitionRequest request = new ApiDefinitionRequest(); request.setId(id); - List list = list(request); + List list = extApiDefinitionMapper.list(request); if (CollectionUtils.isNotEmpty(list)) { return list.get(0); } return null; } + public long countEffectiveByProjectId(String projectId) { if (StringUtils.isEmpty(projectId)) { return 0; diff --git a/backend/src/main/java/io/metersphere/api/service/MsHashTreeService.java b/backend/src/main/java/io/metersphere/api/service/MsHashTreeService.java index a315c10030..8ff9f2161d 100644 --- a/backend/src/main/java/io/metersphere/api/service/MsHashTreeService.java +++ b/backend/src/main/java/io/metersphere/api/service/MsHashTreeService.java @@ -201,11 +201,13 @@ public class MsHashTreeService { this.setElement(element, apiTestCase.getNum(), enable, apiTestCase.getVersionName(), apiTestCase.getVersionEnable()); } } else { - ApiDefinitionResult definitionWithBLOBs = apiDefinitionService.getById(element.getString(ID)); - if (definitionWithBLOBs != null) { - element.put(ID, definitionWithBLOBs.getId()); - this.setElement(element, definitionWithBLOBs.getNum(), enable, definitionWithBLOBs.getVersionName(), definitionWithBLOBs.getVersionEnable()); - isExist = true; + if (StringUtils.equalsIgnoreCase(element.getString(REFERENCED), "Copy")) { + ApiDefinitionResult definitionWithBLOBs = apiDefinitionService.getById(element.getString(ID)); + if (definitionWithBLOBs != null) { + element.put(ID, definitionWithBLOBs.getId()); + this.setElement(element, definitionWithBLOBs.getNum(), enable, definitionWithBLOBs.getVersionName(), definitionWithBLOBs.getVersionEnable()); + isExist = true; + } } } if (!isExist) {