feat(接口测试): 接口Case&&Mock列表高级搜索
--story=1016576 --user=宋昌昌 【通用功能】高级搜索-待完成页面 https://www.tapd.cn/55049933/s/1589125
This commit is contained in:
parent
4509f117e3
commit
88709f9564
|
@ -5,17 +5,21 @@ import io.metersphere.api.dto.definition.ApiDefinitionMockDTO;
|
|||
import io.metersphere.api.dto.definition.ApiMockWithBlob;
|
||||
import io.metersphere.api.dto.definition.ApiTestCaseBatchRequest;
|
||||
import io.metersphere.api.dto.definition.request.ApiDefinitionMockPageRequest;
|
||||
import io.metersphere.system.interceptor.BaseConditionFilter;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ExtApiDefinitionMockMapper {
|
||||
|
||||
@BaseConditionFilter
|
||||
List<ApiDefinitionMockDTO> list(@Param("request") ApiDefinitionMockPageRequest request);
|
||||
|
||||
List<String> getIdsByApiIds(@Param("ids") List<String> ids);
|
||||
|
||||
@BaseConditionFilter
|
||||
List<String> getIds(@Param("request") ApiTestCaseBatchRequest request);
|
||||
|
||||
List<ApiDefinitionMock> getTagsByIds(@Param("ids") List<String> ids);
|
||||
|
||||
List<ApiDefinitionMock> getMockInfoByIds(@Param("ids") List<String> ids);
|
||||
|
|
|
@ -108,6 +108,9 @@
|
|||
<property name="filter" value="request.condition.filter"/>
|
||||
</include>
|
||||
|
||||
<include refid="combine">
|
||||
<property name="combineSearch" value="request.condition.combineSearch"/>
|
||||
</include>
|
||||
</sql>
|
||||
|
||||
|
||||
|
@ -144,13 +147,9 @@
|
|||
<property name="filter" value="request.filter"/>
|
||||
</include>
|
||||
|
||||
<if test="request.combine != null and request.combine != ''">
|
||||
<include refid="combine">
|
||||
<property name="condition" value="request.combine"/>
|
||||
<property name="name" value="request.name"/>
|
||||
<property name="ObjectTags" value="request.combine.tags"/>
|
||||
<property name="combineSearch" value="request.combineSearch"/>
|
||||
</include>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
|
||||
|
@ -174,56 +173,52 @@
|
|||
</sql>
|
||||
|
||||
<sql id="combine">
|
||||
<if test='${condition}.name != null and (${name} == null or ${name} == "")'>
|
||||
and m.name
|
||||
<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="object" value="${condition}.name"/>
|
||||
<property name="condition" value="condition"/>
|
||||
<property name="column" value="api_definition_mock.create_user"/>
|
||||
</include>
|
||||
</if>
|
||||
|
||||
<if test="${condition}.updateTime != null">
|
||||
and m.update_time
|
||||
<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="m"/>
|
||||
</include>
|
||||
<!-- 协议 -->
|
||||
<if test="condition.name == 'protocol'">
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="${condition}.updateTime"/>
|
||||
<property name="condition" value="condition"/>
|
||||
<property name="column" value="d.protocol"/>
|
||||
</include>
|
||||
</if>
|
||||
|
||||
<if test="${condition}.createTime != null">
|
||||
and m.create_time
|
||||
<!-- 请求类型 -->
|
||||
<if test="condition.name == 'method'">
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="${condition}.createTime"/>
|
||||
<property name="condition" value="condition"/>
|
||||
<property name="column" value="d.method"/>
|
||||
</include>
|
||||
</if>
|
||||
|
||||
<if test="${condition}.createUser != null">
|
||||
and m.create_user
|
||||
<!-- 状态 -->
|
||||
<if test="condition.name == 'status'">
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="${condition}.createUser"/>
|
||||
<property name="condition" value="condition"/>
|
||||
<property name="column" value="m.enable"/>
|
||||
</include>
|
||||
</if>
|
||||
|
||||
<if test="${condition}.enable != null">
|
||||
and m.enable
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="${condition}.enable"/>
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
|
||||
<property name="searchMode" value="${combineSearch}.searchMode"/>
|
||||
</include>
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test='${condition}.tags != null and ${ObjectTags}.operator == "not like"'>
|
||||
and (m.tags is null or m.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 m.tags
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="${condition}.tags"/>
|
||||
</include>
|
||||
</if>
|
||||
|
||||
</trim>
|
||||
</trim>
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -12,6 +12,7 @@ import io.metersphere.request.AssociateOtherCaseRequest;
|
|||
import io.metersphere.request.TestCasePageProviderRequest;
|
||||
import io.metersphere.system.dto.sdk.BaseTreeNode;
|
||||
import io.metersphere.system.dto.sdk.OptionDTO;
|
||||
import io.metersphere.system.interceptor.BaseConditionFilter;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -26,8 +27,10 @@ public interface ExtApiTestCaseMapper {
|
|||
|
||||
Long getPos(@Param("projectId") String projectId);
|
||||
|
||||
@BaseConditionFilter
|
||||
List<ApiTestCaseDTO> listByRequest(@Param("request") ApiTestCasePageRequest request, @Param("deleted") boolean deleted, @Param("isRepeat") boolean isRepeat, @Param("testPlanId") String testPlanId);
|
||||
|
||||
@BaseConditionFilter
|
||||
List<String> getIds(@Param("request") ApiTestCaseBatchRequest request, @Param("deleted") boolean deleted);
|
||||
|
||||
void batchMoveGc(@Param("ids") List<String> ids, @Param("userId") String userId, @Param("deleteTime") long deleteTime);
|
||||
|
|
|
@ -486,6 +486,9 @@
|
|||
<include refid="filters">
|
||||
<property name="filter" value="request.condition.filter"/>
|
||||
</include>
|
||||
<include refid="combine">
|
||||
<property name="combineSearch" value="request.condition.combineSearch"/>
|
||||
</include>
|
||||
<include refid="queryVersionCondition">
|
||||
<property name="versionTable" value="atc"/>
|
||||
</include>
|
||||
|
@ -521,6 +524,9 @@
|
|||
<include refid="filters">
|
||||
<property name="filter" value="request.filter"/>
|
||||
</include>
|
||||
<include refid="combine">
|
||||
<property name="combineSearch" value="request.combineSearch"/>
|
||||
</include>
|
||||
<include refid="queryVersionCondition">
|
||||
<property name="versionTable" value="atc"/>
|
||||
</include>
|
||||
|
@ -573,6 +579,125 @@
|
|||
</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="api_test_case.create_user"/>
|
||||
</include>
|
||||
</if>
|
||||
<if test="condition.name == 'follower'">
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.associationCondition">
|
||||
<property name="mainIdColumn" value="api_test_case.id"/>
|
||||
<property name="associationTable" value="api_test_case_follower"/>
|
||||
<property name="associationIdColumn" value="case_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="atc"/>
|
||||
</include>
|
||||
<!-- 协议 -->
|
||||
<if test="condition.name == 'protocol'">
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="condition" value="condition"/>
|
||||
<property name="column" value="a.protocol"/>
|
||||
</include>
|
||||
</if>
|
||||
<!-- 用例等级 -->
|
||||
<if test="condition.name == 'priority'">
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="condition" value="condition"/>
|
||||
<property name="column" value="atc.priority"/>
|
||||
</include>
|
||||
</if>
|
||||
<!-- 路径 -->
|
||||
<if test="condition.name == 'path'">
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="condition" value="condition"/>
|
||||
<property name="column" value="a.path"/>
|
||||
</include>
|
||||
</if>
|
||||
<!-- 状态 -->
|
||||
<if test="condition.name == 'status'">
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="condition" value="condition"/>
|
||||
<property name="column" value="atc.status"/>
|
||||
</include>
|
||||
</if>
|
||||
<!-- 用例通过率 -->
|
||||
<if test="condition.name == 'passRate'">
|
||||
<choose>
|
||||
<when test="condition.operator == 'NOT_EMPTY'">
|
||||
atc.id in (
|
||||
select atcr.api_test_case_id as id
|
||||
from api_report ar left join api_test_case_record atcr on atcr.api_report_id = ar.id
|
||||
group by atcr.api_test_case_id
|
||||
)
|
||||
</when>
|
||||
<when test="condition.operator == 'EMPTY'">
|
||||
atc.id not in (
|
||||
select atcr.api_test_case_id as id
|
||||
from api_report ar left join api_test_case_record atcr on atcr.api_report_id = ar.id
|
||||
group by atcr.api_test_case_id
|
||||
)
|
||||
</when>
|
||||
<when test="(condition.operator == 'LT' and condition.value == 0) or (condition.operator == 'GT' and condition.value > 100 )">
|
||||
1=2
|
||||
</when>
|
||||
<otherwise>
|
||||
atc.id in (
|
||||
select atcr.api_test_case_id as id, format(sum(if(ar.`status` = 'success', 1, 0)) / count(ar.id) * 100, 2) as passRate
|
||||
from api_report ar left join api_test_case_record atcr on atcr.api_report_id = ar.id
|
||||
group by atcr.api_test_case_id having
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="condition" value="condition"/>
|
||||
<property name="column" value="passRate"/>
|
||||
</include>
|
||||
)
|
||||
</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="atc.environment_id"/>
|
||||
</include>
|
||||
</if>
|
||||
<!-- 执行结果 -->
|
||||
<if test="condition.name == 'lastReportStatus'">
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="condition" value="condition"/>
|
||||
<property name="column" value="atc.last_report_status"/>
|
||||
</include>
|
||||
</if>
|
||||
<if test="condition.name == 'apiChange'">
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="condition" value="condition"/>
|
||||
<property name="column" value="atc.api_change"/>
|
||||
</include>
|
||||
</if>
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
|
||||
<property name="searchMode" value="${combineSearch}.searchMode"/>
|
||||
</include>
|
||||
</foreach>
|
||||
</if>
|
||||
</trim>
|
||||
</trim>
|
||||
</sql>
|
||||
|
||||
<sql id="queryVersionCondition">
|
||||
<if test="request.versionId != null and request.versionId != ''">
|
||||
and ${versionTable}.version_id = #{request.versionId}
|
||||
|
|
|
@ -7,6 +7,7 @@ import io.metersphere.bug.dto.response.BugTagEditDTO;
|
|||
import io.metersphere.dto.BugProviderDTO;
|
||||
import io.metersphere.request.AssociateBugRequest;
|
||||
import io.metersphere.request.BugPageProviderRequest;
|
||||
import io.metersphere.system.interceptor.BaseConditionFilter;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -20,6 +21,7 @@ public interface ExtBugMapper {
|
|||
* @param sort 排序参数
|
||||
* @return 缺陷列表
|
||||
*/
|
||||
@BaseConditionFilter
|
||||
List<BugDTO> list(@Param("request") BugPageRequest request, @Param("sort") String sort);
|
||||
|
||||
/**
|
||||
|
@ -28,6 +30,7 @@ public interface ExtBugMapper {
|
|||
* @param request 请求查询参数
|
||||
* @return 缺陷列表
|
||||
*/
|
||||
@BaseConditionFilter
|
||||
List<String> getIdsByPageRequest(@Param("request") BugPageRequest request);
|
||||
|
||||
/**
|
||||
|
@ -95,6 +98,7 @@ public interface ExtBugMapper {
|
|||
* @param deleted 是否删除
|
||||
* @return 缺陷集合
|
||||
*/
|
||||
@BaseConditionFilter
|
||||
List<BugProviderDTO> listByProviderRequest(@Param("table") String sourceType, @Param("sourceName") String sourceName, @Param("bugColumnName") String bugColumnName, @Param("request") BugPageProviderRequest bugPageProviderRequest, @Param("deleted") boolean deleted);
|
||||
|
||||
/**
|
||||
|
@ -103,5 +107,6 @@ public interface ExtBugMapper {
|
|||
* @param deleted 是否删除
|
||||
* @return 缺陷ID集合
|
||||
*/
|
||||
@BaseConditionFilter
|
||||
List<String> getIdsByProvider(@Param("request") AssociateBugRequest request, @Param("deleted") boolean deleted);
|
||||
}
|
||||
|
|
|
@ -159,9 +159,9 @@
|
|||
</if>
|
||||
<include refid="filter"/>
|
||||
<include refid="combine">
|
||||
<property name="condition" value="request.combine"/>
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="combineTag" value="request.combine.tag"/>
|
||||
<property name="combineSearch" value="request.combineSearch"/>
|
||||
<property name="projectId" value="${request.projectId}"/>
|
||||
<property name="deleted" value="${request.useTrash}"/>
|
||||
</include>
|
||||
</where>
|
||||
</sql>
|
||||
|
@ -224,181 +224,109 @@
|
|||
</sql>
|
||||
|
||||
<sql id="combine">
|
||||
<if test="request.combine != null">
|
||||
and (
|
||||
<!-- 任意/所有拼接 -->
|
||||
<include refid="prefixMode">
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
<!-- ID -->
|
||||
<if test='${condition}.num != null'>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
b.num
|
||||
<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="object" value="${condition}.num"/>
|
||||
<property name="condition" value="condition"/>
|
||||
<property name="column" value="bug.create_user"/>
|
||||
</include>
|
||||
</if>
|
||||
<!-- 名称 -->
|
||||
<if test='${condition}.title != null'>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
b.title
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="${condition}.title"/>
|
||||
<if test="condition.name == 'follower'">
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.associationCondition">
|
||||
<property name="mainIdColumn" value="bug.id"/>
|
||||
<property name="associationTable" value="bug_follower"/>
|
||||
<property name="associationIdColumn" value="bug_id"/>
|
||||
<property name="searchColumn" value="user_id"/>
|
||||
<property name="condition" value="condition"/>
|
||||
</include>
|
||||
</if>
|
||||
<!-- 所属平台 -->
|
||||
<if test='${condition}.platform != null'>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
|
||||
<property name="searchMode" value="${combineSearch}.searchMode"/>
|
||||
</include>
|
||||
b.platform
|
||||
</foreach>
|
||||
<foreach collection="${combineSearch}.systemFieldConditions" item="condition">
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.commonSystemFieldConditions">
|
||||
<property name="condition" value="condition"/>
|
||||
<property name="tablePrefix" value="b"/>
|
||||
</include>
|
||||
<!-- 状态 -->
|
||||
<if test="condition.name == 'status'">
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="${condition}.platform"/>
|
||||
<property name="condition" value="condition"/>
|
||||
<property name="column" value="b.status"/>
|
||||
</include>
|
||||
</if>
|
||||
<!-- 处理人 -->
|
||||
<if test='${condition}.handleUser != null'>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
b.handle_user
|
||||
<if test="condition.name == 'handleUser'">
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="${condition}.handleUser"/>
|
||||
<property name="condition" value="condition"/>
|
||||
<property name="column" value="b.handle_user"/>
|
||||
</include>
|
||||
</if>
|
||||
<!-- 状态 -->
|
||||
<if test='${condition}.status != null'>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
b.status
|
||||
<!-- 所属平台 -->
|
||||
<if test="condition.name == 'platform'">
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="${condition}.status"/>
|
||||
<property name="condition" value="condition"/>
|
||||
<property name="column" value="b.platform"/>
|
||||
</include>
|
||||
</if>
|
||||
<!-- 创建人 -->
|
||||
<if test='${condition}.createUser != null'>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
b.create_user
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="${condition}.createUser"/>
|
||||
</include>
|
||||
</if>
|
||||
<!-- 创建时间 -->
|
||||
<if test='${condition}.createTime != null'>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
b.create_time
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="${condition}.createTime"/>
|
||||
</include>
|
||||
</if>
|
||||
<!-- 标签 -->
|
||||
<if test='${condition}.tags != null'>
|
||||
<include refid="queryTag">
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
<property name="combineTag" 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 != ''">
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
<if test='custom.operator == "not like" or custom.operator == "not in"'>
|
||||
b.id not in (
|
||||
</if>
|
||||
<if test='custom.operator != "not like" and custom.operator != "not in"'>
|
||||
<!-- 用例数 -->
|
||||
<if test="condition.name == 'caseTotal'">
|
||||
<choose>
|
||||
<when test="condition.operator == 'NOT_EMPTY'">
|
||||
b.id in (
|
||||
</if>
|
||||
select bug_id from bug_custom_field where field_id = #{custom.id} and
|
||||
<choose>
|
||||
<when test="custom.type == 'array'">
|
||||
<foreach collection="custom.value" item="val" separator="or" open="(" close=")">
|
||||
JSON_CONTAINS(`value`, JSON_ARRAY(#{val}))
|
||||
</foreach>
|
||||
</when>
|
||||
<when test="custom.type == 'time'">
|
||||
left(replace(unix_timestamp(trim(both '"' from `value`)), '.', ''), 13)
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="custom"/>
|
||||
</include>
|
||||
</when>
|
||||
<otherwise>
|
||||
trim(both '"' from `value`)
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="custom"/>
|
||||
</include>
|
||||
</otherwise>
|
||||
</choose>
|
||||
select distinct b.id from bug b join bug_relation_case brc on b.id = brc.bug_id
|
||||
where deleted = ${deleted} and project_id = '${projectId}'
|
||||
)
|
||||
</if>
|
||||
</foreach>
|
||||
</if>
|
||||
)
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="prefixMode">
|
||||
<choose>
|
||||
<when test='${searchMode} == "AND"'>
|
||||
1 = 1
|
||||
</when>
|
||||
<when test='${searchMode} == "OR"'>
|
||||
<when test="condition.operator == 'EMPTY'">
|
||||
b.id not in (
|
||||
select distinct b.id from bug b join bug_relation_case brc on b.id = brc.bug_id
|
||||
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>
|
||||
</choose>
|
||||
</sql>
|
||||
|
||||
<sql id="queryType">
|
||||
<choose>
|
||||
<when test='${searchMode} == "AND"'>
|
||||
and
|
||||
</when>
|
||||
<when test='${searchMode} == "OR"'>
|
||||
or
|
||||
</when>
|
||||
</choose>
|
||||
</sql>
|
||||
|
||||
<sql id="queryTag">
|
||||
<!-- 不包含 -->
|
||||
<if test='${combineTag}.value.size() > 0 and ${combineTag}.operator == "not like"'>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
<otherwise>
|
||||
<if test="condition.operator == 'LT' or (condition.operator == 'EQUALS' and condition.value == 0)">
|
||||
b.id not in (
|
||||
select distinct b.id from bug b join bug_relation_case brc on b.id = brc.bug_id
|
||||
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'">
|
||||
b.id in (
|
||||
select distinct b.id from bug b join bug_relation_case brc on b.id = brc.bug_id
|
||||
where deleted = ${deleted} and project_id = '${projectId}' group b.id having
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="condition" value="condition"/>
|
||||
<property name="column" value="count(b.id)"/>
|
||||
</include>
|
||||
(
|
||||
b.tags is null or b.tags = '[]' or
|
||||
<foreach collection="${combineTag}.value" item="tag" separator="and" open="(" close=")">
|
||||
!JSON_CONTAINS(b.tags, JSON_ARRAY(#{tag}))
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<!-- 包含 -->
|
||||
<if test='${combineTag}.value.size() > 0 and ${combineTag}.operator == "like"'>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
|
||||
<property name="searchMode" value="${combineSearch}.searchMode"/>
|
||||
</include>
|
||||
<foreach collection="${combineTag}.value" item="tag" separator="or" open="(" close=")">
|
||||
JSON_CONTAINS(b.tags, JSON_ARRAY(#{tag}))
|
||||
</foreach>
|
||||
</if>
|
||||
<!-- 空 -->
|
||||
<if test='${combineTag}.operator == "is null"'>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.customFiledConditions">
|
||||
<property name="mainIdColumn" value="bug.id"/>
|
||||
<property name="associationTable" value="bug_custom_field"/>
|
||||
<property name="associationIdColumn" value="bug_id"/>
|
||||
<property name="combineSearch" value="${combineSearch}"/>
|
||||
</include>
|
||||
(b.tags is null or b.tags = '[]')
|
||||
</if>
|
||||
</trim>
|
||||
</trim>
|
||||
</sql>
|
||||
|
||||
<sql id="queryWhereConditionByProvider">
|
||||
|
@ -414,8 +342,9 @@
|
|||
</if>
|
||||
<include refid="filter"/>
|
||||
<include refid="combine">
|
||||
<property name="condition" value="request.combine"/>
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="combineSearch" value="request.combineSearch"/>
|
||||
<property name="projectId" value="${request.projectId}"/>
|
||||
<property name="deleted" value="${request.useTrash}"/>
|
||||
</include>
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
|
@ -21,7 +21,15 @@ public enum UserViewType implements ValueEnum {
|
|||
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_REVIEW, InternalUserView.MY_CREATE)),
|
||||
API_DEFINITION("api-definition",
|
||||
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_FOLLOW, InternalUserView.MY_CREATE)),
|
||||
;
|
||||
API_CASE("api-case",
|
||||
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_FOLLOW, InternalUserView.MY_CREATE)),
|
||||
API_MOCK("api-mock",
|
||||
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)),
|
||||
API_SCENARIO("api-scenario",
|
||||
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_FOLLOW, InternalUserView.MY_CREATE)),
|
||||
BUG("bug",
|
||||
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_FOLLOW, InternalUserView.MY_CREATE));
|
||||
|
||||
|
||||
private String value;
|
||||
private List<InternalUserView> internalViews;
|
||||
|
|
Loading…
Reference in New Issue