feat_测试计划报告新增高级搜索

This commit is contained in:
wxg0103 2021-11-05 21:33:09 +08:00 committed by 刘瑞斌
parent fd5108666c
commit bab9cc98a1
6 changed files with 99 additions and 5 deletions

View File

@ -2,15 +2,106 @@
<!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.ExtTestPlanReportMapper">
<sql id="condition">
<choose>
<when test='${object}.operator == "like"'>
like CONCAT('%', #{${object}.value},'%')
</when>
<when test='${object}.operator == "not like"'>
not like CONCAT('%', #{${object}.value},'%')
</when>
<when test='${object}.operator == "in"'>
in
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test='${object}.operator == "not in"'>
not in
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test='${object}.operator == "between"'>
between #{${object}.value[0]} and #{${object}.value[1]}
</when>
<when test='${object}.operator == "gt"'>
&gt; #{${object}.value}
</when>
<when test='${object}.operator == "lt"'>
&lt; #{${object}.value}
</when>
<when test='${object}.operator == "ge"'>
&gt;= #{${object}.value}
</when>
<when test='${object}.operator == "le"'>
&lt;= #{${object}.value}
</when>
<when test='${object}.operator == "current user"'>
= '${@io.metersphere.commons.utils.SessionUtils@getUserId()}'
</when>
<otherwise>
= #{${object}.value}
</otherwise>
</choose>
</sql>
<sql id="combine">
<if test='${condition}.name != null and (${name} == null or ${name} == "")'>
and tpr.name
<include refid="condition">
<property name="object" value="${condition}.name"/>
</include>
</if>
<if test="${condition}.creator != null">
and tpr.creator
<include refid="condition">
<property name="object" value="${condition}.creator"/>
</include>
</if>
<if test="${condition}.testPlanName != null">
and tp.name
<include refid="condition">
<property name="object" value="${condition}.testPlanName"/>
</include>
</if>
<if test="${condition}.createTime != null">
and tpr.create_time
<include refid="condition">
<property name="object" value="${condition}.createTime"/>
</include>
</if>
<if test="${condition}.status != null">
and tpr.status
<include refid="condition">
<property name="object" value="${condition}.status"/>
</include>
</if>
<if test="${condition}.triggerMode != null">
and tpr.trigger_mode
<include refid="condition">
<property name="object" value="${condition}.triggerMode"/>
</include>
</if>
</sql>
<select id="list" resultType="io.metersphere.track.dto.TestPlanReportDTO"
parameterType="io.metersphere.track.request.report.QueryTestPlanReportRequest">
SELECT tpr.id AS id, tpr.`name` AS `name`, tp.`name` AS testPlanName,
IF(u.name is null,tpr.creator,u.name)AS creator, tpr.is_new, tpr.test_plan_id,
tpr.create_time AS createTime,tpr.trigger_Mode AS triggerMode,tpr.status AS status
tpr.create_time AS createTime,tpr.trigger_mode AS triggerMode,tpr.status AS status
FROM test_plan tp
INNER JOIN test_plan_report tpr on tp.id = tpr.test_plan_id
LEFT JOIN user u on tpr.creator = u.id
<where>
<if test="combine != null">
<include refid="combine">
<property name="condition" value="combine"/>
<property name="name" value="name"/>
</include>
</if>
<if test="name != null">
and tpr.name like CONCAT('%', #{name},'%')
</if>

View File

@ -15,7 +15,7 @@ import java.util.Map;
*/
@Getter
@Setter
@Data
public class QueryTestPlanReportRequest {
private String name;
private String testPlanName;
@ -23,6 +23,8 @@ public class QueryTestPlanReportRequest {
private String workspaceId;
private String projectId;
private Map<String, Object> combine;
private List<OrderRequest> orders;
private Map<String, List<String>> filters;

View File

@ -575,7 +575,6 @@ export default {
});
}
} else{
this.$store.state.apiMap.delete(tabs[1].api.id);
this.handleTabRemove(targetName);
}

View File

@ -457,6 +457,7 @@ export const TEST_PLAN_TRIGGER_MODE = {
options: [
{label: 'test_track.report.trigger_mode.manual', value: 'manual'},
{label: 'test_track.report.trigger_mode.automation', value: 'automation'},
{label: "commons.trigger_mode.schedule", value: "SCHEDULE"},
],
props: {
multiple: true

View File

@ -13,6 +13,7 @@
import TestPlanReportList from './components/TestPlanReportList';
import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import {TEST_PLAN_REPORT_CONFIGS} from "@/business/components/common/components/search/search-components";
export default {
name: "TestPlanReport",
@ -32,7 +33,7 @@ export default {
},
methods: {
refreshTestPlanList() {
this.$refs.testPlanReportList.condition = {};
this.$refs.testPlanReportList.condition = {components: TEST_PLAN_REPORT_CONFIGS};
this.$refs.testPlanReportList.initTableData();
}
}

View File

@ -142,7 +142,7 @@ export default {
}
},
activated() {
this.components = TEST_PLAN_REPORT_CONFIGS;
},
created() {
this.projectId = this.$route.params.projectId;