Merge branch 'refector'

This commit is contained in:
shiziyuan9527 2020-11-30 14:59:37 +08:00
commit 834baeac31
5 changed files with 66 additions and 21 deletions

View File

@ -39,4 +39,18 @@ public interface ExtTestPlanTestCaseMapper {
List<TestPlanCaseDTO> listTestCaseByProjectIds(@Param("ids") List<String> ids);
TestPlanCaseDTO get(String testPlanTestCaseId);
/**
* 获取完整的测试计划下用例的详细信息
* @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);
}

View File

@ -121,7 +121,9 @@
</select>
<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
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
@ -134,7 +136,8 @@
</include>
</if>
<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 test="request.id != null">
and test_case.id = #{request.id}
@ -210,6 +213,23 @@
</foreach>
</if>
</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 distinct * from test_plan_test_case, test_case
where test_plan_test_case.case_id = test_case.id

View File

@ -83,6 +83,16 @@ public class TestPlanTestCaseController {
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")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void editTestCase(@RequestBody TestPlanTestCaseWithBLOBs testPlanTestCase) {

View File

@ -146,4 +146,8 @@ public class TestPlanTestCaseService {
public int updateTestCaseStates(List<String> ids, String reportStatus) {
return extTestPlanTestCaseMapper.updateTestCaseStates(ids, reportStatus);
}
public TestPlanCaseDTO getTestPlanCase(QueryTestPlanCaseRequest request) {
return extTestPlanTestCaseMapper.getTestPlanTestCase(request);
}
}

View File

@ -473,16 +473,12 @@ export default {
},
getTestCase(index) {
let testCase = this.testCases[index];
// id TestPlanTestCase id
this.result = this.$post('/test/plan/case/get', {id: testCase.id}, response => {
let item = {};
Object.assign(item, testCase);
Object.assign(item, response.data);
item.results = JSON.parse(item.results);
item.steps = JSON.parse(item.steps);
if (item.issues) {
item.issues = JSON.parse(item.issues);
} else {
item.issues = {};
item.issues.hasIssues = false;
}
item.steptResults = [];
for (let i = 0; i < item.steps.length; i++) {
if (item.results[i]) {
@ -492,6 +488,7 @@ export default {
item.steptResults.push(item.steps[i]);
}
this.testCase = item;
})
this.initTest();
this.getIssues(testCase.caseId);
this.stepResultChange();
@ -546,7 +543,7 @@ export default {
this.$post('/test/plan/case/edit', {id: this.testCase.id, reportId: reportId});
},
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;
for (let i = 0; i < this.testCases.length; i++) {
if (this.testCases[i].id === testCase.id) {