From 712c0d69c64f516f45764bab5bea3218cc82686f Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 26 Oct 2021 15:05:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=84=91=E5=9B=BE=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/ApiTestCaseService.java | 6 ++++ .../track/service/TestCaseReviewService.java | 4 +++ .../service/TestPlanLoadCaseService.java | 3 ++ .../track/service/TestPlanService.java | 3 ++ .../track/common/minder/TestPlanMinder.vue | 27 ++++++++--------- .../track/common/minder/TestReviewMinder.vue | 29 ++++++++----------- 6 files changed, 40 insertions(+), 32 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java index a2b800e226..07d530cd9f 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java @@ -506,6 +506,9 @@ public class ApiTestCaseService { if (CollectionUtils.isEmpty(request.getSelectIds())) { return; } + // 尽量保持与用例顺序一致 + Collections.reverse(request.getSelectIds()); + ApiTestCaseExample example = new ApiTestCaseExample(); example.createCriteria().andApiDefinitionIdIn(request.getSelectIds()); List apiTestCases = apiTestCaseMapper.selectByExample(example); @@ -517,6 +520,9 @@ public class ApiTestCaseService { if (CollectionUtils.isEmpty(ids)) { return; } + // 尽量保持与用例顺序一致 + Collections.reverse(ids); + ApiTestCaseExample example = new ApiTestCaseExample(); example.createCriteria().andIdIn(ids); List apiTestCases = apiTestCaseMapper.selectByExample(example); diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java index 8e8e697ef4..6f49b44e55 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java @@ -348,6 +348,7 @@ public class TestCaseReviewService { if (testCaseIds.isEmpty()) { return; } + // 如果是关联全部指令则根据条件查询未关联的案例 if (testCaseIds.get(0).equals("all")) { List testCases = extTestCaseMapper.getTestCaseByNotInReview(request.getRequest()); @@ -356,6 +357,9 @@ public class TestCaseReviewService { } } + // 尽量保持与用例顺序一致 + Collections.reverse(testCaseIds); + SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH); TestCaseReviewTestCaseMapper batchMapper = sqlSession.getMapper(TestCaseReviewTestCaseMapper.class); Long nextOrder = ServiceUtils.getNextOrder(request.getReviewId(), extTestReviewCaseMapper::getLastOrder); diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanLoadCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanLoadCaseService.java index b7dc853b11..550d36972c 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanLoadCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanLoadCaseService.java @@ -87,6 +87,9 @@ public class TestPlanLoadCaseService { TestPlanLoadCaseMapper testPlanLoadCaseMapper = sqlSession.getMapper(TestPlanLoadCaseMapper.class); Long nextOrder = ServiceUtils.getNextOrder(request.getTestPlanId(), extTestPlanLoadCaseMapper::getLastOrder); + // 尽量保持与用例顺序一致 + Collections.reverse(caseIds); + for (String id : caseIds) { TestPlanLoadCase t = new TestPlanLoadCase(); t.setId(UUID.randomUUID().toString()); diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java index 597b0e22ca..2a05480071 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -525,6 +525,9 @@ public class TestPlanService { return; } + // 尽量保持与用例顺序一致 + Collections.reverse(testCaseIds); + TestCaseExample testCaseExample = new TestCaseExample(); testCaseExample.createCriteria().andIdIn(testCaseIds); List testCaseList = testCaseMapper.selectByExample(testCaseExample); diff --git a/frontend/src/business/components/track/common/minder/TestPlanMinder.vue b/frontend/src/business/components/track/common/minder/TestPlanMinder.vue index 3ffa7012fe..e393564f18 100644 --- a/frontend/src/business/components/track/common/minder/TestPlanMinder.vue +++ b/frontend/src/business/components/track/common/minder/TestPlanMinder.vue @@ -71,30 +71,27 @@ name: "TestPlanMinder", methods: { handleAfterMount() { listenNodeSelected(() => { - let param = { - request: { - planId: this.planId, - orders: this.condition.orders - }, - result: this.result, - isDisable: true - } - loadSelectNodes(param, getPlanCasesForMinder, this.setParamCallback); + loadSelectNodes(this.getParam(), getPlanCasesForMinder, this.setParamCallback); }); listenBeforeExecCommand((even) => { if (even.commandName === 'expandtolevel') { let level = Number.parseInt(even.commandArgs); - let param = { - request: {planId: this.planId}, - result: this.result, - isDisable: true - } - handleExpandToLevel(level, even.minder.getRoot(), param, getPlanCasesForMinder, this.setParamCallback); + handleExpandToLevel(level, even.minder.getRoot(), this.getParam(), getPlanCasesForMinder, this.setParamCallback); } }); tagBatch([...this.tags, this.$t('test_track.plan.plan_status_prepare')]); }, + getParam() { + return { + request: { + planId: this.planId, + orders: this.condition.orders + }, + result: this.result, + isDisable: true + } + }, setParamCallback(data, item) { if (item.status === 'Pass') { data.resource.push(this.$t('test_track.plan_view.pass')); diff --git a/frontend/src/business/components/track/common/minder/TestReviewMinder.vue b/frontend/src/business/components/track/common/minder/TestReviewMinder.vue index 96dfdf3cef..fe32d6c094 100644 --- a/frontend/src/business/components/track/common/minder/TestReviewMinder.vue +++ b/frontend/src/business/components/track/common/minder/TestReviewMinder.vue @@ -74,32 +74,27 @@ name: "TestReviewMinder", methods: { handleAfterMount() { listenNodeSelected(() => { - let param = { - request: { - reviewId: this.reviewId, - orders: this.condition.orders - }, - result: this.result, - isDisable: true - } - loadSelectNodes(param, getReviewCasesForMinder, this.setParamCallback); + loadSelectNodes(this.getParam(), getReviewCasesForMinder, this.setParamCallback); }); listenBeforeExecCommand((even) => { if (even.commandName === 'expandtolevel') { let level = Number.parseInt(even.commandArgs); - let param = { - request: { - reviewId: this.reviewId, - }, - result: this.result, - isDisable: true - } - handleExpandToLevel(level, even.minder.getRoot(), param, getReviewCasesForMinder, this.setParamCallback); + handleExpandToLevel(level, even.minder.getRoot(), this.getParam(), getReviewCasesForMinder, this.setParamCallback); } }); tagBatch([...this.tags, this.$t('test_track.plan.plan_status_prepare')]); }, + getParam() { + return { + request: { + reviewId: this.reviewId, + orders: this.condition.orders + }, + result: this.result, + isDisable: true + } + }, setParamCallback(data, item) { if (item.reviewStatus === 'Pass') { data.resource.push(this.$t('test_track.plan_view.pass'));