fix(测试计划): 查询问题#1005198

--bug=1005198 --user=lyh 【测试跟踪】有一个测试计划进入详情后没显示名称
https://www.tapd.cn/55049933/s/1025888
This commit is contained in:
shiziyuan9527 2021-07-19 16:28:34 +08:00 committed by 刘瑞斌
parent 499d062784
commit 8127cab0c9
3 changed files with 11 additions and 19 deletions

View File

@ -63,9 +63,8 @@ public class TestPlanController {
}
@PostMapping("/list/all")
public List<TestPlan> listAll() {
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
return testPlanService.listTestAllPlan(currentWorkspaceId);
public List<TestPlan> listAll(@RequestBody QueryTestPlanRequest request) {
return testPlanService.listTestAllPlan(request);
}
@PostMapping("/list/all/relate")

View File

@ -560,23 +560,15 @@ public class TestPlanService {
return extTestPlanMapper.listRecent(SessionUtils.getUserId(), projectId);
}
public List<TestPlan> listTestAllPlan(String currentWorkspaceId) {
if (StringUtils.isNotBlank(SessionUtils.getCurrentProjectId())) {
TestPlanExample testPlanExample = new TestPlanExample();
TestPlanExample.Criteria criteria = testPlanExample.createCriteria();
criteria.andProjectIdEqualTo(SessionUtils.getCurrentProjectId());
List<TestPlan> testPlans = testPlanMapper.selectByExample(testPlanExample);
if (!CollectionUtils.isEmpty(testPlans)) {
List<String> testPlanIds = testPlans.stream().map(TestPlan::getId).collect(Collectors.toList());
TestPlanExample testPlanExample1 = new TestPlanExample();
TestPlanExample.Criteria testPlanCriteria = testPlanExample1.createCriteria();
testPlanCriteria.andWorkspaceIdEqualTo(currentWorkspaceId);
testPlanCriteria.andIdIn(testPlanIds);
return testPlanMapper.selectByExample(testPlanExample1);
}
public List<TestPlan> listTestAllPlan(QueryTestPlanRequest request) {
String projectId = request.getProjectId();
if (StringUtils.isBlank(projectId)) {
return new ArrayList<>();
}
return new ArrayList<>();
TestPlanExample example = new TestPlanExample();
example.createCriteria().andProjectIdEqualTo(projectId);
return testPlanMapper.selectByExample(example);
}
public List<TestPlanDTOWithMetric> listRelateAllPlan() {

View File

@ -48,6 +48,7 @@ import TestPlanApi from "./comonents/api/TestPlanApi";
import TestCaseStatisticsReportView from "./comonents/report/statistics/TestCaseStatisticsReportView";
import TestReportTemplateList from "./comonents/TestReportTemplateList";
import TestPlanLoad from "@/business/components/track/plan/view/comonents/load/TestPlanLoad";
import {getCurrentProjectID} from "@/common/js/utils";
export default {
name: "TestPlanView",
@ -114,7 +115,7 @@ export default {
}
},
getTestPlans() {
this.$post('/test/plan/list/all', {}, response => {
this.$post('/test/plan/list/all', {projectId: getCurrentProjectID()}, response => {
this.testPlans = response.data;
this.testPlans.forEach(plan => {
if (this.planId && plan.id === this.planId) {