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.request.TaskCenterBatchRequest;
import io.metersphere.system.dto.taskcenter.request.TaskCenterPageRequest;
import io.metersphere.system.interceptor.BaseConditionFilter;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtApiReportMapper {
@BaseConditionFilter
List<ApiReport> list(@Param("request") ApiReportPageRequest request);
@BaseConditionFilter
List<String> getIds(@Param("request") ApiReportBatchRequest request);
List<ApiReport> selectApiReportByIds(@Param("ids") List<String> ids);

View File

@ -41,6 +41,9 @@
<include refid="filters">
<property name="filter" value="request.filter"/>
</include>
<include refid="combine">
<property name="combineSearch" value="request.combineSearch"/>
</include>
</select>
<select id="getIds" resultType="java.lang.String">
select
@ -58,6 +61,9 @@
<include refid="filters">
<property name="filter" value="request.condition.filter"/>
</include>
<include refid="combine">
<property name="combineSearch" value="request.condition.combineSearch"/>
</include>
</select>
<select id="selectApiReportByIds" resultType="io.metersphere.api.domain.ApiReport">
select
@ -283,4 +289,53 @@
</if>
</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>

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.request.TaskCenterBatchRequest;
import io.metersphere.system.dto.taskcenter.request.TaskCenterPageRequest;
import io.metersphere.system.interceptor.BaseConditionFilter;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtApiScenarioReportMapper {
@BaseConditionFilter
List<ApiScenarioReport> list(@Param("request") ApiReportPageRequest request);
@BaseConditionFilter
List<String> getIds(@Param("request") ApiReportBatchRequest request);
List<ApiScenarioReport> selectApiReportByIds(@Param("ids") List<String> ids);

View File

@ -40,6 +40,9 @@
<include refid="filters">
<property name="filter" value="request.filter"/>
</include>
<include refid="combine">
<property name="combineSearch" value="request.combineSearch"/>
</include>
</select>
<select id="getIds" resultType="java.lang.String">
select
@ -57,6 +60,9 @@
<include refid="filters">
<property name="filter" value="request.condition.filter"/>
</include>
<include refid="combine">
<property name="combineSearch" value="request.condition.combineSearch"/>
</include>
</select>
<select id="selectApiReportByIds" resultType="io.metersphere.api.domain.ApiScenarioReport">
select
@ -321,4 +327,55 @@
</if>
</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>

View File

@ -69,6 +69,12 @@ public enum UserViewType implements ValueEnum {
* 测试计划报告
*/
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));
private String value;

View File

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