feat(接口测试): 接口场景列表高级搜索
--task=1016534 --user=宋昌昌 高级筛选-接口测试-接口场景首页 https://www.tapd.cn/55049933/s/1589497
This commit is contained in:
parent
88709f9564
commit
542700f3c5
|
@ -11,13 +11,17 @@ import io.metersphere.project.dto.NodeSortQueryParam;
|
||||||
import io.metersphere.request.AssociateOtherCaseRequest;
|
import io.metersphere.request.AssociateOtherCaseRequest;
|
||||||
import io.metersphere.request.TestCasePageProviderRequest;
|
import io.metersphere.request.TestCasePageProviderRequest;
|
||||||
import io.metersphere.system.dto.sdk.BaseTreeNode;
|
import io.metersphere.system.dto.sdk.BaseTreeNode;
|
||||||
|
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 ExtApiScenarioMapper {
|
public interface ExtApiScenarioMapper {
|
||||||
|
|
||||||
|
@BaseConditionFilter
|
||||||
List<ApiScenarioDTO> list(@Param("request") ApiScenarioPageRequest request, @Param("isRepeat") boolean isRepeat, @Param("testPlanId") String testPlanId);
|
List<ApiScenarioDTO> list(@Param("request") ApiScenarioPageRequest request, @Param("isRepeat") boolean isRepeat, @Param("testPlanId") String testPlanId);
|
||||||
|
|
||||||
|
@BaseConditionFilter
|
||||||
List<String> getIds(@Param("request") ApiScenarioBatchRequest request, @Param("deleted") boolean deleted);
|
List<String> getIds(@Param("request") ApiScenarioBatchRequest request, @Param("deleted") boolean deleted);
|
||||||
|
|
||||||
List<ApiScenario> getInfoByIds(@Param("ids") List<String> ids, @Param("deleted") boolean deleted);
|
List<ApiScenario> getInfoByIds(@Param("ids") List<String> ids, @Param("deleted") boolean deleted);
|
||||||
|
|
|
@ -153,6 +153,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>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="queryWhereCondition">
|
<sql id="queryWhereCondition">
|
||||||
|
@ -178,15 +181,9 @@
|
||||||
<include refid="filters">
|
<include refid="filters">
|
||||||
<property name="filter" value="request.filter"/>
|
<property name="filter" value="request.filter"/>
|
||||||
</include>
|
</include>
|
||||||
|
<include refid="combine">
|
||||||
<if test="request.combine != null and request.combine != ''">
|
<property name="combineSearch" value="request.combineSearch"/>
|
||||||
<include refid="combine">
|
</include>
|
||||||
<property name="condition" value="request.combine"/>
|
|
||||||
<property name="name" value="request.name"/>
|
|
||||||
<property name="ObjectTags" value="request.combine.tags"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
|
|
||||||
<include refid="queryVersionCondition">
|
<include refid="queryVersionCondition">
|
||||||
<property name="versionTable" value="api_scenario"/>
|
<property name="versionTable" value="api_scenario"/>
|
||||||
</include>
|
</include>
|
||||||
|
@ -293,93 +290,100 @@
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="combine">
|
<sql id="combine">
|
||||||
<if test='${condition}.name != null and (${name} == null or ${name} == "")'>
|
<trim prefix="AND">
|
||||||
and api_scenario.name
|
<trim prefix="(" suffix=")" suffixOverrides="AND|OR">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<if test="${combineSearch} != null">
|
||||||
<property name="object" value="${condition}.name"/>
|
<foreach collection="${combineSearch}.userViewConditions" item="condition">
|
||||||
</include>
|
<if test="condition.name == 'createUser'">
|
||||||
</if>
|
|
||||||
|
|
||||||
<if test='${condition}.id != null'>
|
|
||||||
and api_scenario.num
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="${condition}.id"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
|
|
||||||
<if test="${condition}.updateTime != null">
|
|
||||||
and api_scenario.update_time
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="${condition}.updateTime"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
|
|
||||||
<if test="${condition}.createTime != null">
|
|
||||||
and api_scenario.create_time
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="${condition}.createTime"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
|
|
||||||
<if test="${condition}.status != null">
|
|
||||||
and api_scenario.status
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="${condition}.status"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
|
|
||||||
<if test='${condition}.tags != null and ${ObjectTags}.operator == "not like"'>
|
|
||||||
and (api_scenario.tags is null or api_scenario.tags
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="${condition}.tags"/>
|
|
||||||
</include>
|
|
||||||
)
|
|
||||||
</if>
|
|
||||||
|
|
||||||
<if test='${condition}.tags != null and ${ObjectTags}.operator == "like"'>
|
|
||||||
and api_scenario.tags
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="${condition}.tags"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
|
|
||||||
<if test="${condition}.customs != null and ${condition}.customs.size() > 0">
|
|
||||||
<foreach collection="${condition}.customs" item="custom" separator="" open="" close="">
|
|
||||||
<if test="custom.value != ''">
|
|
||||||
<if test='custom.operator == "not like" or custom.operator == "not in"'>
|
|
||||||
and api_scenario.id not in (
|
|
||||||
</if>
|
|
||||||
<if test='custom.operator != "not like" and custom.operator != "not in"'>
|
|
||||||
and api_scenario.id in (
|
|
||||||
</if>
|
|
||||||
select api_id from api_definition_custom_field where field_id = #{custom.id}
|
|
||||||
<choose>
|
|
||||||
<when test="custom.type == 'TEXTAREA' or custom.operator == 'current user'">
|
|
||||||
and `value`
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
<property name="object" value="custom"/>
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="api_scenario.create_user"/>
|
||||||
</include>
|
</include>
|
||||||
</when>
|
</if>
|
||||||
<when test="custom.type == 'MULTIPLE_MEMBER' or custom.type == 'CHECKBOX' or custom.type == 'MULTIPLE_SELECT'">
|
<if test="condition.name == 'follower'">
|
||||||
and ${custom.value}
|
<include refid="io.metersphere.system.mapper.BaseMapper.associationCondition">
|
||||||
</when>
|
<property name="mainIdColumn" value="api_scenario.id"/>
|
||||||
<when test="custom.type == 'DATE' or custom.type == 'DATETIME'">
|
<property name="associationTable" value="api_scenario_follower"/>
|
||||||
and left(replace(unix_timestamp(trim(both '"' from `value`)), '.', ''), 13)
|
<property name="associationIdColumn" value="api_scenario_id"/>
|
||||||
|
<property name="searchColumn" value="user_id"/>
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
|
</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="api_scenario"/>
|
||||||
|
</include>
|
||||||
|
<!-- 场景等级 -->
|
||||||
|
<if test="condition.name == 'priority'">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
<property name="object" value="custom"/>
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="api_scenario.priority"/>
|
||||||
</include>
|
</include>
|
||||||
</when>
|
</if>
|
||||||
<otherwise>
|
<!-- 状态 -->
|
||||||
and trim(both '"' from `value`)
|
<if test="condition.name == 'status'">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
<property name="object" value="custom"/>
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="api_scenario.status"/>
|
||||||
</include>
|
</include>
|
||||||
</otherwise>
|
</if>
|
||||||
</choose>
|
<!-- 执行结果 -->
|
||||||
)
|
<if test="condition.name == 'lastReportStatus'">
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="api_scenario.last_report_status"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
<!-- 步骤数 -->
|
||||||
|
<if test="condition.name == 'stepTotal'">
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="api_scenario.step_total"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
<!-- 步骤数 -->
|
||||||
|
<if test="condition.name == 'stepTotal'">
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="api_scenario.step_total"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
<!-- 通过率 -->
|
||||||
|
<if test="condition.name == 'passRate'">
|
||||||
|
<choose>
|
||||||
|
<when test="condition.operator == 'NOT_EMPTY'">
|
||||||
|
api_scenario.request_pass_rate is not null and api_scenario.request_pass_rate != '' and api_scenario.request_pass_rate != 'Calculating'
|
||||||
|
</when>
|
||||||
|
<when test="condition.operator == 'EMPTY'">
|
||||||
|
api_scenario.request_pass_rate is null or api_scenario.request_pass_rate == '' or api_scenario.request_pass_rate == 'Calculating'
|
||||||
|
</when>
|
||||||
|
<when test="(condition.operator == 'LT' and condition.value == 0) or (condition.operator == 'GT' and condition.value > 100 )">
|
||||||
|
1=2
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
api_scenario.request_pass_rate ${condition.operator} #{condition.value}
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
|
<!-- 环境 -->
|
||||||
|
<if test="condition.name == 'env'">
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="api_scenario.environment_id"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
|
||||||
|
<property name="searchMode" value="${combineSearch}.searchMode"/>
|
||||||
|
</include>
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</foreach>
|
</trim>
|
||||||
</if>
|
</trim>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="queryVersionCondition">
|
<sql id="queryVersionCondition">
|
||||||
|
|
|
@ -683,6 +683,7 @@
|
||||||
<property name="column" value="atc.last_report_status"/>
|
<property name="column" value="atc.last_report_status"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
|
<!-- 接口存在更新 -->
|
||||||
<if test="condition.name == 'apiChange'">
|
<if test="condition.name == 'apiChange'">
|
||||||
<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"/>
|
||||||
|
|
|
@ -6,6 +6,9 @@ import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author song-cc-rock
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class BugPageRequest extends BasePageRequest {
|
public class BugPageRequest extends BasePageRequest {
|
||||||
|
|
Loading…
Reference in New Issue