feat(测试计划): 计划详情页&&用例弹窗支持高级筛选
--story=1015917 --user=宋昌昌 【通用】高级搜索与自定义视图 https://www.tapd.cn/55049933/s/1589897
This commit is contained in:
parent
fe08cc90ba
commit
7a9a2d74f2
|
@ -180,7 +180,7 @@
|
||||||
<if test="condition.name == 'createUser'">
|
<if test="condition.name == 'createUser'">
|
||||||
<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"/>
|
||||||
<property name="column" value="api_definition_mock.create_user"/>
|
<property name="column" value="m.create_user"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
|
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
|
||||||
|
|
|
@ -333,7 +333,7 @@
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
<!-- 执行结果 -->
|
<!-- 执行结果 -->
|
||||||
<if test="condition.name == 'lastReportStatus'">
|
<if test="condition.name == 'lastExecuteResult'">
|
||||||
<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"/>
|
||||||
<property name="column" value="api_scenario.last_report_status"/>
|
<property name="column" value="api_scenario.last_report_status"/>
|
||||||
|
@ -346,13 +346,6 @@
|
||||||
<property name="column" value="api_scenario.step_total"/>
|
<property name="column" value="api_scenario.step_total"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</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'">
|
<if test="condition.name == 'passRate'">
|
||||||
<choose>
|
<choose>
|
||||||
|
|
|
@ -587,12 +587,12 @@
|
||||||
<if test="condition.name == 'createUser'">
|
<if test="condition.name == 'createUser'">
|
||||||
<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"/>
|
||||||
<property name="column" value="api_test_case.create_user"/>
|
<property name="column" value="atc.create_user"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
<if test="condition.name == 'follower'">
|
<if test="condition.name == 'follower'">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.associationCondition">
|
<include refid="io.metersphere.system.mapper.BaseMapper.associationCondition">
|
||||||
<property name="mainIdColumn" value="api_test_case.id"/>
|
<property name="mainIdColumn" value="atc.id"/>
|
||||||
<property name="associationTable" value="api_test_case_follower"/>
|
<property name="associationTable" value="api_test_case_follower"/>
|
||||||
<property name="associationIdColumn" value="case_id"/>
|
<property name="associationIdColumn" value="case_id"/>
|
||||||
<property name="searchColumn" value="user_id"/>
|
<property name="searchColumn" value="user_id"/>
|
||||||
|
@ -677,7 +677,7 @@
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
<!-- 执行结果 -->
|
<!-- 执行结果 -->
|
||||||
<if test="condition.name == 'lastReportStatus'">
|
<if test="condition.name == 'lastExecuteResult'">
|
||||||
<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"/>
|
||||||
<property name="column" value="atc.last_report_status"/>
|
<property name="column" value="atc.last_report_status"/>
|
||||||
|
|
|
@ -231,12 +231,12 @@
|
||||||
<if test="condition.name == 'createUser'">
|
<if test="condition.name == 'createUser'">
|
||||||
<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"/>
|
||||||
<property name="column" value="bug.create_user"/>
|
<property name="column" value="b.create_user"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
<if test="condition.name == 'follower'">
|
<if test="condition.name == 'follower'">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.associationCondition">
|
<include refid="io.metersphere.system.mapper.BaseMapper.associationCondition">
|
||||||
<property name="mainIdColumn" value="bug.id"/>
|
<property name="mainIdColumn" value="b.id"/>
|
||||||
<property name="associationTable" value="bug_follower"/>
|
<property name="associationTable" value="bug_follower"/>
|
||||||
<property name="associationIdColumn" value="bug_id"/>
|
<property name="associationIdColumn" value="bug_id"/>
|
||||||
<property name="searchColumn" value="user_id"/>
|
<property name="searchColumn" value="user_id"/>
|
||||||
|
@ -340,12 +340,6 @@
|
||||||
or b.tags like concat('%', #{request.keyword},'%')
|
or b.tags like concat('%', #{request.keyword},'%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<include refid="filter"/>
|
|
||||||
<include refid="combine">
|
|
||||||
<property name="combineSearch" value="request.combineSearch"/>
|
|
||||||
<property name="projectId" value="${request.projectId}"/>
|
|
||||||
<property name="deleted" value="${request.useTrash}"/>
|
|
||||||
</include>
|
|
||||||
</sql>
|
</sql>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
|
@ -310,18 +310,21 @@
|
||||||
<property name="condition" value="condition"/>
|
<property name="condition" value="condition"/>
|
||||||
<property name="tablePrefix" value="functional_case"/>
|
<property name="tablePrefix" value="functional_case"/>
|
||||||
</include>
|
</include>
|
||||||
|
<!-- 评审结果 -->
|
||||||
<if test="condition.name == 'reviewStatus'">
|
<if test="condition.name == 'reviewStatus'">
|
||||||
<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"/>
|
||||||
<property name="column" value="functional_case.review_status"/>
|
<property name="column" value="functional_case.review_status"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
|
<!-- 执行结果 -->
|
||||||
<if test="condition.name == 'lastExecuteResult'">
|
<if test="condition.name == 'lastExecuteResult'">
|
||||||
<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"/>
|
||||||
<property name="column" value="functional_case.last_execute_result"/>
|
<property name="column" value="functional_case.last_execute_result"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
|
<!-- 关联需求 -->
|
||||||
<if test="condition.name == 'demand'">
|
<if test="condition.name == 'demand'">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.associationCondition">
|
<include refid="io.metersphere.system.mapper.BaseMapper.associationCondition">
|
||||||
<property name="mainIdColumn" value="functional_case.id"/>
|
<property name="mainIdColumn" value="functional_case.id"/>
|
||||||
|
@ -331,6 +334,7 @@
|
||||||
<property name="condition" value="condition"/>
|
<property name="condition" value="condition"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
|
<!-- 关联附件 -->
|
||||||
<if test="condition.name == 'attachment'">
|
<if test="condition.name == 'attachment'">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.associationCondition">
|
<include refid="io.metersphere.system.mapper.BaseMapper.associationCondition">
|
||||||
<property name="mainIdColumn" value="functional_case.id"/>
|
<property name="mainIdColumn" value="functional_case.id"/>
|
||||||
|
|
|
@ -28,7 +28,29 @@ public enum UserViewType implements ValueEnum {
|
||||||
API_SCENARIO("api-scenario",
|
API_SCENARIO("api-scenario",
|
||||||
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_FOLLOW, InternalUserView.MY_CREATE)),
|
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_FOLLOW, InternalUserView.MY_CREATE)),
|
||||||
BUG("bug",
|
BUG("bug",
|
||||||
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_FOLLOW, InternalUserView.MY_CREATE));
|
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_FOLLOW, InternalUserView.MY_CREATE)),
|
||||||
|
/**
|
||||||
|
* 计划详情用例&&缺陷列表
|
||||||
|
*/
|
||||||
|
PLAN_FUNCTIONAL_CASE("plan-functional-case",
|
||||||
|
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)),
|
||||||
|
PLAN_API_CASE("plan-api-case",
|
||||||
|
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)),
|
||||||
|
PLAN_API_SCENARIO("plan-api-scenario",
|
||||||
|
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)),
|
||||||
|
PLAN_BUG("plan-bug",
|
||||||
|
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)),
|
||||||
|
/**
|
||||||
|
* 计划关联用例&&缺陷弹窗
|
||||||
|
*/
|
||||||
|
PLAN_FUNCTIONAL_CASE_DRAWER("plan-functional-case-drawer",
|
||||||
|
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)),
|
||||||
|
PLAN_API_CASE_DRAWER("plan-api-case-drawer",
|
||||||
|
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)),
|
||||||
|
PLAN_API_SCENARIO_DRAWER("plan-api-scenario-drawer",
|
||||||
|
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)),
|
||||||
|
PLAN_BUG_DRAWER("plan-bug--drawer",
|
||||||
|
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE));
|
||||||
|
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|
|
@ -16,6 +16,7 @@ import io.metersphere.plan.dto.response.TestPlanApiCasePageResponse;
|
||||||
import io.metersphere.project.dto.DropNode;
|
import io.metersphere.project.dto.DropNode;
|
||||||
import io.metersphere.project.dto.ModuleCountDTO;
|
import io.metersphere.project.dto.ModuleCountDTO;
|
||||||
import io.metersphere.project.dto.NodeSortQueryParam;
|
import io.metersphere.project.dto.NodeSortQueryParam;
|
||||||
|
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;
|
||||||
|
@ -36,8 +37,10 @@ public interface ExtTestPlanApiCaseMapper {
|
||||||
|
|
||||||
List<TestPlanCaseRunResultCount> selectCaseExecResultCount(String testPlanId);
|
List<TestPlanCaseRunResultCount> selectCaseExecResultCount(String testPlanId);
|
||||||
|
|
||||||
|
@BaseConditionFilter
|
||||||
List<ApiDefinitionDTO> list(@Param("request") TestPlanApiRequest request, @Param("isRepeat") boolean isRepeat);
|
List<ApiDefinitionDTO> list(@Param("request") TestPlanApiRequest request, @Param("isRepeat") boolean isRepeat);
|
||||||
|
|
||||||
|
@BaseConditionFilter
|
||||||
List<TestPlanApiCasePageResponse> relateApiCaseList(@Param("request") TestPlanApiCaseRequest request, @Param("deleted") boolean deleted);
|
List<TestPlanApiCasePageResponse> relateApiCaseList(@Param("request") TestPlanApiCaseRequest request, @Param("deleted") boolean deleted);
|
||||||
|
|
||||||
List<FunctionalCaseModuleCountDTO> countModuleIdByRequest(@Param("request") TestPlanApiCaseRequest request, @Param("deleted") boolean deleted);
|
List<FunctionalCaseModuleCountDTO> countModuleIdByRequest(@Param("request") TestPlanApiCaseRequest request, @Param("deleted") boolean deleted);
|
||||||
|
@ -52,6 +55,7 @@ public interface ExtTestPlanApiCaseMapper {
|
||||||
|
|
||||||
List<ApiCaseModuleDTO> selectBaseByProjectIdAndTestPlanId(@Param("testPlanId") String testPlanId);
|
List<ApiCaseModuleDTO> selectBaseByProjectIdAndTestPlanId(@Param("testPlanId") String testPlanId);
|
||||||
|
|
||||||
|
@BaseConditionFilter
|
||||||
List<String> getIds(@Param("request") TestPlanApiCaseBatchRequest request, @Param("deleted") boolean deleted);
|
List<String> getIds(@Param("request") TestPlanApiCaseBatchRequest request, @Param("deleted") boolean deleted);
|
||||||
|
|
||||||
void batchUpdateExecutor(@Param("ids") List<String> ids, @Param("userId") String userId);
|
void batchUpdateExecutor(@Param("ids") List<String> ids, @Param("userId") String userId);
|
||||||
|
|
|
@ -84,53 +84,49 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="list" resultMap="ApiDefinitionDTO">
|
<select id="list" resultMap="ApiDefinitionDTO">
|
||||||
select
|
select a.id, a.`name`, a.protocol, a.`method`, a.`path`, a.`status`, a.num, a.tags, a.pos,
|
||||||
api_definition.id, api_definition.`name`, api_definition.protocol, api_definition.`method`,
|
a.project_id, a.module_id, a.latest, a.version_id, a.ref_id, a.description,
|
||||||
api_definition.`path`, api_definition.`status`, api_definition.num, api_definition.tags, api_definition.pos,
|
a.create_time, a.create_user, a.update_time, a.update_user, a.delete_user, a.delete_time, a.deleted,
|
||||||
api_definition.project_id, api_definition.module_id, api_definition.latest, api_definition.version_id,
|
project_version.name as version_name
|
||||||
api_definition.ref_id, api_definition.description, api_definition.create_time, api_definition.create_user,
|
from api_definition a left join project_version on project_version.id = a.version_id
|
||||||
api_definition.update_time, api_definition.update_user, api_definition.delete_user, api_definition.delete_time,
|
where a.deleted = false
|
||||||
api_definition.deleted, project_version.name as version_name
|
|
||||||
from api_definition
|
|
||||||
LEFT JOIN project_version ON project_version.id = api_definition.version_id
|
|
||||||
where api_definition.deleted = false
|
|
||||||
<include refid="queryWhereCondition"/>
|
<include refid="queryWhereCondition"/>
|
||||||
and exists (
|
and exists (
|
||||||
select id
|
|
||||||
from api_test_case c
|
|
||||||
where c.api_definition_id = api_definition.id and c.deleted = false
|
|
||||||
<if test="!isRepeat">
|
|
||||||
and not exists (
|
|
||||||
select id
|
select id
|
||||||
from test_plan_api_case t
|
from api_test_case atc
|
||||||
where t.api_case_id = c.id
|
where atc.api_definition_id = a.id and atc.deleted = false
|
||||||
and t.test_plan_id = #{request.testPlanId}
|
<if test="!isRepeat">
|
||||||
)
|
and not exists (
|
||||||
</if>
|
select id
|
||||||
|
from test_plan_api_case t
|
||||||
|
where t.api_case_id = atc.id
|
||||||
|
and t.test_plan_id = #{request.testPlanId}
|
||||||
|
)
|
||||||
|
</if>
|
||||||
)
|
)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<sql id="queryWhereCondition">
|
<sql id="queryWhereCondition">
|
||||||
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
||||||
and api_definition.module_id in
|
and a.module_id in
|
||||||
<foreach collection="request.moduleIds" item="moduleId" separator="," open="(" close=")">
|
<foreach collection="request.moduleIds" item="moduleId" separator="," open="(" close=")">
|
||||||
#{moduleId}
|
#{moduleId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="request.keyword != null and request.keyword != ''">
|
<if test="request.keyword != null and request.keyword != ''">
|
||||||
and (
|
and (
|
||||||
api_definition.name like concat('%', #{request.keyword},'%')
|
a.name like concat('%', #{request.keyword},'%')
|
||||||
or api_definition.num like concat('%', #{request.keyword},'%')
|
or a.num like concat('%', #{request.keyword},'%')
|
||||||
or api_definition.path like concat('%', #{request.keyword},'%')
|
or a.path like concat('%', #{request.keyword},'%')
|
||||||
or api_definition.tags like concat('%', #{request.keyword},'%')
|
or a.tags like concat('%', #{request.keyword},'%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="request.projectId != null and request.projectId != ''">
|
<if test="request.projectId != null and request.projectId != ''">
|
||||||
and api_definition.project_id = #{request.projectId}
|
and a.project_id = #{request.projectId}
|
||||||
</if>
|
</if>
|
||||||
<if test="request.protocols != null and request.protocols.size() > 0">
|
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||||
AND api_definition.protocol in
|
and a.protocol in
|
||||||
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||||
#{protocol}
|
#{protocol}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
@ -138,19 +134,13 @@
|
||||||
<include refid="filters">
|
<include refid="filters">
|
||||||
<property name="filter" value="request.filter"/>
|
<property name="filter" value="request.filter"/>
|
||||||
</include>
|
</include>
|
||||||
<choose>
|
|
||||||
<when test='request.searchMode == "AND"'>
|
<include refid="combine">
|
||||||
AND
|
<property name="combineSearch" value="request.combineSearch"/>
|
||||||
<include refid="queryCombine"/>
|
</include>
|
||||||
</when>
|
|
||||||
<when test='request.searchMode == "OR"'>
|
|
||||||
and (
|
|
||||||
<include refid="queryCombine"/>
|
|
||||||
)
|
|
||||||
</when>
|
|
||||||
</choose>
|
|
||||||
<include refid="queryVersionCondition">
|
<include refid="queryVersionCondition">
|
||||||
<property name="versionTable" value="api_definition"/>
|
<property name="versionTable" value="a"/>
|
||||||
</include>
|
</include>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
@ -200,195 +190,6 @@
|
||||||
</if>
|
</if>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="queryCombine">
|
|
||||||
<if test="request.combine != null">
|
|
||||||
<include refid="combine">
|
|
||||||
<property name="condition" value="request.combine"/>
|
|
||||||
<property name="searchMode" value="request.searchMode"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
1=1
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<sql id="combine">
|
|
||||||
<!-- 名称 -->
|
|
||||||
<if test='${condition}.name != null'>
|
|
||||||
api_definition.name
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="${condition}.name"/>
|
|
||||||
</include>
|
|
||||||
<include refid="queryType">
|
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
<!-- id -->
|
|
||||||
<if test='${condition}.id != null'>
|
|
||||||
api_definition.num
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="${condition}.id"/>
|
|
||||||
</include>
|
|
||||||
<include refid="queryType">
|
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
<!-- 所属模块 -->
|
|
||||||
<if test='${condition}.moduleId != null'>
|
|
||||||
api_definition.moduleId
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="${condition}.moduleId"/>
|
|
||||||
</include>
|
|
||||||
<include refid="queryType">
|
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
<!-- 创建人 -->
|
|
||||||
<if test='${condition}.createUser != null'>
|
|
||||||
api_definition.create_user
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="${condition}.createUser"/>
|
|
||||||
</include>
|
|
||||||
<include refid="queryType">
|
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
<!-- 创建时间 -->
|
|
||||||
<if test='${condition}.createTime != null'>
|
|
||||||
api_definition.create_time
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="${condition}.createTime"/>
|
|
||||||
</include>
|
|
||||||
<include refid="queryType">
|
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
<!-- 更新人 -->
|
|
||||||
<if test='${condition}.updateUser != null'>
|
|
||||||
api_definition.update_user
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="${condition}.updateUser"/>
|
|
||||||
</include>
|
|
||||||
<include refid="queryType">
|
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
<!-- 更新时间 -->
|
|
||||||
<if test='${condition}.updateTime != null'>
|
|
||||||
api_definition.update_time
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="${condition}.updateTime"/>
|
|
||||||
</include>
|
|
||||||
<include refid="queryType">
|
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
<!-- 状态 -->
|
|
||||||
<if test="${condition}.status != null">
|
|
||||||
api_definition.status
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="${condition}.status"/>
|
|
||||||
</include>
|
|
||||||
<include refid="queryType">
|
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
<!-- 路径 -->
|
|
||||||
<if test="${condition}.path != null">
|
|
||||||
api_definition.path
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="${condition}.path"/>
|
|
||||||
</include>
|
|
||||||
<include refid="queryType">
|
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
<!-- 方法 -->
|
|
||||||
<if test="${condition}.method != null">
|
|
||||||
api_definition.method
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="${condition}.method"/>
|
|
||||||
</include>
|
|
||||||
<include refid="queryType">
|
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
|
||||||
</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="">
|
|
||||||
api_definition.id ${custom.operator} (
|
|
||||||
select api_id from api_definition_custom_field where field_id = #{custom.id}
|
|
||||||
<choose>
|
|
||||||
<when test="custom.type == 'List'">
|
|
||||||
and JSON_CONTAINS(`value`, json_array(#{custom.value}))
|
|
||||||
</when>
|
|
||||||
<when test="custom.type == 'date' or custom.type == 'datetime'">
|
|
||||||
and `value`
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="custom"/>
|
|
||||||
</include>
|
|
||||||
</when>
|
|
||||||
<otherwise>
|
|
||||||
and trim(both '"' from `value`)
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="custom"/>
|
|
||||||
</include>
|
|
||||||
</otherwise>
|
|
||||||
</choose>
|
|
||||||
)
|
|
||||||
<include refid="queryType">
|
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
|
||||||
</include>
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<sql id="queryTag">
|
|
||||||
<!-- 不包含 -->
|
|
||||||
<if test='${combineTag}.value.size() > 0 and ${combineTag}.operator == "not like"'>
|
|
||||||
(
|
|
||||||
api_definition.tags is null or api_definition.tags = '[]' or
|
|
||||||
<foreach collection="${combineTag}.value" item="tag" separator="and" open="(" close=")">
|
|
||||||
!JSON_CONTAINS(api_definition.tags, JSON_ARRAY(#{tag}))
|
|
||||||
</foreach>
|
|
||||||
)
|
|
||||||
<include refid="queryType">
|
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
<!-- 包含 -->
|
|
||||||
<if test='${combineTag}.value.size() > 0 and ${combineTag}.operator == "like"'>
|
|
||||||
<foreach collection="${combineTag}.value" item="tag" separator="or" open="(" close=")">
|
|
||||||
JSON_CONTAINS(api_definition.tags, JSON_ARRAY(#{tag}))
|
|
||||||
</foreach>
|
|
||||||
<include refid="queryType">
|
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
<!-- 空 -->
|
|
||||||
<if test='${combineTag}.operator == "is null"'>
|
|
||||||
(api_definition.tags is null or api_definition.tags = '[]')
|
|
||||||
<include refid="queryType">
|
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<sql id="queryType">
|
|
||||||
<choose>
|
|
||||||
<when test='${searchMode} == "AND"'>
|
|
||||||
AND
|
|
||||||
</when>
|
|
||||||
<when test='${searchMode} == "OR"'>
|
|
||||||
OR
|
|
||||||
</when>
|
|
||||||
</choose>
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<sql id="queryVersionCondition">
|
<sql id="queryVersionCondition">
|
||||||
<choose>
|
<choose>
|
||||||
<when test="request.versionId != null and request.versionId != ''">
|
<when test="request.versionId != null and request.versionId != ''">
|
||||||
|
@ -437,6 +238,7 @@
|
||||||
and t.test_plan_id = #{request.testPlanId}
|
and t.test_plan_id = #{request.testPlanId}
|
||||||
<include refid="queryApiCaseWhereCondition"/>
|
<include refid="queryApiCaseWhereCondition"/>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectByTestPlanIdAndNotDeleted" resultType="io.metersphere.plan.domain.TestPlanApiCase">
|
<select id="selectByTestPlanIdAndNotDeleted" resultType="io.metersphere.plan.domain.TestPlanApiCase">
|
||||||
SELECT t.*
|
SELECT t.*
|
||||||
FROM test_plan_api_case t
|
FROM test_plan_api_case t
|
||||||
|
@ -498,6 +300,11 @@
|
||||||
<property name="filter" value="request.filter"/>
|
<property name="filter" value="request.filter"/>
|
||||||
<property name="nullExecutorKey" value="request.nullExecutorKey"/>
|
<property name="nullExecutorKey" value="request.nullExecutorKey"/>
|
||||||
</include>
|
</include>
|
||||||
|
|
||||||
|
<include refid="combine">
|
||||||
|
<property name="combineSearch" value="request.combineSearch"/>
|
||||||
|
</include>
|
||||||
|
|
||||||
<include refid="queryApiCaseVersionCondition">
|
<include refid="queryApiCaseVersionCondition">
|
||||||
<property name="versionTable" value="atc"/>
|
<property name="versionTable" value="atc"/>
|
||||||
</include>
|
</include>
|
||||||
|
@ -576,6 +383,116 @@
|
||||||
</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="atc.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="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 == 'executeUser'">
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="t.execute_user"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
<!-- 执行结果 -->
|
||||||
|
<if test="condition.name == 'lastExecuteResult'">
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="t.last_exec_result"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
|
||||||
|
<property name="searchMode" value="${combineSearch}.searchMode"/>
|
||||||
|
</include>
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</trim>
|
||||||
|
</sql>
|
||||||
|
|
||||||
<sql id="queryApiCaseVersionCondition">
|
<sql id="queryApiCaseVersionCondition">
|
||||||
<if test="request.versionId != null and request.versionId != ''">
|
<if test="request.versionId != null and request.versionId != ''">
|
||||||
|
@ -689,6 +606,9 @@
|
||||||
<property name="filter" value="request.condition.filter"/>
|
<property name="filter" value="request.condition.filter"/>
|
||||||
<property name="nullExecutorKey" value="request.nullExecutorKey"/>
|
<property name="nullExecutorKey" value="request.nullExecutorKey"/>
|
||||||
</include>
|
</include>
|
||||||
|
<include refid="combine">
|
||||||
|
<property name="combineSearch" value="request.condition.combineSearch"/>
|
||||||
|
</include>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<update id="batchUpdateExecutor">
|
<update id="batchUpdateExecutor">
|
||||||
|
|
|
@ -15,6 +15,7 @@ import io.metersphere.plan.dto.response.TestPlanApiScenarioPageResponse;
|
||||||
import io.metersphere.project.dto.DropNode;
|
import io.metersphere.project.dto.DropNode;
|
||||||
import io.metersphere.project.dto.ModuleCountDTO;
|
import io.metersphere.project.dto.ModuleCountDTO;
|
||||||
import io.metersphere.project.dto.NodeSortQueryParam;
|
import io.metersphere.project.dto.NodeSortQueryParam;
|
||||||
|
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;
|
||||||
|
@ -37,6 +38,7 @@ public interface ExtTestPlanApiScenarioMapper {
|
||||||
|
|
||||||
List<TestPlanApiScenario> selectByTestPlanIdAndNotDeleted(String testPlanId);
|
List<TestPlanApiScenario> selectByTestPlanIdAndNotDeleted(String testPlanId);
|
||||||
|
|
||||||
|
@BaseConditionFilter
|
||||||
List<TestPlanApiScenarioPageResponse> relateApiScenarioList(@Param("request") TestPlanApiScenarioRequest request, @Param("deleted") boolean deleted);
|
List<TestPlanApiScenarioPageResponse> relateApiScenarioList(@Param("request") TestPlanApiScenarioRequest request, @Param("deleted") boolean deleted);
|
||||||
|
|
||||||
List<FunctionalCaseModuleCountDTO> countModuleIdByRequest(@Param("request") TestPlanApiScenarioModuleRequest request, @Param("deleted") boolean deleted);
|
List<FunctionalCaseModuleCountDTO> countModuleIdByRequest(@Param("request") TestPlanApiScenarioModuleRequest request, @Param("deleted") boolean deleted);
|
||||||
|
@ -61,6 +63,7 @@ public interface ExtTestPlanApiScenarioMapper {
|
||||||
|
|
||||||
List<TestPlanApiScenario> getScenarioExecuteInfoByIds(@Param("ids") List<String> ids);
|
List<TestPlanApiScenario> getScenarioExecuteInfoByIds(@Param("ids") List<String> ids);
|
||||||
|
|
||||||
|
@BaseConditionFilter
|
||||||
List<String> getIds(@Param("request") BasePlanCaseBatchRequest request, @Param("deleted") boolean deleted);
|
List<String> getIds(@Param("request") BasePlanCaseBatchRequest request, @Param("deleted") boolean deleted);
|
||||||
|
|
||||||
void batchUpdateExecutor(@Param("ids") List<String> ids, @Param("userId") String userId);
|
void batchUpdateExecutor(@Param("ids") List<String> ids, @Param("userId") String userId);
|
||||||
|
|
|
@ -147,13 +147,9 @@
|
||||||
<property name="nullExecutorKey" value="request.nullExecutorKey"/>
|
<property name="nullExecutorKey" value="request.nullExecutorKey"/>
|
||||||
</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>
|
|
||||||
|
|
||||||
<include refid="queryVersionCondition">
|
<include refid="queryVersionCondition">
|
||||||
<property name="versionTable" value="api_scenario"/>
|
<property name="versionTable" value="api_scenario"/>
|
||||||
|
@ -253,93 +249,91 @@
|
||||||
</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'">
|
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
|
||||||
and ${custom.value}
|
<property name="searchMode" value="${combineSearch}.searchMode"/>
|
||||||
</when>
|
</include>
|
||||||
<when test="custom.type == 'DATE' or custom.type == 'DATETIME'">
|
</foreach>
|
||||||
and left(replace(unix_timestamp(trim(both '"' from `value`)), '.', ''), 13)
|
<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 == 'executeUser'">
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="test_plan_api_scenario.execute_user"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
<!-- 执行结果 -->
|
||||||
|
<if test="condition.name == 'lastExecuteResult'">
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="test_plan_api_scenario.last_exec_result"/>
|
||||||
|
</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">
|
||||||
|
@ -501,13 +495,9 @@
|
||||||
<property name="filter" value="request.condition.filter"/>
|
<property name="filter" value="request.condition.filter"/>
|
||||||
<property name="nullExecutorKey" value="request.nullExecutorKey"/>
|
<property name="nullExecutorKey" value="request.nullExecutorKey"/>
|
||||||
</include>
|
</include>
|
||||||
<if test="request.condition.combine != null and request.condition.combine != ''">
|
<include refid="combine">
|
||||||
<include refid="combine">
|
<property name="combineSearch" value="request.condition.combineSearch"/>
|
||||||
<property name="condition" value="request.condition.combine"/>
|
</include>
|
||||||
<property name="name" value="request.name"/>
|
|
||||||
<property name="ObjectTags" value="request.condition.combine.tags"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="getPlanScenarioCaseNotDeletedByCollectionIds"
|
<select id="getPlanScenarioCaseNotDeletedByCollectionIds"
|
||||||
|
|
|
@ -4,10 +4,14 @@ import io.metersphere.plan.dto.TestPlanBugCaseDTO;
|
||||||
import io.metersphere.plan.dto.TestPlanCaseBugDTO;
|
import io.metersphere.plan.dto.TestPlanCaseBugDTO;
|
||||||
import io.metersphere.plan.dto.request.TestPlanBugPageRequest;
|
import io.metersphere.plan.dto.request.TestPlanBugPageRequest;
|
||||||
import io.metersphere.plan.dto.response.TestPlanBugPageResponse;
|
import io.metersphere.plan.dto.response.TestPlanBugPageResponse;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author song-cc-rock
|
||||||
|
*/
|
||||||
public interface ExtTestPlanBugMapper {
|
public interface ExtTestPlanBugMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,6 +19,7 @@ public interface ExtTestPlanBugMapper {
|
||||||
* @param request 请求参数
|
* @param request 请求参数
|
||||||
* @return 缺陷列表
|
* @return 缺陷列表
|
||||||
*/
|
*/
|
||||||
|
@BaseConditionFilter
|
||||||
List<TestPlanBugPageResponse> list(@Param("request") TestPlanBugPageRequest request);
|
List<TestPlanBugPageResponse> list(@Param("request") TestPlanBugPageRequest request);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
<property name="filter" value="request.filter"/>
|
<property name="filter" value="request.filter"/>
|
||||||
</include>
|
</include>
|
||||||
<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>
|
||||||
group by brc.bug_id
|
group by brc.bug_id
|
||||||
</select>
|
</select>
|
||||||
|
@ -102,180 +102,108 @@
|
||||||
</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="b.create_user"/>
|
||||||
<include refid="queryType">
|
</include>
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
</if>
|
||||||
</include>
|
<if test="condition.name == 'follower'">
|
||||||
b.num
|
<include refid="io.metersphere.system.mapper.BaseMapper.associationCondition">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<property name="mainIdColumn" value="b.id"/>
|
||||||
<property name="object" value="${condition}.num"/>
|
<property name="associationTable" value="bug_follower"/>
|
||||||
</include>
|
<property name="associationIdColumn" value="bug_id"/>
|
||||||
</if>
|
<property name="searchColumn" value="user_id"/>
|
||||||
<!-- 名称 -->
|
<property name="condition" value="condition"/>
|
||||||
<if test='${condition}.title != null'>
|
</include>
|
||||||
<include refid="queryType">
|
</if>
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
|
||||||
</include>
|
<property name="searchMode" value="${combineSearch}.searchMode"/>
|
||||||
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"'>
|
</foreach>
|
||||||
b.id not in (
|
<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>
|
||||||
<if test='custom.operator != "not like" and custom.operator != "not in"'>
|
<!-- 处理人 -->
|
||||||
b.id in (
|
<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>
|
||||||
select bug_id from bug_custom_field where field_id = #{custom.id} and
|
<!-- 所属平台 -->
|
||||||
<choose>
|
<if test="condition.name == 'platform'">
|
||||||
<when test="custom.type == 'array'">
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
<foreach collection="custom.value" item="val" separator="or" open="(" close=")">
|
<property name="condition" value="condition"/>
|
||||||
JSON_CONTAINS(`value`, JSON_ARRAY(#{val}))
|
<property name="column" value="b.platform"/>
|
||||||
</foreach>
|
</include>
|
||||||
</when>
|
</if>
|
||||||
<when test="custom.type == 'time'">
|
<!-- 用例数 -->
|
||||||
left(replace(unix_timestamp(trim(both '"' from `value`)), '.', ''), 13)
|
<if test="condition.name == 'caseTotal'">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<choose>
|
||||||
<property name="object" value="custom"/>
|
<when test="condition.operator == 'NOT_EMPTY'">
|
||||||
</include>
|
b.id in (
|
||||||
</when>
|
select distinct b.id from bug b join bug_relation_case brc on b.id = brc.bug_id
|
||||||
<otherwise>
|
where deleted = ${deleted} and project_id = '${projectId}'
|
||||||
trim(both '"' from `value`)
|
)
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
</when>
|
||||||
<property name="object" value="custom"/>
|
<when test="condition.operator == 'EMPTY'">
|
||||||
</include>
|
b.id not in (
|
||||||
</otherwise>
|
select distinct b.id from bug b join bug_relation_case brc on b.id = brc.bug_id
|
||||||
</choose>
|
where deleted = ${deleted} and project_id = '${projectId}'
|
||||||
)
|
)
|
||||||
</if>
|
</when>
|
||||||
</foreach>
|
<when test="(condition.operator == 'LT' and condition.value < 1) or (condition.operator == 'EQUALS' and condition.value < 0)">
|
||||||
</if>
|
1=2
|
||||||
)
|
</when>
|
||||||
</if>
|
<otherwise>
|
||||||
</sql>
|
<if test="condition.operator == 'LT' or (condition.operator == 'EQUALS' and condition.value == 0)">
|
||||||
|
b.id not in (
|
||||||
<sql id="prefixMode">
|
select distinct b.id from bug b join bug_relation_case brc on b.id = brc.bug_id
|
||||||
<choose>
|
where deleted = ${deleted} and project_id = '${projectId}'
|
||||||
<when test='${searchMode} == "AND"'>
|
)
|
||||||
1 = 1
|
<if test="condition.value > 1">
|
||||||
</when>
|
OR
|
||||||
<when test='${searchMode} == "OR"'>
|
</if>
|
||||||
1 = 2
|
</if>
|
||||||
</when>
|
<if test="(condition.operator == 'EQUALS' and condition.value > 0) or (condition.operator == 'LT' and condition.value > 1) or condition.operator == 'GT'">
|
||||||
</choose>
|
b.id in (
|
||||||
</sql>
|
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
|
||||||
<sql id="queryType">
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
<choose>
|
<property name="condition" value="condition"/>
|
||||||
<when test='${searchMode} == "AND"'>
|
<property name="column" value="count(b.id)"/>
|
||||||
and
|
</include>
|
||||||
</when>
|
)
|
||||||
<when test='${searchMode} == "OR"'>
|
</if>
|
||||||
or
|
</otherwise>
|
||||||
</when>
|
</choose>
|
||||||
</choose>
|
</if>
|
||||||
</sql>
|
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
|
||||||
|
<property name="searchMode" value="${combineSearch}.searchMode"/>
|
||||||
<sql id="queryTag">
|
</include>
|
||||||
<!-- 不包含 -->
|
</foreach>
|
||||||
<if test='${combineTag}.value.size() > 0 and ${combineTag}.operator == "not like"'>
|
<include refid="io.metersphere.system.mapper.BaseMapper.customFiledConditions">
|
||||||
<include refid="queryType">
|
<property name="mainIdColumn" value="bug.id"/>
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
<property name="associationTable" value="bug_custom_field"/>
|
||||||
</include>
|
<property name="associationIdColumn" value="bug_id"/>
|
||||||
(
|
<property name="combineSearch" value="${combineSearch}"/>
|
||||||
b.tags is null or b.tags = '[]' or
|
</include>
|
||||||
<foreach collection="${combineTag}.value" item="tag" separator="and" open="(" close=")">
|
</if>
|
||||||
!JSON_CONTAINS(b.tags, JSON_ARRAY(#{tag}))
|
</trim>
|
||||||
</foreach>
|
</trim>
|
||||||
)
|
|
||||||
</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>
|
||||||
</mapper>
|
</mapper>
|
|
@ -16,6 +16,7 @@ import io.metersphere.plan.dto.response.TestPlanCasePageResponse;
|
||||||
import io.metersphere.project.dto.DropNode;
|
import io.metersphere.project.dto.DropNode;
|
||||||
import io.metersphere.project.dto.ModuleCountDTO;
|
import io.metersphere.project.dto.ModuleCountDTO;
|
||||||
import io.metersphere.project.dto.NodeSortQueryParam;
|
import io.metersphere.project.dto.NodeSortQueryParam;
|
||||||
|
import io.metersphere.system.interceptor.BaseConditionFilter;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -37,6 +38,7 @@ public interface ExtTestPlanFunctionalCaseMapper {
|
||||||
|
|
||||||
DropNode selectNodeByPosOperator(NodeSortQueryParam nodeSortQueryParam);
|
DropNode selectNodeByPosOperator(NodeSortQueryParam nodeSortQueryParam);
|
||||||
|
|
||||||
|
@BaseConditionFilter
|
||||||
List<TestPlanCasePageResponse> getCasePage(@Param("request") TestPlanCaseRequest request, @Param("deleted") boolean deleted, @Param("sort") String sort);
|
List<TestPlanCasePageResponse> getCasePage(@Param("request") TestPlanCaseRequest request, @Param("deleted") boolean deleted, @Param("sort") String sort);
|
||||||
|
|
||||||
List<TestPlanFunctionalCase> selectByTestPlanIdAndNotDeleted(String testPlanId);
|
List<TestPlanFunctionalCase> selectByTestPlanIdAndNotDeleted(String testPlanId);
|
||||||
|
@ -49,6 +51,7 @@ public interface ExtTestPlanFunctionalCaseMapper {
|
||||||
|
|
||||||
long caseCount(@Param("request") TestPlanCaseRequest request, @Param("deleted") boolean deleted);
|
long caseCount(@Param("request") TestPlanCaseRequest request, @Param("deleted") boolean deleted);
|
||||||
|
|
||||||
|
@BaseConditionFilter
|
||||||
List<String> getIds(@Param("request") BasePlanCaseBatchRequest request, @Param("deleted") boolean deleted);
|
List<String> getIds(@Param("request") BasePlanCaseBatchRequest request, @Param("deleted") boolean deleted);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -166,17 +166,9 @@
|
||||||
<property name="filter" value="request.filter"/>
|
<property name="filter" value="request.filter"/>
|
||||||
<property name="nullExecutorKey" value="request.nullExecutorKey"/>
|
<property name="nullExecutorKey" value="request.nullExecutorKey"/>
|
||||||
</include>
|
</include>
|
||||||
<choose>
|
<include refid="combine">
|
||||||
<when test='request.searchMode == "AND"'>
|
<property name="combineSearch" value="request.combineSearch"/>
|
||||||
AND
|
</include>
|
||||||
<include refid="queryCombine"/>
|
|
||||||
</when>
|
|
||||||
<when test='request.searchMode == "OR"'>
|
|
||||||
and (
|
|
||||||
<include refid="queryCombine"/>
|
|
||||||
)
|
|
||||||
</when>
|
|
||||||
</choose>
|
|
||||||
<include refid="queryVersionCondition">
|
<include refid="queryVersionCondition">
|
||||||
<property name="versionTable" value="functional_case"/>
|
<property name="versionTable" value="functional_case"/>
|
||||||
</include>
|
</include>
|
||||||
|
@ -210,17 +202,9 @@
|
||||||
<property name="filter" value="request.condition.filter"/>
|
<property name="filter" value="request.condition.filter"/>
|
||||||
<property name="nullExecutorKey" value="request.nullExecutorKey"/>
|
<property name="nullExecutorKey" value="request.nullExecutorKey"/>
|
||||||
</include>
|
</include>
|
||||||
<choose>
|
<include refid="combine">
|
||||||
<when test='request.condition.searchMode == "AND"'>
|
<property name="combineSearch" value="request.condition.combineSearch"/>
|
||||||
AND
|
</include>
|
||||||
<include refid="batchQueryCombine"/>
|
|
||||||
</when>
|
|
||||||
<when test='request.condition.searchMode == "OR"'>
|
|
||||||
and (
|
|
||||||
<include refid="batchQueryCombine"/>
|
|
||||||
)
|
|
||||||
</when>
|
|
||||||
</choose>
|
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="filters">
|
<sql id="filters">
|
||||||
|
@ -308,131 +292,128 @@
|
||||||
</if>
|
</if>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="batchQueryCombine">
|
|
||||||
<if test="request.condition.combine != null">
|
|
||||||
<include refid="combine">
|
|
||||||
<property name="condition" value="request.condition.combine"/>
|
|
||||||
<property name="searchMode" value="request.condition.searchMode"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
1=1
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<sql id="queryCombine">
|
|
||||||
<if test="request.combine != null">
|
|
||||||
<include refid="combine">
|
|
||||||
<property name="condition" value="request.combine"/>
|
|
||||||
<property name="searchMode" value="request.searchMode"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
1=1
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<sql id="combine">
|
<sql id="combine">
|
||||||
<!-- 名称 -->
|
<trim prefix="AND">
|
||||||
<if test='${condition}.name != null'>
|
<trim prefix="(" suffix=")" suffixOverrides="AND|OR">
|
||||||
functional_case.name
|
<if test="${combineSearch} != null">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<foreach collection="${combineSearch}.userViewConditions" item="condition">
|
||||||
<property name="object" value="${condition}.name"/>
|
<if test="condition.name == 'createUser'">
|
||||||
</include>
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
<include refid="queryType">
|
<property name="condition" value="condition"/>
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
<property name="column" value="functional_case.create_user"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
<!-- id -->
|
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
|
||||||
<if test='${condition}.id != null'>
|
<property name="searchMode" value="${combineSearch}.searchMode"/>
|
||||||
functional_case.num
|
</include>
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
</foreach>
|
||||||
<property name="object" value="${condition}.id"/>
|
<foreach collection="${combineSearch}.systemFieldConditions" item="condition">
|
||||||
</include>
|
<include refid="io.metersphere.system.mapper.BaseMapper.commonSystemFieldConditions">
|
||||||
<include refid="queryType">
|
<property name="condition" value="condition"/>
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
<property name="tablePrefix" value="functional_case"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
<!-- 评审结果 -->
|
||||||
<!-- 所属模块 -->
|
<if test="condition.name == 'reviewStatus'">
|
||||||
<if test='${condition}.moduleId != null'>
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
functional_case.moduleId
|
<property name="condition" value="condition"/>
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<property name="column" value="functional_case.review_status"/>
|
||||||
<property name="object" value="${condition}.moduleId"/>
|
</include>
|
||||||
</include>
|
</if>
|
||||||
<include refid="queryType">
|
<!-- 执行人 -->
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
<if test="condition.name == 'executeUser'">
|
||||||
</include>
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
</if>
|
<property name="condition" value="condition"/>
|
||||||
<!-- 创建人 -->
|
<property name="column" value="test_plan_functional_case.execute_user"/>
|
||||||
<if test='${condition}.createUser != null'>
|
</include>
|
||||||
functional_case.create_user
|
</if>
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<!-- 执行结果 -->
|
||||||
<property name="object" value="${condition}.createUser"/>
|
<if test="condition.name == 'lastExecuteResult'">
|
||||||
</include>
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
<include refid="queryType">
|
<property name="condition" value="condition"/>
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
<property name="column" value="test_plan_functional_case.last_exec_result"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
<!-- 创建时间 -->
|
<!-- 关联需求 -->
|
||||||
<if test='${condition}.createTime != null'>
|
<if test="condition.name == 'demand'">
|
||||||
functional_case.create_time
|
<include refid="io.metersphere.system.mapper.BaseMapper.associationCondition">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<property name="mainIdColumn" value="functional_case.id"/>
|
||||||
<property name="object" value="${condition}.createTime"/>
|
<property name="associationTable" value="functional_case_demand"/>
|
||||||
</include>
|
<property name="associationIdColumn" value="case_id"/>
|
||||||
<include refid="queryType">
|
<property name="searchColumn" value="demand_name"/>
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
<property name="condition" value="condition"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
<!-- 更新人 -->
|
<!-- 关联附件 -->
|
||||||
<if test='${condition}.updateUser != null'>
|
<if test="condition.name == 'attachment'">
|
||||||
functional_case.update_user
|
<include refid="io.metersphere.system.mapper.BaseMapper.associationCondition">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<property name="mainIdColumn" value="functional_case.id"/>
|
||||||
<property name="object" value="${condition}.updateUser"/>
|
<property name="associationTable" value="functional_case_attachment"/>
|
||||||
</include>
|
<property name="associationIdColumn" value="case_id"/>
|
||||||
<include refid="queryType">
|
<property name="searchColumn" value="file_name"/>
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
<property name="condition" value="condition"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
<choose>
|
||||||
<!-- 更新时间 -->
|
<when test="condition.operator == 'NOT_IN' or condition.operator == 'NOT_EQUALS' or condition.operator == 'NOT_CONTAINS'">
|
||||||
<if test='${condition}.updateTime != null'>
|
and
|
||||||
functional_case.update_time
|
</when>
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<otherwise>
|
||||||
<property name="object" value="${condition}.updateTime"/>
|
or
|
||||||
</include>
|
</otherwise>
|
||||||
<include refid="queryType">
|
</choose>
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
<include refid="associationAttachmentCondition">
|
||||||
</include>
|
<property name="condition" value="condition"/>
|
||||||
</if>
|
</include>
|
||||||
<!-- 标签 -->
|
</if>
|
||||||
<if test='${condition}.tags != null'>
|
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
|
||||||
<include refid="queryTag">
|
<property name="searchMode" value="${combineSearch}.searchMode"/>
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
</include>
|
||||||
<property name="combineTag" value="${condition}.tags"/>
|
</foreach>
|
||||||
</include>
|
<include refid="io.metersphere.system.mapper.BaseMapper.customFiledConditions">
|
||||||
</if>
|
<property name="mainIdColumn" value="functional_case.id"/>
|
||||||
<if test="${condition}.customs != null and ${condition}.customs.size() > 0">
|
<property name="associationTable" value="functional_case_custom_field"/>
|
||||||
<foreach collection="${condition}.customs" item="custom" separator="" open="" close="">
|
<property name="associationIdColumn" value="case_id"/>
|
||||||
functional_case.id ${custom.operator} (
|
<property name="combineSearch" value="${combineSearch}"/>
|
||||||
select case_id from functional_case_custom_field where field_id = #{custom.id}
|
</include>
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</trim>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<sql id="associationAttachmentCondition">
|
||||||
|
<choose>
|
||||||
|
<when test="${condition}.operator == 'EMPTY'">
|
||||||
|
functional_case.id not in (
|
||||||
|
select file_association.source_id from file_association where file_association.source_type = 'FUNCTIONAL_CASE'
|
||||||
|
)
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
(
|
||||||
|
functional_case.id
|
||||||
|
<if test="${condition}.operator == 'NOT_IN' or ${condition}.operator == 'NOT_EQUALS' or ${condition}.operator == 'NOT_CONTAINS'">
|
||||||
|
not
|
||||||
|
</if>
|
||||||
|
in (
|
||||||
|
select file_association.source_id from file_association join file_metadata on file_association.file_id = file_metadata.id
|
||||||
|
and file_association.source_type = 'FUNCTIONAL_CASE' and
|
||||||
<choose>
|
<choose>
|
||||||
<when test="custom.type == 'List'">
|
<when test="${condition}.operator == 'NOT_IN' or ${condition}.operator == 'NOT_EQUALS' or ${condition}.operator == 'NOT_CONTAINS'">
|
||||||
and JSON_CONTAINS(`value`, json_array(#{custom.value}))
|
<include refid="io.metersphere.system.mapper.BaseMapper.associationReversalCondition">
|
||||||
</when>
|
<property name="condition" value="${condition}"/>
|
||||||
<when test="custom.type == 'date' or custom.type == 'datetime'">
|
<property name="column" value="file_metadata.original_name"/>
|
||||||
and `value`
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="object" value="custom"/>
|
|
||||||
</include>
|
</include>
|
||||||
</when>
|
</when>
|
||||||
<otherwise>
|
<otherwise>
|
||||||
and trim(both '"' from `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="file_metadata.original_name"/>
|
||||||
</include>
|
</include>
|
||||||
</otherwise>
|
</otherwise>
|
||||||
</choose>
|
</choose>
|
||||||
)
|
)
|
||||||
<include refid="queryType">
|
)
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
</otherwise>
|
||||||
</include>
|
</choose>
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="queryVersionCondition">
|
<sql id="queryVersionCondition">
|
||||||
|
|
Loading…
Reference in New Issue