fix(测试计划): 计划详情跨项目模块筛选问题
This commit is contained in:
parent
f713d8cf78
commit
be6fe24b60
|
@ -604,10 +604,17 @@
|
||||||
</include>
|
</include>
|
||||||
</foreach>
|
</foreach>
|
||||||
<foreach collection="${combineSearch}.systemFieldConditions" item="condition">
|
<foreach collection="${combineSearch}.systemFieldConditions" item="condition">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.commonSystemFieldConditions">
|
<include refid="io.metersphere.system.mapper.BaseMapper.baseSystemFieldConditions">
|
||||||
<property name="condition" value="condition"/>
|
<property name="condition" value="condition"/>
|
||||||
<property name="tablePrefix" value="atc"/>
|
<property name="tablePrefix" value="atc"/>
|
||||||
</include>
|
</include>
|
||||||
|
<!-- 模块ID -->
|
||||||
|
<if test="condition.name == 'moduleId'">
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="a.module_id"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
<!-- 协议 -->
|
<!-- 协议 -->
|
||||||
<if test="condition.name == 'protocol'">
|
<if test="condition.name == 'protocol'">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
|
|
@ -3,6 +3,16 @@
|
||||||
<mapper namespace="io.metersphere.system.mapper.BaseMapper">
|
<mapper namespace="io.metersphere.system.mapper.BaseMapper">
|
||||||
|
|
||||||
<sql id="commonSystemFieldConditions">
|
<sql id="commonSystemFieldConditions">
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.baseSystemFieldConditions" />
|
||||||
|
<if test="condition.name == 'moduleId'">
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="${tablePrefix}.module_id"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<sql id="baseSystemFieldConditions">
|
||||||
<if test="condition.name == 'name'">
|
<if test="condition.name == 'name'">
|
||||||
<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"/>
|
||||||
|
@ -15,12 +25,6 @@
|
||||||
<property name="column" value="${tablePrefix}.num"/>
|
<property name="column" value="${tablePrefix}.num"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
<if test="condition.name == 'moduleId'">
|
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
|
||||||
<property name="condition" value="condition"/>
|
|
||||||
<property name="column" value="${tablePrefix}.module_id"/>
|
|
||||||
</include>
|
|
||||||
</if>
|
|
||||||
<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"/>
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
project_version.name as version_name
|
project_version.name as version_name
|
||||||
from api_definition a left join project_version on project_version.id = a.version_id
|
from api_definition a left join project_version on project_version.id = a.version_id
|
||||||
where a.deleted = false
|
where a.deleted = false
|
||||||
<include refid="queryWhereCondition"/>
|
<include refid="queryWhereApiDefinitionCondition"/>
|
||||||
and exists (
|
and exists (
|
||||||
select id
|
select id
|
||||||
from api_test_case atc
|
from api_test_case atc
|
||||||
|
@ -107,7 +107,7 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<sql id="queryWhereCondition">
|
<sql id="queryWhereApiDefinitionCondition">
|
||||||
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
||||||
and a.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=")">
|
||||||
|
@ -135,8 +135,10 @@
|
||||||
<property name="filter" value="request.filter"/>
|
<property name="filter" value="request.filter"/>
|
||||||
</include>
|
</include>
|
||||||
|
|
||||||
<include refid="combine">
|
<include refid="queryApiDefinitionCombine">
|
||||||
<property name="combineSearch" value="request.combineSearch"/>
|
<property name="combineSearch" value="request.combineSearch"/>
|
||||||
|
<property name="projectId" value="${request.projectId}"/>
|
||||||
|
<property name="deleted" value="${request.deleted}"/>
|
||||||
</include>
|
</include>
|
||||||
|
|
||||||
<include refid="queryVersionCondition">
|
<include refid="queryVersionCondition">
|
||||||
|
@ -383,6 +385,106 @@
|
||||||
</if>
|
</if>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
<sql id="queryApiDefinitionCombine">
|
||||||
|
<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="a.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="a"/>
|
||||||
|
</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 == 'status'">
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="a.status"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
<if test="condition.name == 'method'">
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="a.method"/>
|
||||||
|
</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 == 'caseTotal'">
|
||||||
|
<choose>
|
||||||
|
<when test="condition.operator == 'NOT_EMPTY'">
|
||||||
|
a.id in (
|
||||||
|
select api_definition_id from api_test_case where deleted = ${deleted}
|
||||||
|
and project_id = '${projectId}'
|
||||||
|
)
|
||||||
|
</when>
|
||||||
|
<when test="condition.operator == 'EMPTY'">
|
||||||
|
a.id not in (
|
||||||
|
select api_definition_id from api_test_case where deleted = ${deleted}
|
||||||
|
and project_id = '${projectId}'
|
||||||
|
)
|
||||||
|
</when>
|
||||||
|
<when test="(condition.operator == 'LT' and condition.value < 1) or (condition.operator == 'EQUALS' and condition.value < 0)">
|
||||||
|
1=2
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
<if test="condition.operator == 'LT' or (condition.operator == 'EQUALS' and condition.value == 0)">
|
||||||
|
a.id not in (
|
||||||
|
select api_definition_id from api_test_case where deleted = ${deleted}
|
||||||
|
and project_id = '${projectId}'
|
||||||
|
)
|
||||||
|
<if test="condition.value > 1">
|
||||||
|
OR
|
||||||
|
</if>
|
||||||
|
</if>
|
||||||
|
<if test="(condition.operator == 'EQUALS' and condition.value > 0) or (condition.operator == 'LT' and condition.value > 1) or condition.operator == 'GT'">
|
||||||
|
a.id in (
|
||||||
|
select api_definition_id from api_test_case where deleted = ${deleted}
|
||||||
|
and project_id = '${projectId}'
|
||||||
|
group by api_definition_id having
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="count(id)"/>
|
||||||
|
</include>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
|
||||||
|
<property name="searchMode" value="${combineSearch}.searchMode"/>
|
||||||
|
</include>
|
||||||
|
</foreach>
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.customFiledConditions">
|
||||||
|
<property name="mainIdColumn" value="a.id"/>
|
||||||
|
<property name="associationTable" value="api_definition_custom_field"/>
|
||||||
|
<property name="associationIdColumn" value="api_id"/>
|
||||||
|
<property name="combineSearch" value="${combineSearch}"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</trim>
|
||||||
|
</sql>
|
||||||
|
|
||||||
<sql id="combine">
|
<sql id="combine">
|
||||||
<trim prefix="AND">
|
<trim prefix="AND">
|
||||||
<trim prefix="(" suffix=")" suffixOverrides="AND|OR">
|
<trim prefix="(" suffix=")" suffixOverrides="AND|OR">
|
||||||
|
@ -399,10 +501,27 @@
|
||||||
</include>
|
</include>
|
||||||
</foreach>
|
</foreach>
|
||||||
<foreach collection="${combineSearch}.systemFieldConditions" item="condition">
|
<foreach collection="${combineSearch}.systemFieldConditions" item="condition">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.commonSystemFieldConditions">
|
<include refid="io.metersphere.system.mapper.BaseMapper.baseSystemFieldConditions">
|
||||||
<property name="condition" value="condition"/>
|
<property name="condition" value="condition"/>
|
||||||
<property name="tablePrefix" value="atc"/>
|
<property name="tablePrefix" value="atc"/>
|
||||||
</include>
|
</include>
|
||||||
|
<!-- 所属模块(项目ID_模块ID 组合查询) -->
|
||||||
|
<if test="condition.name == 'moduleId'">
|
||||||
|
<choose>
|
||||||
|
<when test="condition.operator == 'IN'">
|
||||||
|
concat(a.project_id, '_', a.module_id) in
|
||||||
|
<foreach collection="condition.value" item="v" separator="," open="(" close=")">
|
||||||
|
#{v}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
<when test="condition.operator == 'NOT_IN'">
|
||||||
|
concat(a.project_id, '_', a.module_id) not in
|
||||||
|
<foreach collection="condition.value" item="v" separator="," open="(" close=")">
|
||||||
|
#{v}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
<!-- 测试点 -->
|
<!-- 测试点 -->
|
||||||
<if test="condition.name == 'testPlanCollectionId'">
|
<if test="condition.name == 'testPlanCollectionId'">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
@ -450,16 +569,16 @@
|
||||||
<choose>
|
<choose>
|
||||||
<when test="condition.operator == 'NOT_EMPTY'">
|
<when test="condition.operator == 'NOT_EMPTY'">
|
||||||
atc.id in (
|
atc.id in (
|
||||||
select atcr.api_test_case_id as id
|
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
|
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
|
group by atcr.api_test_case_id
|
||||||
)
|
)
|
||||||
</when>
|
</when>
|
||||||
<when test="condition.operator == 'EMPTY'">
|
<when test="condition.operator == 'EMPTY'">
|
||||||
atc.id not in (
|
atc.id not in (
|
||||||
select atcr.api_test_case_id as id
|
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
|
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
|
group by atcr.api_test_case_id
|
||||||
)
|
)
|
||||||
</when>
|
</when>
|
||||||
<when test="(condition.operator == 'LT' and condition.value == 0) or (condition.operator == 'GT' and condition.value > 100 )">
|
<when test="(condition.operator == 'LT' and condition.value == 0) or (condition.operator == 'GT' and condition.value > 100 )">
|
||||||
|
@ -467,15 +586,15 @@
|
||||||
</when>
|
</when>
|
||||||
<otherwise>
|
<otherwise>
|
||||||
atc.id in (
|
atc.id in (
|
||||||
select rate_tmp.id from (
|
select rate_tmp.id from (
|
||||||
select atcr.api_test_case_id as id, format(sum(if(ar.`status` = 'success', 1, 0)) / count(ar.id) * 100, 2) as passRate
|
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
|
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
|
group by atcr.api_test_case_id having
|
||||||
<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="passRate"/>
|
<property name="column" value="passRate"/>
|
||||||
</include>
|
</include>
|
||||||
) rate_tmp
|
) rate_tmp
|
||||||
)
|
)
|
||||||
</otherwise>
|
</otherwise>
|
||||||
</choose>
|
</choose>
|
||||||
|
@ -506,14 +625,14 @@
|
||||||
<choose>
|
<choose>
|
||||||
<when test="condition.operator == 'NOT_EMPTY'">
|
<when test="condition.operator == 'NOT_EMPTY'">
|
||||||
t.id in (
|
t.id in (
|
||||||
select distinct brc.test_plan_case_id from bug_relation_case brc join bug b on brc.bug_id = b.id
|
select distinct brc.test_plan_case_id from bug_relation_case brc join bug b on brc.bug_id = b.id
|
||||||
where b.deleted = false and brc.test_plan_id = '${planId}' and brc.case_type = 'API'
|
where b.deleted = false and brc.test_plan_id = '${planId}' and brc.case_type = 'API'
|
||||||
)
|
)
|
||||||
</when>
|
</when>
|
||||||
<when test="condition.operator == 'EMPTY'">
|
<when test="condition.operator == 'EMPTY'">
|
||||||
t.id not in (
|
t.id not in (
|
||||||
select distinct brc.test_plan_case_id from bug_relation_case brc join bug b on brc.bug_id = b.id
|
select distinct brc.test_plan_case_id from bug_relation_case brc join bug b on brc.bug_id = b.id
|
||||||
where b.deleted = false and brc.test_plan_id = '${planId}' and brc.case_type = 'API'
|
where b.deleted = false and brc.test_plan_id = '${planId}' and brc.case_type = 'API'
|
||||||
)
|
)
|
||||||
</when>
|
</when>
|
||||||
<when test="(condition.operator == 'LT' and condition.value < 1) or (condition.operator == 'EQUALS' and condition.value < 0)">
|
<when test="(condition.operator == 'LT' and condition.value < 1) or (condition.operator == 'EQUALS' and condition.value < 0)">
|
||||||
|
@ -522,8 +641,8 @@
|
||||||
<otherwise>
|
<otherwise>
|
||||||
<if test="condition.operator == 'LT' or (condition.operator == 'EQUALS' and condition.value == 0)">
|
<if test="condition.operator == 'LT' or (condition.operator == 'EQUALS' and condition.value == 0)">
|
||||||
t.id not in (
|
t.id not in (
|
||||||
select distinct brc.test_plan_case_id from bug_relation_case brc join bug b on brc.bug_id = b.id
|
select distinct brc.test_plan_case_id from bug_relation_case brc join bug b on brc.bug_id = b.id
|
||||||
where b.deleted = false and brc.test_plan_id = '${planId}' and brc.case_type = 'API'
|
where b.deleted = false and brc.test_plan_id = '${planId}' and brc.case_type = 'API'
|
||||||
)
|
)
|
||||||
<if test="condition.value > 1">
|
<if test="condition.value > 1">
|
||||||
OR
|
OR
|
||||||
|
@ -531,12 +650,12 @@
|
||||||
</if>
|
</if>
|
||||||
<if test="(condition.operator == 'EQUALS' and condition.value > 0) or (condition.operator == 'LT' and condition.value > 1) or condition.operator == 'GT'">
|
<if test="(condition.operator == 'EQUALS' and condition.value > 0) or (condition.operator == 'LT' and condition.value > 1) or condition.operator == 'GT'">
|
||||||
t.id in (
|
t.id in (
|
||||||
select brc.test_plan_case_id from bug_relation_case brc join bug b on brc.bug_id = b.id
|
select brc.test_plan_case_id from bug_relation_case brc join bug b on brc.bug_id = b.id
|
||||||
where b.deleted = false and brc.test_plan_id = '${planId}' and brc.case_type = 'API' group by brc.test_plan_case_id having
|
where b.deleted = false and brc.test_plan_id = '${planId}' and brc.case_type = 'API' group by brc.test_plan_case_id having
|
||||||
<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="count(brc.id)"/>
|
<property name="column" value="count(brc.id)"/>
|
||||||
</include>
|
</include>
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</otherwise>
|
</otherwise>
|
||||||
|
@ -561,8 +680,7 @@
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="countModuleIdByRequest" resultType="io.metersphere.functional.dto.FunctionalCaseModuleCountDTO">
|
<select id="countModuleIdByRequest" resultType="io.metersphere.functional.dto.FunctionalCaseModuleCountDTO">
|
||||||
SELECT CASE WHEN a.module_id = 'root' THEN CONCAT(atc.project_id, '_', a.module_id) ELSE a.module_id END AS
|
SELECT concat(atc.project_id, '_', a.module_id) as moduleId,
|
||||||
moduleId,
|
|
||||||
count(atc.id) AS dataCount, atc.project_id AS projectId, project.name AS projectName
|
count(atc.id) AS dataCount, atc.project_id AS projectId, project.name AS projectName
|
||||||
FROM test_plan_api_case t
|
FROM test_plan_api_case t
|
||||||
INNER JOIN api_test_case atc ON t.api_case_id = atc.id
|
INNER JOIN api_test_case atc ON t.api_case_id = atc.id
|
||||||
|
|
|
@ -265,10 +265,27 @@
|
||||||
</include>
|
</include>
|
||||||
</foreach>
|
</foreach>
|
||||||
<foreach collection="${combineSearch}.systemFieldConditions" item="condition">
|
<foreach collection="${combineSearch}.systemFieldConditions" item="condition">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.commonSystemFieldConditions">
|
<include refid="io.metersphere.system.mapper.BaseMapper.baseSystemFieldConditions">
|
||||||
<property name="condition" value="condition"/>
|
<property name="condition" value="condition"/>
|
||||||
<property name="tablePrefix" value="api_scenario"/>
|
<property name="tablePrefix" value="api_scenario"/>
|
||||||
</include>
|
</include>
|
||||||
|
<!-- 所属模块(项目ID_模块ID 组合查询) -->
|
||||||
|
<if test="condition.name == 'moduleId'">
|
||||||
|
<choose>
|
||||||
|
<when test="condition.operator == 'IN'">
|
||||||
|
concat(api_scenario.project_id, '_', api_scenario.module_id) in
|
||||||
|
<foreach collection="condition.value" item="v" separator="," open="(" close=")">
|
||||||
|
#{v}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
<when test="condition.operator == 'NOT_IN'">
|
||||||
|
concat(api_scenario.project_id, '_', api_scenario.module_id) not in
|
||||||
|
<foreach collection="condition.value" item="v" separator="," open="(" close=")">
|
||||||
|
#{v}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
<!-- 测试点 -->
|
<!-- 测试点 -->
|
||||||
<if test="condition.name == 'testPlanCollectionId'">
|
<if test="condition.name == 'testPlanCollectionId'">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
@ -409,8 +426,7 @@
|
||||||
|
|
||||||
|
|
||||||
<select id="countModuleIdByRequest" resultType="io.metersphere.functional.dto.FunctionalCaseModuleCountDTO">
|
<select id="countModuleIdByRequest" resultType="io.metersphere.functional.dto.FunctionalCaseModuleCountDTO">
|
||||||
SELECT CASE WHEN api_scenario.module_id = 'root' THEN CONCAT(api_scenario.project_id, '_',
|
SELECT concat(api_scenario.project_id, '_', api_scenario.module_id) as moduleId,
|
||||||
api_scenario.module_id) ELSE api_scenario.module_id END AS moduleId,
|
|
||||||
count(api_scenario.id) AS dataCount, api_scenario.project_id AS projectId, project.name AS projectName
|
count(api_scenario.id) AS dataCount, api_scenario.project_id AS projectId, project.name AS projectName
|
||||||
FROM test_plan_api_scenario
|
FROM test_plan_api_scenario
|
||||||
INNER JOIN api_scenario on api_scenario.id = test_plan_api_scenario.api_scenario_id
|
INNER JOIN api_scenario on api_scenario.id = test_plan_api_scenario.api_scenario_id
|
||||||
|
|
|
@ -310,10 +310,27 @@
|
||||||
</include>
|
</include>
|
||||||
</foreach>
|
</foreach>
|
||||||
<foreach collection="${combineSearch}.systemFieldConditions" item="condition">
|
<foreach collection="${combineSearch}.systemFieldConditions" item="condition">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.commonSystemFieldConditions">
|
<include refid="io.metersphere.system.mapper.BaseMapper.baseSystemFieldConditions">
|
||||||
<property name="condition" value="condition"/>
|
<property name="condition" value="condition"/>
|
||||||
<property name="tablePrefix" value="functional_case"/>
|
<property name="tablePrefix" value="functional_case"/>
|
||||||
</include>
|
</include>
|
||||||
|
<!-- 所属模块(项目ID_模块ID 组合查询) -->
|
||||||
|
<if test="condition.name == 'moduleId'">
|
||||||
|
<choose>
|
||||||
|
<when test="condition.operator == 'IN'">
|
||||||
|
concat(functional_case.project_id, '_', functional_case.module_id) in
|
||||||
|
<foreach collection="condition.value" item="v" separator="," open="(" close=")">
|
||||||
|
#{v}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
<when test="condition.operator == 'NOT_IN'">
|
||||||
|
concat(functional_case.project_id, '_', functional_case.module_id) not in
|
||||||
|
<foreach collection="condition.value" item="v" separator="," open="(" close=")">
|
||||||
|
#{v}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
<!-- 测试点 -->
|
<!-- 测试点 -->
|
||||||
<if test="condition.name == 'testPlanCollectionId'">
|
<if test="condition.name == 'testPlanCollectionId'">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
@ -552,8 +569,7 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="countModuleIdByRequest" resultType="io.metersphere.functional.dto.FunctionalCaseModuleCountDTO">
|
<select id="countModuleIdByRequest" resultType="io.metersphere.functional.dto.FunctionalCaseModuleCountDTO">
|
||||||
SELECT CASE WHEN functional_case.module_id = 'root' THEN concat(functional_case.project_id, '_',
|
SELECT concat(functional_case.project_id, '_', functional_case.module_id) AS moduleId,
|
||||||
functional_case.module_id) ElSE functional_case.module_id END AS moduleId,
|
|
||||||
count(functional_case.id) As dataCount, functional_case.project_id As projectId, project.name As projectName
|
count(functional_case.id) As dataCount, functional_case.project_id As projectId, project.name As projectName
|
||||||
FROM test_plan_functional_case
|
FROM test_plan_functional_case
|
||||||
LEFT JOIN functional_case ON test_plan_functional_case.functional_case_id = functional_case.id
|
LEFT JOIN functional_case ON test_plan_functional_case.functional_case_id = functional_case.id
|
||||||
|
|
|
@ -513,10 +513,7 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
|
||||||
}
|
}
|
||||||
List<BaseTreeNode> baseTreeNodes = apiDefinitionModuleService.buildTreeAndCountResource(nodeByNodeIds, needCreateRoot, Translator.get("api_unplanned_request"));
|
List<BaseTreeNode> baseTreeNodes = apiDefinitionModuleService.buildTreeAndCountResource(nodeByNodeIds, needCreateRoot, Translator.get("api_unplanned_request"));
|
||||||
for (BaseTreeNode baseTreeNode : baseTreeNodes) {
|
for (BaseTreeNode baseTreeNode : baseTreeNodes) {
|
||||||
if (StringUtils.equals(baseTreeNode.getId(), ModuleConstants.DEFAULT_NODE_ID)) {
|
baseTreeNode.setId(projectId + "_" + baseTreeNode.getId());
|
||||||
// 默认拼项目id
|
|
||||||
baseTreeNode.setId(projectId + "_" + ModuleConstants.DEFAULT_NODE_ID);
|
|
||||||
}
|
|
||||||
projectNode.addChild(baseTreeNode);
|
projectNode.addChild(baseTreeNode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -67,7 +67,6 @@ import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@ -671,10 +670,7 @@ public class TestPlanApiScenarioService extends TestPlanResourceService {
|
||||||
}
|
}
|
||||||
List<BaseTreeNode> baseTreeNodes = apiScenarioModuleService.buildTreeAndCountResource(nodeByNodeIds, needCreateRoot, Translator.get("api_unplanned_scenario"));
|
List<BaseTreeNode> baseTreeNodes = apiScenarioModuleService.buildTreeAndCountResource(nodeByNodeIds, needCreateRoot, Translator.get("api_unplanned_scenario"));
|
||||||
for (BaseTreeNode baseTreeNode : baseTreeNodes) {
|
for (BaseTreeNode baseTreeNode : baseTreeNodes) {
|
||||||
if (StringUtils.equals(baseTreeNode.getId(), ModuleConstants.DEFAULT_NODE_ID)) {
|
baseTreeNode.setId(projectId + "_" + baseTreeNode.getId());
|
||||||
// 默认拼项目id
|
|
||||||
baseTreeNode.setId(projectId + "_" + ModuleConstants.DEFAULT_NODE_ID);
|
|
||||||
}
|
|
||||||
projectNode.addChild(baseTreeNode);
|
projectNode.addChild(baseTreeNode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -358,10 +358,8 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||||
}
|
}
|
||||||
List<BaseTreeNode> baseTreeNodes = functionalCaseModuleService.buildTreeAndCountResource(nodeByNodeIds, needCreatRoot, Translator.get("functional_case.module.default.name"));
|
List<BaseTreeNode> baseTreeNodes = functionalCaseModuleService.buildTreeAndCountResource(nodeByNodeIds, needCreatRoot, Translator.get("functional_case.module.default.name"));
|
||||||
for (BaseTreeNode baseTreeNode : baseTreeNodes) {
|
for (BaseTreeNode baseTreeNode : baseTreeNodes) {
|
||||||
if (StringUtils.equals(baseTreeNode.getId(), ModuleConstants.DEFAULT_NODE_ID)) {
|
// 节点ID, 拼接项目ID
|
||||||
// 默认拼项目id
|
baseTreeNode.setId(projectId + "_" + baseTreeNode.getId());
|
||||||
baseTreeNode.setId(projectId + "_" + ModuleConstants.DEFAULT_NODE_ID);
|
|
||||||
}
|
|
||||||
projectNode.addChild(baseTreeNode);
|
projectNode.addChild(baseTreeNode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue