fix(测试用例): 接口定义高级搜索,用例数搜索报错
--bug=1046336 --user=陈建星 【接口测试】定义-筛选-选中所有字段筛选后提示sql异常 https://www.tapd.cn/55049933/s/1578782
This commit is contained in:
parent
ace829f19b
commit
bbb11660e9
|
@ -34,7 +34,7 @@ public interface ExtApiDefinitionMapper {
|
|||
List<String> getIds(@Param("request") TableBatchProcessDTO request, @Param("projectId") String projectId, @Param("protocols") List<String> protocols, @Param("deleted") boolean deleted);
|
||||
|
||||
@BaseConditionFilter
|
||||
List<String> getIdsBySort(@Param("request") TableBatchProcessDTO request, @Param("projectId") String projectId, @Param("protocols") List<String> protocols, @Param("orderColumns") String orderColumns);
|
||||
List<String> getIdsBySort(@Param("request") TableBatchProcessDTO request, @Param("projectId") String projectId, @Param("protocols") List<String> protocols, @Param("orderColumns") String orderColumns, @Param("deleted") boolean deleted);
|
||||
|
||||
List<String> getRefIds(@Param("ids") List<String> ids, @Param("deleted") boolean deleted);
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
<select id="getIdsBySort" resultType="java.lang.String">
|
||||
SELECT id
|
||||
FROM api_definition
|
||||
where project_id = #{projectId} and deleted is false
|
||||
where project_id = #{projectId} and deleted = #{deleted}
|
||||
<if test="protocols != null and protocols.size() > 0">
|
||||
AND protocol in
|
||||
<foreach collection="protocols" item="protocol" separator="," open="(" close=")">
|
||||
|
@ -281,6 +281,8 @@
|
|||
|
||||
<include refid="combine">
|
||||
<property name="combineSearch" value="request.combineSearch"/>
|
||||
<property name="projectId" value="${request.projectId}"/>
|
||||
<property name="deleted" value="${request.deleted}"/>
|
||||
</include>
|
||||
|
||||
<include refid="queryVersionCondition">
|
||||
|
@ -415,6 +417,47 @@
|
|||
<property name="column" value="api_definition.path"/>
|
||||
</include>
|
||||
</if>
|
||||
<if test="condition.name == 'caseTotal'">
|
||||
<choose>
|
||||
<when test="condition.operator == 'NOT_EMPTY'">
|
||||
api_definition.id in (
|
||||
select api_definition_id from api_test_case where deleted = ${deleted}
|
||||
and project_id = '${projectId}'
|
||||
)
|
||||
</when>
|
||||
<when test="condition.operator == 'EMPTY'">
|
||||
api_definition.id not in (
|
||||
select api_definition_id from api_test_case where deleted = ${deleted}
|
||||
and project_id = '${projectId}'
|
||||
)
|
||||
</when>
|
||||
<when test="(condition.operator == 'LT' and condition.value < 1) or (condition.operator == 'EQUALS' and condition.value < 0)">
|
||||
1=2
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="condition.operator == 'LT' or (condition.operator == 'EQUALS' and condition.value == 0)">
|
||||
api_definition.id not in (
|
||||
select api_definition_id from api_test_case where deleted = ${deleted}
|
||||
and project_id = '${projectId}'
|
||||
)
|
||||
<if test="condition.value > 1">
|
||||
OR
|
||||
</if>
|
||||
</if>
|
||||
<if test="(condition.operator == 'EQUALS' and condition.value > 0) or (condition.operator == 'LT' and condition.value > 1) or condition.operator == 'GT'">
|
||||
api_definition.id in (
|
||||
select api_definition_id from api_test_case where deleted = ${deleted}
|
||||
and project_id = '${projectId}'
|
||||
group by api_definition_id having
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="condition" value="condition"/>
|
||||
<property name="column" value="count(id)"/>
|
||||
</include>
|
||||
)
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
|
||||
<property name="searchMode" value="${combineSearch}.searchMode"/>
|
||||
</include>
|
||||
|
@ -453,8 +496,10 @@
|
|||
<sql id="queryWhereConditionByBaseQueryRequest">
|
||||
<include refid="combine">
|
||||
<property name="combineSearch" value="request.condition.combineSearch"/>
|
||||
<property name="projectId" value="${projectId}"/>
|
||||
<property name="deleted" value="${deleted}"/>
|
||||
</include>
|
||||
<if test="request.condition.keyword != null">
|
||||
<if test="request.condition.keyword != null and request.condition.keyword != ''">
|
||||
and (
|
||||
api_definition.num like concat('%', #{request.condition.keyword},'%')
|
||||
or api_definition.name like concat('%', #{request.condition.keyword},'%')
|
||||
|
|
|
@ -210,7 +210,7 @@ public class ApiDefinitionExportService {
|
|||
|
||||
if (request.isSelectAll()) {
|
||||
String sortString = StringUtils.isBlank(request.getSortString()) ? "pos desc,id desc" : request.getSortString();
|
||||
List<String> ids = extApiDefinitionMapper.getIdsBySort(request, request.getProjectId(), protocols, sortString);
|
||||
List<String> ids = extApiDefinitionMapper.getIdsBySort(request, request.getProjectId(), protocols, sortString, false);
|
||||
if (CollectionUtils.isNotEmpty(request.getExcludeIds())) {
|
||||
ids.removeAll(request.getExcludeIds());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue