From 35f84f54a9c64f39d1408e0b65985b224c806b9a Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Fri, 29 Apr 2022 11:57:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=8D=E5=90=8C=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E5=90=8C=E7=BA=A7=E5=AD=90=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E4=B9=9F=E4=B8=8D=E8=83=BD=E7=94=A8=E4=B8=80=E6=A0=B7=E7=9A=84?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1012846 --user=陈建星 【UI测试】UI元素库 和 UI自动化,不同模块下的同级子模块也不能用一样的名称 https://www.tapd.cn/55049933/s/1151418 --- .../io/metersphere/api/service/ApiModuleService.java | 9 +++++++-- .../api/service/ApiScenarioModuleService.java | 9 +++++++-- .../java/io/metersphere/dto/RelationshipGraphData.java | 1 - .../java/io/metersphere/service/BaseModuleService.java | 9 +++++++-- .../metersphere/track/service/TestCaseNodeService.java | 9 +++++++-- 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiModuleService.java b/backend/src/main/java/io/metersphere/api/service/ApiModuleService.java index 674dd17377..dc572143bc 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiModuleService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiModuleService.java @@ -272,8 +272,13 @@ public class ApiModuleService extends NodeTreeService { ApiModuleExample example = new ApiModuleExample(); ApiModuleExample.Criteria criteria = example.createCriteria(); criteria.andNameEqualTo(node.getName()) - .andProjectIdEqualTo(node.getProjectId()) - .andLevelEqualTo(node.getLevel()); + .andProjectIdEqualTo(node.getProjectId()); + + if (StringUtils.isNotBlank(node.getParentId())) { + criteria.andParentIdEqualTo(node.getParentId()); + } else { + criteria.andLevelEqualTo(node.getLevel()); + } if (StringUtils.isNotBlank(node.getProtocol())) { criteria.andProtocolEqualTo(node.getProtocol()); diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioModuleService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioModuleService.java index 6ba7929973..a5fe23651f 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioModuleService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioModuleService.java @@ -233,8 +233,13 @@ public class ApiScenarioModuleService extends NodeTreeService { TestCaseNodeExample example = new TestCaseNodeExample(); TestCaseNodeExample.Criteria criteria = example.createCriteria(); criteria.andNameEqualTo(node.getName()) - .andProjectIdEqualTo(node.getProjectId()) - .andLevelEqualTo(node.getLevel()); + .andProjectIdEqualTo(node.getProjectId()); + + if (StringUtils.isNotBlank(node.getParentId())) { + criteria.andParentIdEqualTo(node.getParentId()); + } else { + criteria.andLevelEqualTo(node.getLevel()); + } if (StringUtils.isNotBlank(node.getId())) { criteria.andIdNotEqualTo(node.getId()); diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java index b87338afab..63ef9cdd77 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java @@ -104,8 +104,13 @@ public class TestCaseNodeService extends NodeTreeService { TestCaseNodeExample example = new TestCaseNodeExample(); TestCaseNodeExample.Criteria criteria = example.createCriteria(); criteria.andNameEqualTo(node.getName()) - .andProjectIdEqualTo(node.getProjectId()) - .andLevelEqualTo(node.getLevel()); + .andProjectIdEqualTo(node.getProjectId()); + + if (StringUtils.isNotBlank(node.getParentId())) { + criteria.andParentIdEqualTo(node.getParentId()); + } else { + criteria.andLevelEqualTo(node.getLevel()); + } if (StringUtils.isNotBlank(node.getId())) { criteria.andIdNotEqualTo(node.getId());