fix: 导入导出图标交换,jenkins按计划查询,模块全部查询

This commit is contained in:
wenyann 2020-07-17 14:05:19 +08:00
parent 042b97b838
commit b5dc9ff8ff
5 changed files with 56 additions and 5 deletions

View File

@ -18,6 +18,8 @@ public interface ExtTestPlanTestCaseMapper {
List<TestPlanCaseDTO> listByNode(@Param("request") QueryTestPlanCaseRequest request);
List<TestPlanCaseDTO> listByNodes(@Param("request") QueryTestPlanCaseRequest request);
List<String> findRelateTestPlanId(@Param("userId") String userId, @Param("workspaceId") String workspaceId);
List<TestPlanCaseDTO> getRecentTestedTestCase(@Param("request") QueryTestPlanCaseRequest request);

View File

@ -2,7 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper">
<select id="getReportMetric" parameterType="java.lang.String" resultType="io.metersphere.track.dto.TestCaseReportStatusResultDTO">
<select id="getReportMetric" parameterType="java.lang.String"
resultType="io.metersphere.track.dto.TestCaseReportStatusResultDTO">
select count(t1.id) as `count`, t1.status
from test_plan_test_case t1
inner join test_case t2
@ -45,6 +46,9 @@
<if test="request.planId != null">
and test_plan_test_case.plan_id = #{request.planId}
</if>
<if test="request.method != null">
and test_case.method = #{request.method}
</if>
<if test="request.filters != null and request.filters.size() > 0">
<foreach collection="request.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">
@ -84,6 +88,27 @@
</where>
</select>
<select id="listByNodes" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
select test_plan_test_case.*, test_case.*
from test_plan_test_case
inner join test_case on test_plan_test_case.case_id = test_case.id
<where>
<if test="request.planId != null">
and test_plan_test_case.plan_id = #{request.planId}
</if>
<if test="request.method != null">
and test_case.method = #{request.method}
</if>
<if test="request.nodePaths != null and request.nodePaths.size() > 0">
and
<foreach collection="request.nodePaths" item="nodePaths" separator="or" index="index">
test_case.node_path like concat('%',#{nodePaths},'%')
</foreach>
</if>
</where>
</select>
<select id="findRelateTestPlanId" resultType="java.lang.String">

View File

@ -33,9 +33,16 @@ public class TestPlanTestCaseController {
return PageUtils.setPageInfo(page, testPlanTestCaseService.list(request));
}
/*jenkins测试计划下的测试用例*/
@GetMapping("/list/{planId}")
public List<TestPlanCaseDTO> getTestPlanCaseByPlanId(@PathVariable String planId) {
QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest();
request.setPlanId(planId);
request.setMethod("auto");
return testPlanTestCaseService.list(request);
}
@GetMapping("/list/node/{planId}/{nodePaths}")
public List<TestPlanCaseDTO> getTestPlanCases(@PathVariable String planId, @PathVariable String nodePaths) {
public List<TestPlanCaseDTO> getTestPlanCasesByNodePath(@PathVariable String planId, @PathVariable String nodePaths) {
String nodePath = nodePaths.replace("f", "/");
String[] array = nodePath.split(",");
List<String> list = Arrays.asList(array);
@ -46,6 +53,18 @@ public class TestPlanTestCaseController {
return testPlanTestCaseService.listByNode(request);
}
@GetMapping("/list/node/all/{planId}/{nodePaths}")
public List<TestPlanCaseDTO> getTestPlanCasesByNodePaths(@PathVariable String planId, @PathVariable String nodePaths) {
String nodePath = nodePaths.replace("f", "");
String[] array = nodePath.split(",");
List<String> list = Arrays.asList(array);
QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest();
request.setPlanId(planId);
request.setNodePaths(list);
request.setMethod("auto");
return testPlanTestCaseService.listByNodes(request);
}
@GetMapping("/get/{caseId}")
public TestPlanCaseDTO getTestPlanCases(@PathVariable String caseId) {
return testPlanTestCaseService.get(caseId);

View File

@ -60,6 +60,11 @@ public class TestPlanTestCaseService {
return list;
}
public List<TestPlanCaseDTO> listByNodes(QueryTestPlanCaseRequest request) {
List<TestPlanCaseDTO> list = extTestPlanTestCaseMapper.listByNodes(request);
return list;
}
public void editTestCase(TestPlanTestCaseWithBLOBs testPlanTestCase) {
if (StringUtils.equals(TestPlanTestCaseStatus.Prepare.name(), testPlanTestCase.getStatus())) {
testPlanTestCase.setStatus(TestPlanTestCaseStatus.Underway.name());

View File

@ -10,9 +10,9 @@
<node-breadcrumb class="table-title" :nodes="selectParentNodes" @refresh="refresh"/>
</template>
<template v-slot:button>
<ms-table-button :is-tester-permission="true" icon="el-icon-upload2"
:content="$t('test_track.case.import.import')" @click="importTestCase"/>
<ms-table-button :is-tester-permission="true" icon="el-icon-download"
:content="$t('test_track.case.import.import')" @click="importTestCase"/>
<ms-table-button :is-tester-permission="true" icon="el-icon-upload2"
:content="$t('test_track.case.export.export')" @click="handleBatch('export')"/>
<ms-table-button :is-tester-permission="true" icon="el-icon-right" :content="$t('test_track.case.move')"
@click="handleBatch('move')"/>