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.ApiMockWithBlob;
|
||||||
import io.metersphere.api.dto.definition.ApiTestCaseBatchRequest;
|
import io.metersphere.api.dto.definition.ApiTestCaseBatchRequest;
|
||||||
import io.metersphere.api.dto.definition.request.ApiDefinitionMockPageRequest;
|
import io.metersphere.api.dto.definition.request.ApiDefinitionMockPageRequest;
|
||||||
|
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 ExtApiDefinitionMockMapper {
|
public interface ExtApiDefinitionMockMapper {
|
||||||
|
|
||||||
|
@BaseConditionFilter
|
||||||
List<ApiDefinitionMockDTO> list(@Param("request") ApiDefinitionMockPageRequest request);
|
List<ApiDefinitionMockDTO> list(@Param("request") ApiDefinitionMockPageRequest request);
|
||||||
|
|
||||||
List<String> getIdsByApiIds(@Param("ids") List<String> ids);
|
List<String> getIdsByApiIds(@Param("ids") List<String> ids);
|
||||||
|
|
||||||
List<String> getIds(@Param("request")ApiTestCaseBatchRequest request);
|
@BaseConditionFilter
|
||||||
|
List<String> getIds(@Param("request") ApiTestCaseBatchRequest request);
|
||||||
|
|
||||||
List<ApiDefinitionMock> getTagsByIds(@Param("ids") List<String> ids);
|
List<ApiDefinitionMock> getTagsByIds(@Param("ids") List<String> ids);
|
||||||
|
|
||||||
List<ApiDefinitionMock> getMockInfoByIds(@Param("ids") List<String> ids);
|
List<ApiDefinitionMock> getMockInfoByIds(@Param("ids") List<String> ids);
|
||||||
|
|
|
@ -108,6 +108,9 @@
|
||||||
<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>
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,13 +147,9 @@
|
||||||
<property name="filter" value="request.filter"/>
|
<property name="filter" value="request.filter"/>
|
||||||
</include>
|
</include>
|
||||||
|
|
||||||
<if test="request.combine != null and request.combine != ''">
|
<include refid="combine">
|
||||||
<include refid="combine">
|
<property name="combineSearch" value="request.combineSearch"/>
|
||||||
<property name="condition" value="request.combine"/>
|
</include>
|
||||||
<property name="name" value="request.name"/>
|
|
||||||
<property name="ObjectTags" value="request.combine.tags"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
||||||
|
@ -174,56 +173,52 @@
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="combine">
|
<sql id="combine">
|
||||||
<if test='${condition}.name != null and (${name} == null or ${name} == "")'>
|
<trim prefix="AND">
|
||||||
and m.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>
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
<if test="${condition}.updateTime != null">
|
<property name="column" value="api_definition_mock.create_user"/>
|
||||||
and m.update_time
|
</include>
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
</if>
|
||||||
<property name="object" value="${condition}.updateTime"/>
|
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
|
||||||
</include>
|
<property name="searchMode" value="${combineSearch}.searchMode"/>
|
||||||
</if>
|
</include>
|
||||||
|
</foreach>
|
||||||
<if test="${condition}.createTime != null">
|
<foreach collection="${combineSearch}.systemFieldConditions" item="condition">
|
||||||
and m.create_time
|
<include refid="io.metersphere.system.mapper.BaseMapper.commonSystemFieldConditions">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<property name="condition" value="condition"/>
|
||||||
<property name="object" value="${condition}.createTime"/>
|
<property name="tablePrefix" value="m"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
<!-- 协议 -->
|
||||||
|
<if test="condition.name == 'protocol'">
|
||||||
<if test="${condition}.createUser != null">
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
and m.create_user
|
<property name="condition" value="condition"/>
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<property name="column" value="d.protocol"/>
|
||||||
<property name="object" value="${condition}.createUser"/>
|
</include>
|
||||||
</include>
|
</if>
|
||||||
</if>
|
<!-- 请求类型 -->
|
||||||
|
<if test="condition.name == 'method'">
|
||||||
<if test="${condition}.enable != null">
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
and m.enable
|
<property name="condition" value="condition"/>
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<property name="column" value="d.method"/>
|
||||||
<property name="object" value="${condition}.enable"/>
|
</include>
|
||||||
</include>
|
</if>
|
||||||
</if>
|
<!-- 状态 -->
|
||||||
|
<if test="condition.name == 'status'">
|
||||||
<if test='${condition}.tags != null and ${ObjectTags}.operator == "not like"'>
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
and (m.tags is null or m.tags
|
<property name="condition" value="condition"/>
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<property name="column" value="m.enable"/>
|
||||||
<property name="object" value="${condition}.tags"/>
|
</include>
|
||||||
</include>
|
</if>
|
||||||
)
|
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
|
||||||
</if>
|
<property name="searchMode" value="${combineSearch}.searchMode"/>
|
||||||
|
</include>
|
||||||
<if test='${condition}.tags != null and ${ObjectTags}.operator == "like"'>
|
</foreach>
|
||||||
and m.tags
|
</if>
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
</trim>
|
||||||
<property name="object" value="${condition}.tags"/>
|
</trim>
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
|
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -12,6 +12,7 @@ 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.dto.sdk.OptionDTO;
|
import io.metersphere.system.dto.sdk.OptionDTO;
|
||||||
|
import io.metersphere.system.interceptor.BaseConditionFilter;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
@ -26,8 +27,10 @@ public interface ExtApiTestCaseMapper {
|
||||||
|
|
||||||
Long getPos(@Param("projectId") String projectId);
|
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);
|
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);
|
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);
|
void batchMoveGc(@Param("ids") List<String> ids, @Param("userId") String userId, @Param("deleteTime") long deleteTime);
|
||||||
|
|
|
@ -486,6 +486,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>
|
||||||
<include refid="queryVersionCondition">
|
<include refid="queryVersionCondition">
|
||||||
<property name="versionTable" value="atc"/>
|
<property name="versionTable" value="atc"/>
|
||||||
</include>
|
</include>
|
||||||
|
@ -521,6 +524,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>
|
||||||
<include refid="queryVersionCondition">
|
<include refid="queryVersionCondition">
|
||||||
<property name="versionTable" value="atc"/>
|
<property name="versionTable" value="atc"/>
|
||||||
</include>
|
</include>
|
||||||
|
@ -573,6 +579,125 @@
|
||||||
</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="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">
|
<sql id="queryVersionCondition">
|
||||||
<if test="request.versionId != null and request.versionId != ''">
|
<if test="request.versionId != null and request.versionId != ''">
|
||||||
and ${versionTable}.version_id = #{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.dto.BugProviderDTO;
|
||||||
import io.metersphere.request.AssociateBugRequest;
|
import io.metersphere.request.AssociateBugRequest;
|
||||||
import io.metersphere.request.BugPageProviderRequest;
|
import io.metersphere.request.BugPageProviderRequest;
|
||||||
|
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;
|
||||||
|
@ -20,6 +21,7 @@ public interface ExtBugMapper {
|
||||||
* @param sort 排序参数
|
* @param sort 排序参数
|
||||||
* @return 缺陷列表
|
* @return 缺陷列表
|
||||||
*/
|
*/
|
||||||
|
@BaseConditionFilter
|
||||||
List<BugDTO> list(@Param("request") BugPageRequest request, @Param("sort") String sort);
|
List<BugDTO> list(@Param("request") BugPageRequest request, @Param("sort") String sort);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,6 +30,7 @@ public interface ExtBugMapper {
|
||||||
* @param request 请求查询参数
|
* @param request 请求查询参数
|
||||||
* @return 缺陷列表
|
* @return 缺陷列表
|
||||||
*/
|
*/
|
||||||
|
@BaseConditionFilter
|
||||||
List<String> getIdsByPageRequest(@Param("request") BugPageRequest request);
|
List<String> getIdsByPageRequest(@Param("request") BugPageRequest request);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,6 +98,7 @@ public interface ExtBugMapper {
|
||||||
* @param deleted 是否删除
|
* @param deleted 是否删除
|
||||||
* @return 缺陷集合
|
* @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);
|
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 是否删除
|
* @param deleted 是否删除
|
||||||
* @return 缺陷ID集合
|
* @return 缺陷ID集合
|
||||||
*/
|
*/
|
||||||
|
@BaseConditionFilter
|
||||||
List<String> getIdsByProvider(@Param("request") AssociateBugRequest request, @Param("deleted") boolean deleted);
|
List<String> getIdsByProvider(@Param("request") AssociateBugRequest request, @Param("deleted") boolean deleted);
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,9 +159,9 @@
|
||||||
</if>
|
</if>
|
||||||
<include refid="filter"/>
|
<include refid="filter"/>
|
||||||
<include refid="combine">
|
<include refid="combine">
|
||||||
<property name="condition" value="request.combine"/>
|
<property name="combineSearch" value="request.combineSearch"/>
|
||||||
<property name="searchMode" value="request.searchMode"/>
|
<property name="projectId" value="${request.projectId}"/>
|
||||||
<property name="combineTag" value="request.combine.tag"/>
|
<property name="deleted" value="${request.useTrash}"/>
|
||||||
</include>
|
</include>
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
|
@ -224,181 +224,109 @@
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="combine">
|
<sql id="combine">
|
||||||
<if test="request.combine != null">
|
<trim prefix="AND">
|
||||||
and (
|
<trim prefix="(" suffix=")" suffixOverrides="AND|OR">
|
||||||
<!-- 任意/所有拼接 -->
|
<if test="${combineSearch} != null">
|
||||||
<include refid="prefixMode">
|
<foreach collection="${combineSearch}.userViewConditions" item="condition">
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
<if test="condition.name == 'createUser'">
|
||||||
</include>
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
<!-- ID -->
|
<property name="condition" value="condition"/>
|
||||||
<if test='${condition}.num != null'>
|
<property name="column" value="bug.create_user"/>
|
||||||
<include refid="queryType">
|
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
|
||||||
</include>
|
|
||||||
b.num
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="${condition}.num"/>
|
|
||||||
</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"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
<!-- 所属平台 -->
|
|
||||||
<if test='${condition}.platform != null'>
|
|
||||||
<include refid="queryType">
|
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
|
||||||
</include>
|
|
||||||
b.platform
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="${condition}.platform"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
<!-- 处理人 -->
|
|
||||||
<if test='${condition}.handleUser != null'>
|
|
||||||
<include refid="queryType">
|
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
|
||||||
</include>
|
|
||||||
b.handle_user
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="${condition}.handleUser"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
<!-- 状态 -->
|
|
||||||
<if test='${condition}.status != null'>
|
|
||||||
<include refid="queryType">
|
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
|
||||||
</include>
|
|
||||||
b.status
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="${condition}.status"/>
|
|
||||||
</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>
|
</include>
|
||||||
<if test='custom.operator == "not like" or custom.operator == "not in"'>
|
</if>
|
||||||
b.id not in (
|
<if test="condition.name == 'follower'">
|
||||||
</if>
|
<include refid="io.metersphere.system.mapper.BaseMapper.associationCondition">
|
||||||
<if test='custom.operator != "not like" and custom.operator != "not in"'>
|
<property name="mainIdColumn" value="bug.id"/>
|
||||||
b.id in (
|
<property name="associationTable" value="bug_follower"/>
|
||||||
</if>
|
<property name="associationIdColumn" value="bug_id"/>
|
||||||
select bug_id from bug_custom_field where field_id = #{custom.id} and
|
<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="b"/>
|
||||||
|
</include>
|
||||||
|
<!-- 状态 -->
|
||||||
|
<if test="condition.name == 'status'">
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="b.status"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
<!-- 处理人 -->
|
||||||
|
<if test="condition.name == 'handleUser'">
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="b.handle_user"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
<!-- 所属平台 -->
|
||||||
|
<if test="condition.name == 'platform'">
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="b.platform"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
<!-- 用例数 -->
|
||||||
|
<if test="condition.name == 'caseTotal'">
|
||||||
<choose>
|
<choose>
|
||||||
<when test="custom.type == 'array'">
|
<when test="condition.operator == 'NOT_EMPTY'">
|
||||||
<foreach collection="custom.value" item="val" separator="or" open="(" close=")">
|
b.id in (
|
||||||
JSON_CONTAINS(`value`, JSON_ARRAY(#{val}))
|
select distinct b.id from bug b join bug_relation_case brc on b.id = brc.bug_id
|
||||||
</foreach>
|
where deleted = ${deleted} and project_id = '${projectId}'
|
||||||
|
)
|
||||||
</when>
|
</when>
|
||||||
<when test="custom.type == 'time'">
|
<when test="condition.operator == 'EMPTY'">
|
||||||
left(replace(unix_timestamp(trim(both '"' from `value`)), '.', ''), 13)
|
b.id not in (
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
select distinct b.id from bug b join bug_relation_case brc on b.id = brc.bug_id
|
||||||
<property name="object" value="custom"/>
|
where deleted = ${deleted} and project_id = '${projectId}'
|
||||||
</include>
|
)
|
||||||
|
</when>
|
||||||
|
<when test="(condition.operator == 'LT' and condition.value < 1) or (condition.operator == 'EQUALS' and condition.value < 0)">
|
||||||
|
1=2
|
||||||
</when>
|
</when>
|
||||||
<otherwise>
|
<otherwise>
|
||||||
trim(both '"' from `value`)
|
<if test="condition.operator == 'LT' or (condition.operator == 'EQUALS' and condition.value == 0)">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
b.id not in (
|
||||||
<property name="object" value="custom"/>
|
select distinct b.id from bug b join bug_relation_case brc on b.id = brc.bug_id
|
||||||
</include>
|
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>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
</otherwise>
|
</otherwise>
|
||||||
</choose>
|
</choose>
|
||||||
)
|
|
||||||
</if>
|
</if>
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
|
||||||
|
<property name="searchMode" value="${combineSearch}.searchMode"/>
|
||||||
|
</include>
|
||||||
</foreach>
|
</foreach>
|
||||||
|
<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>
|
||||||
</if>
|
</if>
|
||||||
)
|
</trim>
|
||||||
</if>
|
</trim>
|
||||||
</sql>
|
|
||||||
|
|
||||||
<sql id="prefixMode">
|
|
||||||
<choose>
|
|
||||||
<when test='${searchMode} == "AND"'>
|
|
||||||
1 = 1
|
|
||||||
</when>
|
|
||||||
<when test='${searchMode} == "OR"'>
|
|
||||||
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}"/>
|
|
||||||
</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}"/>
|
|
||||||
</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>
|
|
||||||
(b.tags is null or b.tags = '[]')
|
|
||||||
</if>
|
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="queryWhereConditionByProvider">
|
<sql id="queryWhereConditionByProvider">
|
||||||
|
@ -414,8 +342,9 @@
|
||||||
</if>
|
</if>
|
||||||
<include refid="filter"/>
|
<include refid="filter"/>
|
||||||
<include refid="combine">
|
<include refid="combine">
|
||||||
<property name="condition" value="request.combine"/>
|
<property name="combineSearch" value="request.combineSearch"/>
|
||||||
<property name="searchMode" value="request.searchMode"/>
|
<property name="projectId" value="${request.projectId}"/>
|
||||||
|
<property name="deleted" value="${request.useTrash}"/>
|
||||||
</include>
|
</include>
|
||||||
</sql>
|
</sql>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -21,7 +21,15 @@ public enum UserViewType implements ValueEnum {
|
||||||
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_REVIEW, InternalUserView.MY_CREATE)),
|
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_REVIEW, InternalUserView.MY_CREATE)),
|
||||||
API_DEFINITION("api-definition",
|
API_DEFINITION("api-definition",
|
||||||
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_FOLLOW, InternalUserView.MY_CREATE)),
|
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 String value;
|
||||||
private List<InternalUserView> internalViews;
|
private List<InternalUserView> internalViews;
|
||||||
|
|
Loading…
Reference in New Issue