feat(接口测试): 接口测试场景/接口报告新增高级搜索

This commit is contained in:
WangXu10 2024-11-05 11:33:32 +08:00 committed by Craftsman
parent 33b82819ef
commit 51c84875c9
6 changed files with 130 additions and 6 deletions

View File

@ -10,13 +10,16 @@ import io.metersphere.system.dto.sdk.ApiReportMessageDTO;
import io.metersphere.system.dto.taskcenter.TaskCenterDTO; import io.metersphere.system.dto.taskcenter.TaskCenterDTO;
import io.metersphere.system.dto.taskcenter.request.TaskCenterBatchRequest; import io.metersphere.system.dto.taskcenter.request.TaskCenterBatchRequest;
import io.metersphere.system.dto.taskcenter.request.TaskCenterPageRequest; import io.metersphere.system.dto.taskcenter.request.TaskCenterPageRequest;
import io.metersphere.system.interceptor.BaseConditionFilter;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
public interface ExtApiReportMapper { public interface ExtApiReportMapper {
@BaseConditionFilter
List<ApiReport> list(@Param("request") ApiReportPageRequest request); List<ApiReport> list(@Param("request") ApiReportPageRequest request);
@BaseConditionFilter
List<String> getIds(@Param("request") ApiReportBatchRequest request); List<String> getIds(@Param("request") ApiReportBatchRequest request);
List<ApiReport> selectApiReportByIds(@Param("ids") List<String> ids); List<ApiReport> selectApiReportByIds(@Param("ids") List<String> ids);

View File

@ -41,6 +41,9 @@
<include refid="filters"> <include refid="filters">
<property name="filter" value="request.filter"/> <property name="filter" value="request.filter"/>
</include> </include>
<include refid="combine">
<property name="combineSearch" value="request.combineSearch"/>
</include>
</select> </select>
<select id="getIds" resultType="java.lang.String"> <select id="getIds" resultType="java.lang.String">
select select
@ -58,6 +61,9 @@
<include refid="filters"> <include refid="filters">
<property name="filter" value="request.condition.filter"/> <property name="filter" value="request.condition.filter"/>
</include> </include>
<include refid="combine">
<property name="combineSearch" value="request.condition.combineSearch"/>
</include>
</select> </select>
<select id="selectApiReportByIds" resultType="io.metersphere.api.domain.ApiReport"> <select id="selectApiReportByIds" resultType="io.metersphere.api.domain.ApiReport">
select select
@ -283,4 +289,53 @@
</if> </if>
</select> </select>
<sql id="combine">
<trim prefix="AND">
<trim prefix="(" suffix=")" suffixOverrides="AND|OR">
<if test="${combineSearch} != null">
<foreach collection="${combineSearch}.userViewConditions" item="condition">
<if test="condition.name == 'createUser'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/>
<property name="column" value="ar.create_user"/>
</include>
</if>
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
<property name="searchMode" value="${combineSearch}.searchMode"/>
</include>
</foreach>
<foreach collection="${combineSearch}.systemFieldConditions" item="condition">
<include refid="io.metersphere.system.mapper.BaseMapper.commonSystemFieldConditions">
<property name="condition" value="condition"/>
<property name="tablePrefix" value="ar"/>
</include>
<!-- 报告类型 -->
<if test="condition.name == 'integrated'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/>
<property name="column" value="ar.integrated"/>
</include>
</if>
<!-- 执行结果 -->
<if test="condition.name == 'status'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/>
<property name="column" value="ar.status"/>
</include>
</if>
<!-- 触发方式 -->
<if test="condition.name == 'triggerMode'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/>
<property name="column" value="ar.trigger_mode"/>
</include>
</if>
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
<property name="searchMode" value="${combineSearch}.searchMode"/>
</include>
</foreach>
</if>
</trim>
</trim>
</sql>
</mapper> </mapper>

View File

@ -11,13 +11,16 @@ import io.metersphere.system.dto.sdk.ApiReportMessageDTO;
import io.metersphere.system.dto.taskcenter.TaskCenterDTO; import io.metersphere.system.dto.taskcenter.TaskCenterDTO;
import io.metersphere.system.dto.taskcenter.request.TaskCenterBatchRequest; import io.metersphere.system.dto.taskcenter.request.TaskCenterBatchRequest;
import io.metersphere.system.dto.taskcenter.request.TaskCenterPageRequest; import io.metersphere.system.dto.taskcenter.request.TaskCenterPageRequest;
import io.metersphere.system.interceptor.BaseConditionFilter;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
public interface ExtApiScenarioReportMapper { public interface ExtApiScenarioReportMapper {
@BaseConditionFilter
List<ApiScenarioReport> list(@Param("request") ApiReportPageRequest request); List<ApiScenarioReport> list(@Param("request") ApiReportPageRequest request);
@BaseConditionFilter
List<String> getIds(@Param("request") ApiReportBatchRequest request); List<String> getIds(@Param("request") ApiReportBatchRequest request);
List<ApiScenarioReport> selectApiReportByIds(@Param("ids") List<String> ids); List<ApiScenarioReport> selectApiReportByIds(@Param("ids") List<String> ids);

View File

@ -40,6 +40,9 @@
<include refid="filters"> <include refid="filters">
<property name="filter" value="request.filter"/> <property name="filter" value="request.filter"/>
</include> </include>
<include refid="combine">
<property name="combineSearch" value="request.combineSearch"/>
</include>
</select> </select>
<select id="getIds" resultType="java.lang.String"> <select id="getIds" resultType="java.lang.String">
select select
@ -57,6 +60,9 @@
<include refid="filters"> <include refid="filters">
<property name="filter" value="request.condition.filter"/> <property name="filter" value="request.condition.filter"/>
</include> </include>
<include refid="combine">
<property name="combineSearch" value="request.condition.combineSearch"/>
</include>
</select> </select>
<select id="selectApiReportByIds" resultType="io.metersphere.api.domain.ApiScenarioReport"> <select id="selectApiReportByIds" resultType="io.metersphere.api.domain.ApiScenarioReport">
select select
@ -321,4 +327,55 @@
</if> </if>
</sql> </sql>
<sql id="combine">
<trim prefix="AND">
<trim prefix="(" suffix=")" suffixOverrides="AND|OR">
<if test="${combineSearch} != null">
<foreach collection="${combineSearch}.userViewConditions" item="condition">
<if test="condition.name == 'createUser'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/>
<property name="column" value="asr.create_user"/>
</include>
</if>
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
<property name="searchMode" value="${combineSearch}.searchMode"/>
</include>
</foreach>
<foreach collection="${combineSearch}.systemFieldConditions" item="condition">
<include refid="io.metersphere.system.mapper.BaseMapper.commonSystemFieldConditions">
<property name="condition" value="condition"/>
<property name="tablePrefix" value="asr"/>
</include>
<!-- 报告类型 -->
<if test="condition.name == 'integrated'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/>
<property name="column" value="asr.integrated"/>
</include>
</if>
<!-- 执行结果 -->
<if test="condition.name == 'status'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/>
<property name="column" value="asr.status"/>
</include>
</if>
<!-- 触发方式 -->
<if test="condition.name == 'triggerMode'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/>
<property name="column" value="asr.trigger_mode"/>
</include>
</if>
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
<property name="searchMode" value="${combineSearch}.searchMode"/>
</include>
</foreach>
</if>
</trim>
</trim>
</sql>
</mapper> </mapper>

View File

@ -69,6 +69,12 @@ public enum UserViewType implements ValueEnum {
* 测试计划报告 * 测试计划报告
*/ */
TEST_PLAN_REPORT("test-plan-report", TEST_PLAN_REPORT("test-plan-report",
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)),
/**
* 接口报告
*/
API_REPORT("api-report",
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)); List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE));
private String value; private String value;

View File

@ -469,7 +469,7 @@
<if test="condition.name == 'createUser'"> <if test="condition.name == 'createUser'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition"> <include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/> <property name="condition" value="condition"/>
<property name="column" value="t.create_user"/> <property name="column" value="tpr.create_user"/>
</include> </include>
</if> </if>
<include refid="io.metersphere.system.mapper.BaseMapper.queryType"> <include refid="io.metersphere.system.mapper.BaseMapper.queryType">
@ -485,35 +485,35 @@
<if test="condition.name == 'integrated'"> <if test="condition.name == 'integrated'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition"> <include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/> <property name="condition" value="condition"/>
<property name="column" value="trp.integrated"/> <property name="column" value="tpr.integrated"/>
</include> </include>
</if> </if>
<!-- 测试计划名称 --> <!-- 测试计划名称 -->
<if test="condition.name == 'testPlanName'"> <if test="condition.name == 'testPlanName'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition"> <include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/> <property name="condition" value="condition"/>
<property name="column" value="trp.test_plan_name"/> <property name="column" value="tpr.test_plan_name"/>
</include> </include>
</if> </if>
<!-- 执行结果 --> <!-- 执行结果 -->
<if test="condition.name == 'resultStatus'"> <if test="condition.name == 'resultStatus'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition"> <include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/> <property name="condition" value="condition"/>
<property name="column" value="trp.result_status"/> <property name="column" value="tpr.result_status"/>
</include> </include>
</if> </if>
<!-- 通过率 --> <!-- 通过率 -->
<if test="condition.name == 'passRate'"> <if test="condition.name == 'passRate'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition"> <include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/> <property name="condition" value="condition"/>
<property name="column" value="trp.pass_rate"/> <property name="column" value="tpr.pass_rate"/>
</include> </include>
</if> </if>
<!-- 触发方式 --> <!-- 触发方式 -->
<if test="condition.name == 'triggerMode'"> <if test="condition.name == 'triggerMode'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition"> <include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/> <property name="condition" value="condition"/>
<property name="column" value="trp.trigger_mode"/> <property name="column" value="tpr.trigger_mode"/>
</include> </include>
</if> </if>
<include refid="io.metersphere.system.mapper.BaseMapper.queryType"> <include refid="io.metersphere.system.mapper.BaseMapper.queryType">