refactor(测试跟踪): 优化查询
This commit is contained in:
parent
7659f1d11b
commit
5d1ecc51d1
|
@ -38,4 +38,18 @@ public interface ExtTestPlanTestCaseMapper {
|
||||||
*/
|
*/
|
||||||
List<TestPlanCaseDTO> listTestCaseByProjectIds(@Param("ids") List<String> ids);
|
List<TestPlanCaseDTO> listTestCaseByProjectIds(@Param("ids") List<String> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取完整的测试计划下用例的详细信息
|
||||||
|
* @param request id(test_plan_test_case.id) 不能为空
|
||||||
|
* @return TestPlanCaseDTO
|
||||||
|
*/
|
||||||
|
TestPlanCaseDTO getTestPlanTestCase(@Param("request") QueryTestPlanCaseRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取测试计划下的 TestPlanTestCaseID 和 TestCaseName
|
||||||
|
* @param request planId 不能为空
|
||||||
|
* @return List<TestPlanCaseDTO>
|
||||||
|
*/
|
||||||
|
List<TestPlanCaseDTO> getTestPlanTestCaseList(@Param("request") QueryTestPlanCaseRequest request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,9 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="list" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
|
<select id="list" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
|
||||||
select test_case.remark, test_plan_test_case.id as id, test_plan_test_case.*,test_case.*,test_case_node.name as model, project.name as projectName
|
select test_plan_test_case.id as id, test_case.id as caseId, test_case.name, test_case.priority, test_case.type,
|
||||||
|
test_case.node_path, test_case.method, test_case.num, test_plan_test_case.executor, test_plan_test_case.status,
|
||||||
|
test_plan_test_case.update_time, test_case_node.name as model, project.name as projectName, test_plan_test_case.plan_id as planId
|
||||||
from test_plan_test_case
|
from test_plan_test_case
|
||||||
inner join test_case on test_plan_test_case.case_id = test_case.id
|
inner join test_case on test_plan_test_case.case_id = test_case.id
|
||||||
left join test_case_node on test_case_node.id=test_case.node_id
|
left join test_case_node on test_case_node.id=test_case.node_id
|
||||||
|
@ -134,7 +136,8 @@
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
<if test="request.name != null">
|
<if test="request.name != null">
|
||||||
and (test_case.name like CONCAT('%', #{request.name},'%') or test_case.num like CONCAT('%', #{request.name},'%'))
|
and (test_case.name like CONCAT('%', #{request.name},'%') or test_case.num like
|
||||||
|
CONCAT('%',#{request.name},'%'))
|
||||||
</if>
|
</if>
|
||||||
<if test="request.id != null">
|
<if test="request.id != null">
|
||||||
and test_case.id = #{request.id}
|
and test_case.id = #{request.id}
|
||||||
|
@ -210,6 +213,23 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getTestPlanTestCase" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
|
||||||
|
select test_case.remark, test_plan_test_case.id as id, test_plan_test_case.*,test_case.*,test_case_node.name as model, project.name as projectName
|
||||||
|
from test_plan_test_case
|
||||||
|
inner join test_case on test_plan_test_case.case_id = test_case.id
|
||||||
|
left join test_case_node on test_case_node.id=test_case.node_id
|
||||||
|
inner join project on project.id = test_case.project_id
|
||||||
|
where test_plan_test_case.id = #{request.id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getTestPlanTestCaseList" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
|
||||||
|
select test_plan_test_case.id as id, test_case.name
|
||||||
|
from test_plan_test_case
|
||||||
|
inner join test_case on test_plan_test_case.case_id = test_case.id
|
||||||
|
where test_plan_test_case.plan_id = #{request.planId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="listTestCaseByProjectIds" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
|
<select id="listTestCaseByProjectIds" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
|
||||||
select distinct * from test_plan_test_case, test_case
|
select distinct * from test_plan_test_case, test_case
|
||||||
where test_plan_test_case.case_id = test_case.id
|
where test_plan_test_case.case_id = test_case.id
|
||||||
|
|
|
@ -83,6 +83,16 @@ public class TestPlanTestCaseController {
|
||||||
return testPlanTestCaseService.list(request);
|
return testPlanTestCaseService.list(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/list/ids")
|
||||||
|
public List<TestPlanCaseDTO> getTestPlanCaseIds(@RequestBody QueryTestPlanCaseRequest request) {
|
||||||
|
return testPlanTestCaseService.list(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/get")
|
||||||
|
public TestPlanCaseDTO getTestPlanCase(@RequestBody QueryTestPlanCaseRequest request) {
|
||||||
|
return testPlanTestCaseService.getTestPlanCase(request);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||||
public void editTestCase(@RequestBody TestPlanTestCaseWithBLOBs testPlanTestCase) {
|
public void editTestCase(@RequestBody TestPlanTestCaseWithBLOBs testPlanTestCase) {
|
||||||
|
|
|
@ -148,4 +148,8 @@ public class TestPlanTestCaseService {
|
||||||
public int updateTestCaseStates(List<String> ids, String reportStatus) {
|
public int updateTestCaseStates(List<String> ids, String reportStatus) {
|
||||||
return extTestPlanTestCaseMapper.updateTestCaseStates(ids, reportStatus);
|
return extTestPlanTestCaseMapper.updateTestCaseStates(ids, reportStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TestPlanCaseDTO getTestPlanCase(QueryTestPlanCaseRequest request) {
|
||||||
|
return extTestPlanTestCaseMapper.getTestPlanTestCase(request);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 57d6f78efa4b0300be188e8b024511ceef0873ed
|
Subproject commit bb494fc68a2367359c9048fa7250c7618de4afb6
|
|
@ -473,25 +473,22 @@ export default {
|
||||||
},
|
},
|
||||||
getTestCase(index) {
|
getTestCase(index) {
|
||||||
let testCase = this.testCases[index];
|
let testCase = this.testCases[index];
|
||||||
let item = {};
|
// id 为 TestPlanTestCase 的 id
|
||||||
Object.assign(item, testCase);
|
this.result = this.$post('/test/plan/case/get', {id: testCase.id}, response => {
|
||||||
item.results = JSON.parse(item.results);
|
let item = {};
|
||||||
item.steps = JSON.parse(item.steps);
|
Object.assign(item, response.data);
|
||||||
if (item.issues) {
|
item.results = JSON.parse(item.results);
|
||||||
item.issues = JSON.parse(item.issues);
|
item.steps = JSON.parse(item.steps);
|
||||||
} else {
|
item.steptResults = [];
|
||||||
item.issues = {};
|
for (let i = 0; i < item.steps.length; i++) {
|
||||||
item.issues.hasIssues = false;
|
if (item.results[i]) {
|
||||||
}
|
item.steps[i].actualResult = item.results[i].actualResult;
|
||||||
item.steptResults = [];
|
item.steps[i].executeResult = item.results[i].executeResult;
|
||||||
for (let i = 0; i < item.steps.length; i++) {
|
}
|
||||||
if (item.results[i]) {
|
item.steptResults.push(item.steps[i]);
|
||||||
item.steps[i].actualResult = item.results[i].actualResult;
|
|
||||||
item.steps[i].executeResult = item.results[i].executeResult;
|
|
||||||
}
|
}
|
||||||
item.steptResults.push(item.steps[i]);
|
this.testCase = item;
|
||||||
}
|
})
|
||||||
this.testCase = item;
|
|
||||||
this.initTest();
|
this.initTest();
|
||||||
this.getIssues(testCase.caseId);
|
this.getIssues(testCase.caseId);
|
||||||
this.stepResultChange();
|
this.stepResultChange();
|
||||||
|
@ -546,7 +543,7 @@ export default {
|
||||||
this.$post('/test/plan/case/edit', {id: this.testCase.id, reportId: reportId});
|
this.$post('/test/plan/case/edit', {id: this.testCase.id, reportId: reportId});
|
||||||
},
|
},
|
||||||
initData(testCase) {
|
initData(testCase) {
|
||||||
this.result = this.$post('/test/plan/case/list/all', this.searchParam, response => {
|
this.result = this.$post('/test/plan/case/list/ids', this.searchParam, response => {
|
||||||
this.testCases = response.data;
|
this.testCases = response.data;
|
||||||
for (let i = 0; i < this.testCases.length; i++) {
|
for (let i = 0; i < this.testCases.length; i++) {
|
||||||
if (this.testCases[i].id === testCase.id) {
|
if (this.testCases[i].id === testCase.id) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 71d57ae5d7f8bb5c93a29504ac6f2300dc189ce9
|
Subproject commit 8a972a198775b3783ed6e4cef27197e53d1ebdc8
|
Loading…
Reference in New Issue