fix: 脑图用例顺序优化

This commit is contained in:
chenjianxing 2021-10-26 15:05:06 +08:00 committed by jianxing
parent 1f4ed04192
commit 712c0d69c6
6 changed files with 40 additions and 32 deletions

View File

@ -506,6 +506,9 @@ public class ApiTestCaseService {
if (CollectionUtils.isEmpty(request.getSelectIds())) { if (CollectionUtils.isEmpty(request.getSelectIds())) {
return; return;
} }
// 尽量保持与用例顺序一致
Collections.reverse(request.getSelectIds());
ApiTestCaseExample example = new ApiTestCaseExample(); ApiTestCaseExample example = new ApiTestCaseExample();
example.createCriteria().andApiDefinitionIdIn(request.getSelectIds()); example.createCriteria().andApiDefinitionIdIn(request.getSelectIds());
List<ApiTestCase> apiTestCases = apiTestCaseMapper.selectByExample(example); List<ApiTestCase> apiTestCases = apiTestCaseMapper.selectByExample(example);
@ -517,6 +520,9 @@ public class ApiTestCaseService {
if (CollectionUtils.isEmpty(ids)) { if (CollectionUtils.isEmpty(ids)) {
return; return;
} }
// 尽量保持与用例顺序一致
Collections.reverse(ids);
ApiTestCaseExample example = new ApiTestCaseExample(); ApiTestCaseExample example = new ApiTestCaseExample();
example.createCriteria().andIdIn(ids); example.createCriteria().andIdIn(ids);
List<ApiTestCase> apiTestCases = apiTestCaseMapper.selectByExample(example); List<ApiTestCase> apiTestCases = apiTestCaseMapper.selectByExample(example);

View File

@ -348,6 +348,7 @@ public class TestCaseReviewService {
if (testCaseIds.isEmpty()) { if (testCaseIds.isEmpty()) {
return; return;
} }
// 如果是关联全部指令则根据条件查询未关联的案例 // 如果是关联全部指令则根据条件查询未关联的案例
if (testCaseIds.get(0).equals("all")) { if (testCaseIds.get(0).equals("all")) {
List<TestCase> testCases = extTestCaseMapper.getTestCaseByNotInReview(request.getRequest()); List<TestCase> testCases = extTestCaseMapper.getTestCaseByNotInReview(request.getRequest());
@ -356,6 +357,9 @@ public class TestCaseReviewService {
} }
} }
// 尽量保持与用例顺序一致
Collections.reverse(testCaseIds);
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH); SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
TestCaseReviewTestCaseMapper batchMapper = sqlSession.getMapper(TestCaseReviewTestCaseMapper.class); TestCaseReviewTestCaseMapper batchMapper = sqlSession.getMapper(TestCaseReviewTestCaseMapper.class);
Long nextOrder = ServiceUtils.getNextOrder(request.getReviewId(), extTestReviewCaseMapper::getLastOrder); Long nextOrder = ServiceUtils.getNextOrder(request.getReviewId(), extTestReviewCaseMapper::getLastOrder);

View File

@ -87,6 +87,9 @@ public class TestPlanLoadCaseService {
TestPlanLoadCaseMapper testPlanLoadCaseMapper = sqlSession.getMapper(TestPlanLoadCaseMapper.class); TestPlanLoadCaseMapper testPlanLoadCaseMapper = sqlSession.getMapper(TestPlanLoadCaseMapper.class);
Long nextOrder = ServiceUtils.getNextOrder(request.getTestPlanId(), extTestPlanLoadCaseMapper::getLastOrder); Long nextOrder = ServiceUtils.getNextOrder(request.getTestPlanId(), extTestPlanLoadCaseMapper::getLastOrder);
// 尽量保持与用例顺序一致
Collections.reverse(caseIds);
for (String id : caseIds) { for (String id : caseIds) {
TestPlanLoadCase t = new TestPlanLoadCase(); TestPlanLoadCase t = new TestPlanLoadCase();
t.setId(UUID.randomUUID().toString()); t.setId(UUID.randomUUID().toString());

View File

@ -525,6 +525,9 @@ public class TestPlanService {
return; return;
} }
// 尽量保持与用例顺序一致
Collections.reverse(testCaseIds);
TestCaseExample testCaseExample = new TestCaseExample(); TestCaseExample testCaseExample = new TestCaseExample();
testCaseExample.createCriteria().andIdIn(testCaseIds); testCaseExample.createCriteria().andIdIn(testCaseIds);
List<TestCase> testCaseList = testCaseMapper.selectByExample(testCaseExample); List<TestCase> testCaseList = testCaseMapper.selectByExample(testCaseExample);

View File

@ -71,30 +71,27 @@ name: "TestPlanMinder",
methods: { methods: {
handleAfterMount() { handleAfterMount() {
listenNodeSelected(() => { listenNodeSelected(() => {
let param = { loadSelectNodes(this.getParam(), getPlanCasesForMinder, this.setParamCallback);
request: {
planId: this.planId,
orders: this.condition.orders
},
result: this.result,
isDisable: true
}
loadSelectNodes(param, getPlanCasesForMinder, this.setParamCallback);
}); });
listenBeforeExecCommand((even) => { listenBeforeExecCommand((even) => {
if (even.commandName === 'expandtolevel') { if (even.commandName === 'expandtolevel') {
let level = Number.parseInt(even.commandArgs); let level = Number.parseInt(even.commandArgs);
let param = { handleExpandToLevel(level, even.minder.getRoot(), this.getParam(), getPlanCasesForMinder, this.setParamCallback);
request: {planId: this.planId},
result: this.result,
isDisable: true
}
handleExpandToLevel(level, even.minder.getRoot(), param, getPlanCasesForMinder, this.setParamCallback);
} }
}); });
tagBatch([...this.tags, this.$t('test_track.plan.plan_status_prepare')]); 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) { setParamCallback(data, item) {
if (item.status === 'Pass') { if (item.status === 'Pass') {
data.resource.push(this.$t('test_track.plan_view.pass')); data.resource.push(this.$t('test_track.plan_view.pass'));

View File

@ -74,32 +74,27 @@ name: "TestReviewMinder",
methods: { methods: {
handleAfterMount() { handleAfterMount() {
listenNodeSelected(() => { listenNodeSelected(() => {
let param = { loadSelectNodes(this.getParam(), getReviewCasesForMinder, this.setParamCallback);
request: {
reviewId: this.reviewId,
orders: this.condition.orders
},
result: this.result,
isDisable: true
}
loadSelectNodes(param, getReviewCasesForMinder, this.setParamCallback);
}); });
listenBeforeExecCommand((even) => { listenBeforeExecCommand((even) => {
if (even.commandName === 'expandtolevel') { if (even.commandName === 'expandtolevel') {
let level = Number.parseInt(even.commandArgs); let level = Number.parseInt(even.commandArgs);
let param = { handleExpandToLevel(level, even.minder.getRoot(), this.getParam(), getReviewCasesForMinder, this.setParamCallback);
request: {
reviewId: this.reviewId,
},
result: this.result,
isDisable: true
}
handleExpandToLevel(level, even.minder.getRoot(), param, getReviewCasesForMinder, this.setParamCallback);
} }
}); });
tagBatch([...this.tags, this.$t('test_track.plan.plan_status_prepare')]); 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) { setParamCallback(data, item) {
if (item.reviewStatus === 'Pass') { if (item.reviewStatus === 'Pass') {
data.resource.push(this.$t('test_track.plan_view.pass')); data.resource.push(this.$t('test_track.plan_view.pass'));