From 14559fb4037677b87fffa9186a0b27337f2ceeaa Mon Sep 17 00:00:00 2001 From: zhangdahai112 Date: Sun, 16 Jan 2022 15:43:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81=E5=90=88=E5=B9=B6=E4=B8=A2?= =?UTF-8?q?=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../track/service/TestCaseService.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index 395c6318cb..547fddd52b 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -357,11 +357,20 @@ public class TestCaseService { } } if (otherInfoConfig.isDependency()) { - List preRelations = getRelationshipCase(testCase.getId(), "PRE"); - List postRelations = getRelationshipCase(testCase.getId(), "POST"); + List preRelations = relationshipEdgeService.getRelationshipEdgeByType(testCase.getId(), "PRE"); + List postRelations = relationshipEdgeService.getRelationshipEdgeByType(testCase.getId(), "POST"); if (CollectionUtils.isNotEmpty(preRelations)) { preRelations.forEach(relation -> { - + relation.setSourceId(testCase.getId()); + relation.setCreateTime(System.currentTimeMillis()); + relationshipEdgeMapper.insertSelective(relation); + }); + } + if (CollectionUtils.isNotEmpty(postRelations)) { + postRelations.forEach(relation -> { + relation.setTargetId(testCase.getId()); + relation.setCreateTime(System.currentTimeMillis()); + relationshipEdgeMapper.insertSelective(relation); }); } } @@ -1493,6 +1502,7 @@ public class TestCaseService { SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory); } } + public void deleteTestCaseBath(TestCaseBatchRequest request) { TestCaseExample example = this.getBatchExample(request); deleteTestPlanTestCaseBath(request.getIds()); @@ -2122,8 +2132,7 @@ public class TestCaseService { if ((StringUtils.isNotEmpty(testCase.getMaintainer()) && testCase.getMaintainer() == SessionUtils.getUserId()) || (StringUtils.isNotEmpty(testCase.getCreateUser()) && testCase.getCreateUser() == SessionUtils.getUserId())) { this.deleteTestCasePublic(testCase.getRefId()); - } - else { + } else { MSException.throwException(Translator.get("check_owner_case")); } }