提交 08d3ec19 编写于 作者: C chenjianxing

测试详筛选排序

上级 f014d526
......@@ -15,7 +15,5 @@ public interface ExtTestCaseMapper {
List<TestCase> getTestCaseNames(@Param("request") QueryTestCaseRequest request);
List<TestPlanCaseDTO> getTestPlanTestCases(@Param("request") QueryTestPlanCaseRequest request);
List<TestCaseDTO> list(@Param("request") QueryTestCaseRequest request);
}
......@@ -20,33 +20,8 @@
ORDER BY test_case.update_time DESC
</select>
<select id="getTestPlanTestCases" resultType="io.metersphere.dto.TestPlanCaseDTO">
select t1.id as id, t1.plan_id as planId, t1.executor as executor, t1.status as status, t1.results as results, t1.create_time as createTime, t1.update_time updateTime,
t2.id as caseId, t2.node_id as nodeId, t2.node_path as nodePath, t2.project_id as projectId, t2.name as name, t2.remark remark, t2.steps steps,
t2.type as type, t2.maintainer as maintainer, t2.priority as priority, t2.method as method, t2.prerequisite as prerequisite
from test_plan_test_case as t1
inner join test_case as t2 on
t1.plan_id = #{request.planId}
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
and t2.node_id in
<foreach collection="request.nodeIds" open="(" close=")" separator="," item="nodeId">
#{nodeId}
</foreach>
</if>
and t1.case_id = t2.id
<if test="request.name != null">
and t2.name like CONCAT('%', #{request.name},'%')
</if>
<if test="request.executor != null">
and t1.executor = #{request.executor}
</if>
</select>
<select id="list" resultType="io.metersphere.dto.TestCaseDTO">
select test_case.*, user.name as maintainerName
from test_case
left join user on test_case.maintainer = user.id
select test_case.* from test_case
<where>
<if test="request.name != null">
and test_case.name like CONCAT('%', #{request.name},'%')
......
package io.metersphere.base.mapper.ext;
import io.metersphere.controller.request.testplancase.QueryTestPlanCaseRequest;
import io.metersphere.dto.TestCaseReportStatusResultDTO;
import io.metersphere.dto.TestPlanCaseDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -10,4 +12,7 @@ public interface ExtTestPlanTestCaseMapper {
List<TestCaseReportStatusResultDTO> getReportMetric(@Param("planId") String planId);
List<String> getExecutors(@Param("planId") String planId);
List<TestPlanCaseDTO> list(@Param("request") QueryTestPlanCaseRequest request);
}
......@@ -19,5 +19,41 @@
and plan_id = #{planId};
</select>
<select id="list" resultType="io.metersphere.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.name != null">
and test_plan_test_case.name like CONCAT('%', #{request.name},'%')
</if>
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
and test_plan_test_case.node_id in
<foreach collection="request.nodeIds" item="nodeId" separator="," open="(" close=")">
#{nodeId}
</foreach>
</if>
<if test="request.planId != null">
and test_plan_test_case.plan_id = #{request.planId}
</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">
and ${key} in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</if>
</foreach>
</if>
</where>
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
test_plan_test_case.${order.name} ${order.type}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -5,5 +5,5 @@ import lombok.Data;
@Data
public class OrderRequest {
private String name;
private String value;
private String type;
}
......@@ -5,6 +5,7 @@ import io.metersphere.controller.request.OrderRequest;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class QueryTestPlanCaseRequest extends TestPlanTestCase {
......@@ -13,6 +14,8 @@ public class QueryTestPlanCaseRequest extends TestPlanTestCase {
private List<OrderRequest> orders;
private Map<String, List<String>> filters;
private String workspaceId;
private String name;
......
......@@ -112,7 +112,7 @@ public class TestCaseReportService {
QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest();
request.setPlanId(planId);
List<TestPlanCaseDTO> testPlanTestCases = extTestCaseMapper.getTestPlanTestCases(request);
List<TestPlanCaseDTO> testPlanTestCases = extTestPlanTestCaseMapper.list(request);
Map<String, TestCaseReportModuleResultDTO> moduleResultMap = new HashMap<>();
......
......@@ -4,6 +4,7 @@ import io.metersphere.base.domain.TestPlanTestCase;
import io.metersphere.base.domain.TestPlanTestCaseExample;
import io.metersphere.base.mapper.TestPlanTestCaseMapper;
import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper;
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.controller.request.testcase.TestPlanCaseBatchRequest;
......@@ -24,10 +25,10 @@ public class TestPlanTestCaseService {
TestPlanTestCaseMapper testPlanTestCaseMapper;
@Resource
ExtTestCaseMapper extTestCaseMapper;
ExtTestPlanTestCaseMapper extTestPlanTestCaseMapper;
public List<TestPlanCaseDTO> getTestPlanCases(QueryTestPlanCaseRequest request) {
return extTestCaseMapper.getTestPlanTestCases(request);
return extTestPlanTestCaseMapper.list(request);
}
public void editTestCase(TestPlanTestCase testPlanTestCase) {
......
......@@ -22,6 +22,8 @@
<el-table
@select-all="handleSelectAll"
@filter-change="filter"
@sort-change="sort"
@select="handleSelectionChange"
row-key="id"
:data="tableData">
......@@ -37,7 +39,7 @@
<el-table-column
prop="priority"
:filters="priorityFilters"
:filter-method="filter"
column-key="priority"
:label="$t('test_track.case.priority')">
<template v-slot:default="scope">
<priority-table-item :value="scope.row.priority" ref="priority"/>
......@@ -47,7 +49,7 @@
<el-table-column
prop="type"
:filters="typeFilters"
:filter-method="filter"
column-key="type"
:label="$t('test_track.case.type')"
show-overflow-tooltip>
<template v-slot:default="scope">
......@@ -58,7 +60,7 @@
<el-table-column
prop="method"
:filters="methodFilters"
:filter-method="filter"
column-key="method"
:label="$t('test_track.case.method')"
show-overflow-tooltip>
<template v-slot:default="scope">
......@@ -74,7 +76,7 @@
<el-table-column
prop="status"
:filters="statusFilters"
:filter-method="filter"
column-key="status"
:label="$t('test_track.plan_view.execute_result')">
<template v-slot:default="scope">
<status-table-item :value="scope.row.status"/>
......@@ -125,7 +127,7 @@
import NodeBreadcrumb from '../../../common/NodeBreadcrumb';
import {TokenKey} from '../../../../../../common/js/constants';
import {tableFilter} from '../../../../../../common/js/utils';
import {humpToLine, tableFilter} from '../../../../../../common/js/utils';
import PriorityTableItem from "../../../common/tableItems/planview/PriorityTableItem";
import StatusTableItem from "../../../common/tableItems/planview/StatusTableItem";
import TypeTableItem from "../../../common/tableItems/planview/TypeTableItem";
......@@ -295,10 +297,10 @@
}
this.initTableData();
},
filter(value, row, column) {
const property = column['property'];
return row[property] === value;
},
// filter(value, row, column) {
// const property = column['property'];
// return row[property] === value;
// },
openTestReport() {
this.$refs.testReporTtemplateList.open();
},
......@@ -316,6 +318,42 @@
id = this.testPlan.reportId;
}
this.$refs.testCaseReportView.open(id);
},
filter(filters) {
if (!this.condition.filters) {
this.condition.filters = {};
}
for(let filter in filters) {
if (filters[filter] && filters[filter].length > 0) {
this.condition.filters[filter] = filters[filter];
} else {
this.condition.filters[filter] = null;
}
}
this.initTableData();
},
sort(column) {
column.prop = humpToLine(column.prop);
if (column.order == 'descending') {
column.order = 'desc';
} else {
column.order = 'asc';
}
if (!this.condition.orders) {
this.condition.orders = [];
}
let hasProp = false;
this.condition.orders.forEach(order => {
if (order.name == column.prop) {
order.type = column.order;
hasProp = true;
return;
}
});
if (!hasProp) {
this.condition.orders.push({name: column.prop, type: column.order});
}
this.initTableData();
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册