fix(测试计划): 关联用例列表执行人支持过滤筛选

--bug=1044867 --user=宋昌昌 【测试计划】计划详情-功能用例/接口用例/场景用例列表-执行人不支持筛选 https://www.tapd.cn/55049933/s/1559945
This commit is contained in:
song-cc-rock 2024-08-08 15:06:42 +08:00 committed by 刘瑞斌
parent 336a3ee47c
commit 4e1d8064c7
6 changed files with 216 additions and 112 deletions

View File

@ -3,7 +3,7 @@
<mapper namespace="io.metersphere.plan.mapper.ExtTestPlanApiCaseMapper"> <mapper namespace="io.metersphere.plan.mapper.ExtTestPlanApiCaseMapper">
<resultMap id="ApiDefinitionDTO" type="io.metersphere.api.dto.definition.ApiDefinitionDTO"> <resultMap id="ApiDefinitionDTO" type="io.metersphere.api.dto.definition.ApiDefinitionDTO">
<result column="tags" jdbcType="VARCHAR" property="tags" typeHandler="io.metersphere.handler.ListTypeHandler" /> <result column="tags" jdbcType="VARCHAR" property="tags" typeHandler="io.metersphere.handler.ListTypeHandler"/>
</resultMap> </resultMap>
<update id="updatePos"> <update id="updatePos">
@ -140,7 +140,8 @@
</include> </include>
<choose> <choose>
<when test='request.searchMode == "AND"'> <when test='request.searchMode == "AND"'>
AND <include refid="queryCombine"/> AND
<include refid="queryCombine"/>
</when> </when>
<when test='request.searchMode == "OR"'> <when test='request.searchMode == "OR"'>
and ( and (
@ -180,14 +181,16 @@
</when> </when>
<when test="key.startsWith('custom_single')"> <when test="key.startsWith('custom_single')">
and api_definition.id in ( and api_definition.id in (
select api_id from api_definition_custom_field where concat('custom_single_', field_id) = #{key} select api_id from api_definition_custom_field where concat('custom_single_', field_id) =
#{key}
and trim(both '"' from `value`) in and trim(both '"' from `value`) in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/> <include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
) )
</when> </when>
<when test="key.startsWith('custom_multiple')"> <when test="key.startsWith('custom_multiple')">
and api_definition.id in ( and api_definition.id in (
select api_id from api_definition_custom_field where concat('custom_multiple_', field_id) = #{key} select api_id from api_definition_custom_field where concat('custom_multiple_', field_id) =
#{key}
and JSON_CONTAINS(`value`, json_array(#{value})) and JSON_CONTAINS(`value`, json_array(#{value}))
) )
</when> </when>
@ -403,35 +406,35 @@
<select id="relateApiCaseList" resultType="io.metersphere.plan.dto.response.TestPlanApiCasePageResponse"> <select id="relateApiCaseList" resultType="io.metersphere.plan.dto.response.TestPlanApiCasePageResponse">
SELECT SELECT
t.id, t.id,
t.test_plan_collection_id, t.test_plan_collection_id,
atc.num, atc.num,
atc.name, atc.name,
atc.priority, atc.priority,
atc.project_id, atc.project_id,
atc.api_definition_id, atc.api_definition_id,
atc.create_user, atc.create_user,
t.create_time, t.create_time,
t.environment_id, t.environment_id,
a.module_id, a.module_id,
a.path, a.path,
a.method, a.method,
a.protocol, a.protocol,
t.last_exec_result, t.last_exec_result,
t.execute_user, t.execute_user,
t.last_exec_time, t.last_exec_time,
t.last_exec_report_id, t.last_exec_report_id,
atc.status, atc.status,
atc.id as apiTestCaseId, atc.id as apiTestCaseId,
test_plan_collection.name as testPlanCollectionName test_plan_collection.name as testPlanCollectionName
FROM FROM
api_test_case atc api_test_case atc
INNER JOIN api_definition a ON atc.api_definition_id = a.id INNER JOIN api_definition a ON atc.api_definition_id = a.id
inner join test_plan_api_case t on atc.id = t.api_case_id inner join test_plan_api_case t on atc.id = t.api_case_id
inner join test_plan_collection on test_plan_collection.id = t.test_plan_collection_id inner join test_plan_collection on test_plan_collection.id = t.test_plan_collection_id
WHERE atc.deleted =#{deleted} WHERE atc.deleted =#{deleted}
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.*
@ -444,12 +447,12 @@
<select id="getPlanApiCaseNotDeletedByCollectionIds" resultType="io.metersphere.plan.domain.TestPlanApiCase"> <select id="getPlanApiCaseNotDeletedByCollectionIds" resultType="io.metersphere.plan.domain.TestPlanApiCase">
SELECT t.* SELECT t.*
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
WHERE t.test_plan_collection_id IN WHERE t.test_plan_collection_id IN
<foreach collection="collectionIds" item="collectionId" separator="," open="(" close=")"> <foreach collection="collectionIds" item="collectionId" separator="," open="(" close=")">
#{collectionId} #{collectionId}
</foreach> </foreach>
AND atc.deleted = false AND atc.deleted = false
</select> </select>
@ -545,6 +548,11 @@
(#{value}) (#{value})
</foreach> </foreach>
</when> </when>
<!-- 执行人 -->
<when test="key == 'executeUserName'">
and t.execute_user in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
</choose> </choose>
</if> </if>
</foreach> </foreach>
@ -561,9 +569,10 @@
</if> </if>
</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 moduleId, SELECT CASE WHEN a.module_id = 'root' THEN CONCAT(atc.project_id, '_', a.module_id) ELSE a.module_id END AS
count(atc.id) AS dataCount, atc.project_id AS projectId, project.name AS projectName moduleId,
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
INNER JOIN api_definition a ON atc.api_definition_id = a.id INNER JOIN api_definition a ON atc.api_definition_id = a.id
@ -577,9 +586,13 @@
<select id="selectIdByProjectIdAndTestPlanId" resultType="java.lang.String"> <select id="selectIdByProjectIdAndTestPlanId" resultType="java.lang.String">
SELECT adm.id, adm.project_id SELECT adm.id, adm.project_id
FROM api_definition_module adm FROM api_definition_module adm
WHERE adm.id IN ( WHERE adm.id IN (SELECT ad.module_id
SELECT ad.module_id FROM api_definition ad LEFT JOIN api_test_case atc on atc.api_definition_id = ad.id LEFT JOIN test_plan_api_case tpac ON tpac.api_case_id = atc.id WHERE tpac.test_plan_id = #{testPlanId} AND atc.deleted = false and atc.project_id = #{projectId} FROM api_definition ad
) LEFT JOIN api_test_case atc on atc.api_definition_id = ad.id
LEFT JOIN test_plan_api_case tpac ON tpac.api_case_id = atc.id
WHERE tpac.test_plan_id = #{testPlanId}
AND atc.deleted = false
and atc.project_id = #{projectId})
</select> </select>
<select id="caseCount" <select id="caseCount"
@ -609,11 +622,16 @@
FROM api_definition_module adm FROM api_definition_module adm
LEFT JOIN project p ON adm.project_id = p.id LEFT JOIN project p ON adm.project_id = p.id
WHERE adm.id IN WHERE adm.id IN
(SELECT ad.module_id FROM api_definition ad LEFT JOIN api_test_case atc on atc.api_definition_id = ad.id LEFT JOIN test_plan_api_case tpac ON tpac.api_case_id = atc.id WHERE tpac.test_plan_id = #{testPlanId} AND atc.deleted = false) (SELECT ad.module_id
FROM api_definition ad
LEFT JOIN api_test_case atc on atc.api_definition_id = ad.id
LEFT JOIN test_plan_api_case tpac ON tpac.api_case_id = atc.id
WHERE tpac.test_plan_id = #{testPlanId}
AND atc.deleted = false)
ORDER BY pos ORDER BY pos
</select> </select>
<select id="getIds" resultType="java.lang.String"> <select id="getIds" resultType="java.lang.String">
SELECT SELECT
t.id as id t.id as id
FROM FROM
@ -666,18 +684,18 @@
<select id="collectionCountByRequest" resultType="io.metersphere.project.dto.ModuleCountDTO"> <select id="collectionCountByRequest" resultType="io.metersphere.project.dto.ModuleCountDTO">
SELECT SELECT
t.test_plan_collection_id AS moduleId, t.test_plan_collection_id AS moduleId,
count( t.id ) AS dataCount count( t.id ) AS dataCount
FROM FROM
api_test_case atc api_test_case atc
INNER JOIN test_plan_api_case t ON atc.id = t.api_case_id INNER JOIN test_plan_api_case t ON atc.id = t.api_case_id
INNER JOIN api_definition a on atc.api_definition_id = a.id INNER JOIN api_definition a on atc.api_definition_id = a.id
WHERE WHERE
atc.deleted = FALSE atc.deleted = FALSE
AND t.test_plan_id = #{request.testPlanId} AND t.test_plan_id = #{request.testPlanId}
<include refid="queryApiCaseWhereCondition"/> <include refid="queryApiCaseWhereCondition"/>
GROUP BY GROUP BY
t.test_plan_collection_id t.test_plan_collection_id
</select> </select>
<select id="getMaxPosByCollectionId" resultType="java.lang.Long"> <select id="getMaxPosByCollectionId" resultType="java.lang.Long">

View File

@ -199,6 +199,11 @@
and api_scenario.delete_user in and api_scenario.delete_user in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/> <include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when> </when>
<!-- 执行人 -->
<when test="key == 'executeUserName'">
and test_plan_api_scenario.execute_user in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
<when test="key=='versionId'"> <when test="key=='versionId'">
and api_scenario.version_id in and api_scenario.version_id in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/> <include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
@ -332,9 +337,10 @@
</sql> </sql>
<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, '_', api_scenario.module_id) ELSE api_scenario.module_id END AS moduleId, SELECT CASE WHEN api_scenario.module_id = 'root' THEN CONCAT(api_scenario.project_id, '_',
count(api_scenario.id) AS dataCount, api_scenario.project_id AS projectId, project.name AS projectName 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
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
INNER JOIN project ON api_scenario.project_id = project.id INNER JOIN project ON api_scenario.project_id = project.id
@ -357,24 +363,28 @@
<select id="selectIdByProjectIdAndTestPlanId" resultType="java.lang.String"> <select id="selectIdByProjectIdAndTestPlanId" resultType="java.lang.String">
SELECT asm.id, asm.project_id SELECT asm.id, asm.project_id
FROM api_scenario_module asm FROM api_scenario_module asm
WHERE asm.id IN ( WHERE asm.id IN (SELECT api_scenario.module_id
SELECT api_scenario.module_id FROM api_scenario LEFT JOIN test_plan_api_scenario on api_scenario.id = test_plan_api_scenario.api_scenario_id WHERE test_plan_api_scenario.test_plan_id = #{testPlanId} AND api_scenario.deleted = false and api_scenario.project_id = #{projectId} FROM api_scenario
) LEFT JOIN test_plan_api_scenario
on api_scenario.id = test_plan_api_scenario.api_scenario_id
WHERE test_plan_api_scenario.test_plan_id = #{testPlanId}
AND api_scenario.deleted = false
and api_scenario.project_id = #{projectId})
</select> </select>
<select id="collectionCountByRequest" resultType="io.metersphere.project.dto.ModuleCountDTO"> <select id="collectionCountByRequest" resultType="io.metersphere.project.dto.ModuleCountDTO">
SELECT SELECT
test_plan_api_scenario.test_plan_collection_id AS moduleId, test_plan_api_scenario.test_plan_collection_id AS moduleId,
count( test_plan_api_scenario.id ) AS dataCount count( test_plan_api_scenario.id ) AS dataCount
FROM FROM
api_scenario api_scenario
INNER JOIN test_plan_api_scenario on api_scenario.id = test_plan_api_scenario.api_scenario_id INNER JOIN test_plan_api_scenario on api_scenario.id = test_plan_api_scenario.api_scenario_id
WHERE WHERE
api_scenario.deleted = FALSE api_scenario.deleted = FALSE
AND test_plan_api_scenario.test_plan_id = #{request.testPlanId} AND test_plan_api_scenario.test_plan_id = #{request.testPlanId}
<include refid="queryApiScenarioWhereCondition"/> <include refid="queryApiScenarioWhereCondition"/>
GROUP BY GROUP BY
test_plan_api_scenario.test_plan_collection_id test_plan_api_scenario.test_plan_collection_id
</select> </select>
<select id="selectRootIdByTestPlanId" resultType="io.metersphere.functional.dto.ProjectOptionDTO"> <select id="selectRootIdByTestPlanId" resultType="io.metersphere.functional.dto.ProjectOptionDTO">
@ -392,7 +402,11 @@
FROM api_scenario_module asm FROM api_scenario_module asm
LEFT JOIN project p ON asm.project_id = p.id LEFT JOIN project p ON asm.project_id = p.id
WHERE asm.id IN WHERE asm.id IN
(SELECT api_scenario.module_id FROM api_scenario LEFT JOIN test_plan_api_scenario ON api_scenario.id = test_plan_api_scenario.api_scenario_id WHERE test_plan_api_scenario.test_plan_id = #{testPlanId} AND api_scenario.deleted = false) (SELECT api_scenario.module_id
FROM api_scenario
LEFT JOIN test_plan_api_scenario ON api_scenario.id = test_plan_api_scenario.api_scenario_id
WHERE test_plan_api_scenario.test_plan_id = #{testPlanId}
AND api_scenario.deleted = false)
ORDER BY pos ORDER BY pos
</select> </select>
@ -419,7 +433,7 @@
</foreach> </foreach>
</select> </select>
<select id="getIds" resultType="java.lang.String"> <select id="getIds" resultType="java.lang.String">
SELECT SELECT
test_plan_api_scenario.id as id test_plan_api_scenario.id as id
FROM FROM
@ -442,8 +456,10 @@
<include refid="queryWhereConditionByBatchQueryRequest"/> <include refid="queryWhereConditionByBatchQueryRequest"/>
</select> </select>
<select id="getIdsByReportIdAndCollectionId" resultType="java.lang.String"> <select id="getIdsByReportIdAndCollectionId" resultType="java.lang.String">
select id from test_plan_report_api_scenario select id
where test_plan_report_id = #{testPlanReportId} and test_plan_collection_id = #{collectionId} from test_plan_report_api_scenario
where test_plan_report_id = #{testPlanReportId}
and test_plan_collection_id = #{collectionId}
order by pos desc order by pos desc
</select> </select>
<sql id="queryWhereConditionByBatchQueryRequest"> <sql id="queryWhereConditionByBatchQueryRequest">
@ -475,15 +491,16 @@
</if> </if>
</sql> </sql>
<select id="getPlanScenarioCaseNotDeletedByCollectionIds" resultType="io.metersphere.plan.domain.TestPlanApiScenario"> <select id="getPlanScenarioCaseNotDeletedByCollectionIds"
resultType="io.metersphere.plan.domain.TestPlanApiScenario">
SELECT t.* SELECT t.*
FROM test_plan_api_scenario t FROM test_plan_api_scenario t
INNER JOIN api_scenario a ON t.api_scenario_id = a.id INNER JOIN api_scenario a ON t.api_scenario_id = a.id
WHERE t.test_plan_collection_id IN WHERE t.test_plan_collection_id IN
<foreach collection="collectionIds" item="collectionId" separator="," open="(" close=")"> <foreach collection="collectionIds" item="collectionId" separator="," open="(" close=")">
#{collectionId} #{collectionId}
</foreach> </foreach>
AND a.deleted = false AND a.deleted = false
</select> </select>
<select id="selectDistinctExecResult" resultType="io.metersphere.plan.dto.TestPlanResourceExecResultDTO"> <select id="selectDistinctExecResult" resultType="io.metersphere.plan.dto.TestPlanResourceExecResultDTO">
select distinct resource.test_plan_id AS testPlanId, select distinct resource.test_plan_id AS testPlanId,

View File

@ -53,7 +53,7 @@
</if> </if>
</select> </select>
<select id="getIds" resultType="java.lang.String"> <select id="getIds" resultType="java.lang.String">
SELECT SELECT
test_plan_functional_case.id as id test_plan_functional_case.id as id
FROM FROM
@ -91,34 +91,34 @@
<select id="getCasePage" resultType="io.metersphere.plan.dto.response.TestPlanCasePageResponse"> <select id="getCasePage" resultType="io.metersphere.plan.dto.response.TestPlanCasePageResponse">
SELECT SELECT
functional_case.id as caseId, functional_case.id as caseId,
functional_case.num, functional_case.num,
functional_case.NAME, functional_case.NAME,
functional_case.module_id as moduleId, functional_case.module_id as moduleId,
functional_case.version_id as versionId, functional_case.version_id as versionId,
project_version.name as versionName, project_version.name as versionName,
functional_case.case_edit_type as caseEditType, functional_case.case_edit_type as caseEditType,
functional_case.create_user as createUser, functional_case.create_user as createUser,
functional_case.create_time as createTime, functional_case.create_time as createTime,
functional_case.update_user as updateUser, functional_case.update_user as updateUser,
functional_case.update_time as updateTime, functional_case.update_time as updateTime,
functional_case.review_status as reviewStatus, functional_case.review_status as reviewStatus,
functional_case.last_execute_result as lastExecuteResult, functional_case.last_execute_result as lastExecuteResult,
functional_case.tags, functional_case.tags,
test_plan_functional_case.execute_user as executeUser, test_plan_functional_case.execute_user as executeUser,
test_plan_functional_case.last_exec_time as lastExecTime, test_plan_functional_case.last_exec_time as lastExecTime,
test_plan_functional_case.last_exec_result as lastExecResult, test_plan_functional_case.last_exec_result as lastExecResult,
test_plan_functional_case.test_plan_id as testPlanId, test_plan_functional_case.test_plan_id as testPlanId,
test_plan_functional_case.id, test_plan_functional_case.id,
project.name as projectName, project.name as projectName,
project.id as projectId, project.id as projectId,
test_plan_functional_case.test_plan_collection_id as testPlanCollectionId, test_plan_functional_case.test_plan_collection_id as testPlanCollectionId,
test_plan_collection.name as testPlanCollectionName test_plan_collection.name as testPlanCollectionName
FROM FROM
functional_case functional_case
inner join project on functional_case.project_id = project.id inner join project on functional_case.project_id = project.id
inner join test_plan_functional_case on functional_case.id = test_plan_functional_case.functional_case_id inner join test_plan_functional_case on functional_case.id = test_plan_functional_case.functional_case_id
inner JOIN project_version ON functional_case.version_id = project_version.id inner JOIN project_version ON functional_case.version_id = project_version.id
inner join test_plan_collection on test_plan_collection.id = test_plan_functional_case.test_plan_collection_id inner join test_plan_collection on test_plan_collection.id = test_plan_functional_case.test_plan_collection_id
where functional_case.deleted = #{deleted} where functional_case.deleted = #{deleted}
and test_plan_functional_case.test_plan_id = #{request.testPlanId} and test_plan_functional_case.test_plan_id = #{request.testPlanId}
@ -163,7 +163,8 @@
</include> </include>
<choose> <choose>
<when test='request.searchMode == "AND"'> <when test='request.searchMode == "AND"'>
AND <include refid="queryCombine"/> AND
<include refid="queryCombine"/>
</when> </when>
<when test='request.searchMode == "OR"'> <when test='request.searchMode == "OR"'>
and ( and (
@ -198,7 +199,8 @@
</include> </include>
<choose> <choose>
<when test='request.condition.searchMode == "AND"'> <when test='request.condition.searchMode == "AND"'>
AND <include refid="batchQueryCombine"/> AND
<include refid="batchQueryCombine"/>
</when> </when>
<when test='request.condition.searchMode == "OR"'> <when test='request.condition.searchMode == "OR"'>
and ( and (
@ -240,7 +242,8 @@
<!-- 自定义多选 --> <!-- 自定义多选 -->
<when test="key.startsWith('custom_multiple')"> <when test="key.startsWith('custom_multiple')">
and functional_case.id in ( and functional_case.id in (
select field_id from functional_case_custom_field where concat('custom_multiple-',field_id) = select field_id from functional_case_custom_field where concat('custom_multiple-',field_id)
=
#{key} #{key}
and JSON_CONTAINS(`value`, json_array(#{value})) and JSON_CONTAINS(`value`, json_array(#{value}))
</when> </when>
@ -266,6 +269,10 @@
and functional_case.delete_user in and functional_case.delete_user in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/> <include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when> </when>
<when test="key == 'executeUserName'">
and test_plan_functional_case.execute_user in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
</choose> </choose>
</if> </if>
</foreach> </foreach>
@ -470,13 +477,18 @@
FROM functional_case_module fcm FROM functional_case_module fcm
LEFT JOIN project p ON fcm.project_id = p.id LEFT JOIN project p ON fcm.project_id = p.id
WHERE fcm.id IN WHERE fcm.id IN
(SELECT fc.module_id FROM functional_case fc LEFT JOIN test_plan_functional_case tpfc ON tpfc.functional_case_id = fc.id WHERE tpfc.test_plan_id = #{testPlanId} AND fc.deleted = false) (SELECT fc.module_id
FROM functional_case fc
LEFT JOIN test_plan_functional_case tpfc ON tpfc.functional_case_id = fc.id
WHERE tpfc.test_plan_id = #{testPlanId}
AND fc.deleted = false)
ORDER BY pos ORDER BY pos
</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, '_', functional_case.module_id) ElSE functional_case.module_id END AS moduleId, SELECT CASE WHEN functional_case.module_id = 'root' THEN concat(functional_case.project_id, '_',
count(functional_case.id) As dataCount, functional_case.project_id As projectId, project.name As projectName 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
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
LEFT JOIN project ON functional_case.project_id = project.id LEFT JOIN project ON functional_case.project_id = project.id
@ -489,14 +501,16 @@
<select id="caseCount" <select id="caseCount"
resultType="java.lang.Long"> resultType="java.lang.Long">
SELECT count(functional_case.id) SELECT count(functional_case.id)
FROM test_plan_functional_case LEFT JOIN functional_case ON test_plan_functional_case.functional_case_id = functional_case.id FROM test_plan_functional_case LEFT JOIN functional_case ON test_plan_functional_case.functional_case_id =
functional_case.id
WHERE test_plan_functional_case.test_plan_id = #{request.testPlanId} WHERE test_plan_functional_case.test_plan_id = #{request.testPlanId}
AND functional_case.deleted = #{deleted} AND functional_case.deleted = #{deleted}
<include refid="queryWhereCondition"/> <include refid="queryWhereCondition"/>
</select> </select>
<select id="getPlanFunctionalCaseByIds" resultType="io.metersphere.plan.domain.TestPlanFunctionalCase"> <select id="getPlanFunctionalCaseByIds" resultType="io.metersphere.plan.domain.TestPlanFunctionalCase">
select tpfc.test_plan_id testPlanId, tpfc.functional_case_id functionalCaseId, tpfc.last_exec_result lastExecResult select tpfc.test_plan_id testPlanId, tpfc.functional_case_id functionalCaseId, tpfc.last_exec_result
lastExecResult
from test_plan_functional_case tpfc join functional_case fc on fc.id = tpfc.functional_case_id from test_plan_functional_case tpfc join functional_case fc on fc.id = tpfc.functional_case_id
<where> <where>
fc.deleted = false fc.deleted = false
@ -512,12 +526,12 @@
<select id="getPlanCaseNotDeletedByCollectionIds" resultType="io.metersphere.plan.domain.TestPlanFunctionalCase"> <select id="getPlanCaseNotDeletedByCollectionIds" resultType="io.metersphere.plan.domain.TestPlanFunctionalCase">
SELECT t.* SELECT t.*
from test_plan_functional_case t from test_plan_functional_case t
INNER JOIN functional_case f ON t.functional_case_id = f.id INNER JOIN functional_case f ON t.functional_case_id = f.id
WHERE t.test_plan_collection_id IN WHERE t.test_plan_collection_id IN
<foreach collection="collectionIds" item="collectionId" separator="," open="(" close=")"> <foreach collection="collectionIds" item="collectionId" separator="," open="(" close=")">
#{collectionId} #{collectionId}
</foreach> </foreach>
AND f.deleted = false AND f.deleted = false
</select> </select>
<select id="selectCaseExecResultCount" resultType="io.metersphere.plan.dto.TestPlanCaseRunResultCount"> <select id="selectCaseExecResultCount" resultType="io.metersphere.plan.dto.TestPlanCaseRunResultCount">
@ -541,8 +555,8 @@
<update id="batchUpdate"> <update id="batchUpdate">
update test_plan_functional_case update test_plan_functional_case
set last_exec_result = #{lastExecResult}, set last_exec_result = #{lastExecResult},
last_exec_time = #{lastExecTime}, last_exec_time = #{lastExecTime},
execute_user = #{userId} execute_user = #{userId}
where id in where id in
<foreach collection="ids" item="id" open="(" separator="," close=")"> <foreach collection="ids" item="id" open="(" separator="," close=")">
#{id} #{id}
@ -566,17 +580,17 @@
<select id="collectionCountByRequest" resultType="io.metersphere.project.dto.ModuleCountDTO"> <select id="collectionCountByRequest" resultType="io.metersphere.project.dto.ModuleCountDTO">
SELECT SELECT
test_plan_functional_case.test_plan_collection_id AS moduleId, test_plan_functional_case.test_plan_collection_id AS moduleId,
count( test_plan_functional_case.id ) AS dataCount count( test_plan_functional_case.id ) AS dataCount
FROM FROM
functional_case functional_case
INNER JOIN test_plan_functional_case ON functional_case.id = test_plan_functional_case.functional_case_id INNER JOIN test_plan_functional_case ON functional_case.id = test_plan_functional_case.functional_case_id
WHERE WHERE
functional_case.deleted = FALSE functional_case.deleted = FALSE
AND test_plan_functional_case.test_plan_id = #{request.testPlanId} AND test_plan_functional_case.test_plan_id = #{request.testPlanId}
<include refid="queryWhereCondition"/> <include refid="queryWhereCondition"/>
GROUP BY GROUP BY
test_plan_functional_case.test_plan_collection_id test_plan_functional_case.test_plan_collection_id
</select> </select>
<select id="selectDistinctExecResult" resultType="io.metersphere.plan.dto.TestPlanResourceExecResultDTO"> <select id="selectDistinctExecResult" resultType="io.metersphere.plan.dto.TestPlanResourceExecResultDTO">
select distinct resource.test_plan_id AS testPlanId, select distinct resource.test_plan_id AS testPlanId,

View File

@ -136,6 +136,7 @@
import useModal from '@/hooks/useModal'; import useModal from '@/hooks/useModal';
import useOpenNewPage from '@/hooks/useOpenNewPage'; import useOpenNewPage from '@/hooks/useOpenNewPage';
import useTableStore from '@/hooks/useTableStore'; import useTableStore from '@/hooks/useTableStore';
import useAppStore from '@/store/modules/app';
import { characterLimit } from '@/utils'; import { characterLimit } from '@/utils';
import { hasAllPermission, hasAnyPermission } from '@/utils/permission'; import { hasAllPermission, hasAnyPermission } from '@/utils/permission';
@ -144,7 +145,7 @@
import { ReportEnum } from '@/enums/reportEnum'; import { ReportEnum } from '@/enums/reportEnum';
import { ApiTestRouteEnum } from '@/enums/routeEnum'; import { ApiTestRouteEnum } from '@/enums/routeEnum';
import { TableKeyEnum } from '@/enums/tableEnum'; import { TableKeyEnum } from '@/enums/tableEnum';
import { FilterSlotNameEnum } from '@/enums/tableFilterEnum'; import { FilterRemoteMethodsEnum, FilterSlotNameEnum } from '@/enums/tableFilterEnum';
import { casePriorityOptions, lastReportStatusListOptions } from '@/views/api-test/components/config'; import { casePriorityOptions, lastReportStatusListOptions } from '@/views/api-test/components/config';
@ -171,6 +172,7 @@
const tableStore = useTableStore(); const tableStore = useTableStore();
const { openModal } = useModal(); const { openModal } = useModal();
const { openNewPage } = useOpenNewPage(); const { openNewPage } = useOpenNewPage();
const appStore = useAppStore();
const keyword = ref(''); const keyword = ref('');
const moduleNamePath = computed(() => { const moduleNamePath = computed(() => {
@ -293,6 +295,14 @@
showTooltip: true, showTooltip: true,
width: 130, width: 130,
showDrag: true, showDrag: true,
filterConfig: {
mode: 'remote',
loadOptionParams: {
projectId: appStore.currentProjectId,
},
remoteMethod: FilterRemoteMethodsEnum.PROJECT_PERMISSION_MEMBER,
placeholderText: t('caseManagement.featureCase.PleaseSelect'),
},
}, },
{ {
title: hasOperationPermission.value ? 'common.operation' : '', title: hasOperationPermission.value ? 'common.operation' : '',
@ -358,7 +368,9 @@
} }
return moduleIds; return moduleIds;
} }
const collectionId = computed(() => (props.activeModule === 'all' ? '' : props.activeModule)); const collectionId = computed(() => (props.activeModule === 'all' ? '' : props.activeModule));
async function getTableParams(isBatch: boolean) { async function getTableParams(isBatch: boolean) {
const selectModules = await getModuleIds(); const selectModules = await getModuleIds();
const commonParams = { const commonParams = {
@ -413,6 +425,7 @@
}); });
} }
} }
watch([() => props.activeModule, () => props.selectedProtocols], () => { watch([() => props.activeModule, () => props.selectedProtocols], () => {
loadCaseList(); loadCaseList();
}); });
@ -429,6 +442,7 @@
// //
const reportVisible = ref(false); const reportVisible = ref(false);
const reportId = ref(''); const reportId = ref('');
function showReport(record: PlanDetailApiCaseItem) { function showReport(record: PlanDetailApiCaseItem) {
if (!record.lastExecReportId) return; if (!record.lastExecReportId) return;
reportVisible.value = true; reportVisible.value = true;
@ -443,6 +457,7 @@
condition: {}, condition: {},
currentSelectCount: 0, currentSelectCount: 0,
}); });
function handleTableSelect(arr: (string | number)[]) { function handleTableSelect(arr: (string | number)[]) {
tableSelected.value = arr; tableSelected.value = arr;
} }
@ -472,6 +487,7 @@
// //
const disassociateLoading = ref(false); const disassociateLoading = ref(false);
async function handleDisassociateCase(record: PlanDetailApiCaseItem, done?: () => void) { async function handleDisassociateCase(record: PlanDetailApiCaseItem, done?: () => void) {
try { try {
disassociateLoading.value = true; disassociateLoading.value = true;

View File

@ -134,6 +134,7 @@
import useModal from '@/hooks/useModal'; import useModal from '@/hooks/useModal';
import useOpenNewPage from '@/hooks/useOpenNewPage'; import useOpenNewPage from '@/hooks/useOpenNewPage';
import useTableStore from '@/hooks/useTableStore'; import useTableStore from '@/hooks/useTableStore';
import useAppStore from '@/store/modules/app';
import { characterLimit } from '@/utils'; import { characterLimit } from '@/utils';
import { hasAllPermission, hasAnyPermission } from '@/utils/permission'; import { hasAllPermission, hasAnyPermission } from '@/utils/permission';
@ -142,7 +143,7 @@
import { ReportEnum } from '@/enums/reportEnum'; import { ReportEnum } from '@/enums/reportEnum';
import { ApiTestRouteEnum } from '@/enums/routeEnum'; import { ApiTestRouteEnum } from '@/enums/routeEnum';
import { TableKeyEnum } from '@/enums/tableEnum'; import { TableKeyEnum } from '@/enums/tableEnum';
import { FilterSlotNameEnum } from '@/enums/tableFilterEnum'; import { FilterRemoteMethodsEnum, FilterSlotNameEnum } from '@/enums/tableFilterEnum';
import { casePriorityOptions, lastReportStatusListOptions } from '@/views/api-test/components/config'; import { casePriorityOptions, lastReportStatusListOptions } from '@/views/api-test/components/config';
@ -168,6 +169,7 @@
const tableStore = useTableStore(); const tableStore = useTableStore();
const { openModal } = useModal(); const { openModal } = useModal();
const { openNewPage } = useOpenNewPage(); const { openNewPage } = useOpenNewPage();
const appStore = useAppStore();
const keyword = ref(''); const keyword = ref('');
const moduleNamePath = computed(() => { const moduleNamePath = computed(() => {
@ -275,6 +277,14 @@
showTooltip: true, showTooltip: true,
width: 130, width: 130,
showDrag: true, showDrag: true,
filterConfig: {
mode: 'remote',
loadOptionParams: {
projectId: appStore.currentProjectId,
},
remoteMethod: FilterRemoteMethodsEnum.PROJECT_PERMISSION_MEMBER,
placeholderText: t('caseManagement.featureCase.PleaseSelect'),
},
}, },
{ {
title: hasOperationPermission.value ? 'common.operation' : '', title: hasOperationPermission.value ? 'common.operation' : '',
@ -340,7 +350,9 @@
} }
return moduleIds; return moduleIds;
} }
const collectionId = computed(() => (props.activeModule === 'all' ? '' : props.activeModule)); const collectionId = computed(() => (props.activeModule === 'all' ? '' : props.activeModule));
async function getTableParams(isBatch: boolean) { async function getTableParams(isBatch: boolean) {
const selectModules = await getModuleIds(); const selectModules = await getModuleIds();
const commonParams = { const commonParams = {
@ -394,6 +406,7 @@
}); });
} }
} }
watch( watch(
() => props.activeModule, () => props.activeModule,
() => { () => {
@ -413,6 +426,7 @@
// //
const reportVisible = ref(false); const reportVisible = ref(false);
const reportId = ref(''); const reportId = ref('');
function showReport(record: PlanDetailApiScenarioItem) { function showReport(record: PlanDetailApiScenarioItem) {
if (!record.lastExecReportId) return; if (!record.lastExecReportId) return;
reportVisible.value = true; reportVisible.value = true;
@ -427,6 +441,7 @@
condition: {}, condition: {},
currentSelectCount: 0, currentSelectCount: 0,
}); });
function handleTableSelect(arr: (string | number)[]) { function handleTableSelect(arr: (string | number)[]) {
tableSelected.value = arr; tableSelected.value = arr;
} }
@ -456,6 +471,7 @@
// //
const disassociateLoading = ref(false); const disassociateLoading = ref(false);
async function handleDisassociateCase(record: PlanDetailApiScenarioItem, done?: () => void) { async function handleDisassociateCase(record: PlanDetailApiScenarioItem, done?: () => void) {
try { try {
disassociateLoading.value = true; disassociateLoading.value = true;

View File

@ -216,7 +216,7 @@
import { LastExecuteResults } from '@/enums/caseEnum'; import { LastExecuteResults } from '@/enums/caseEnum';
import { TestPlanRouteEnum } from '@/enums/routeEnum'; import { TestPlanRouteEnum } from '@/enums/routeEnum';
import { TableKeyEnum } from '@/enums/tableEnum'; import { TableKeyEnum } from '@/enums/tableEnum';
import { FilterSlotNameEnum } from '@/enums/tableFilterEnum'; import { FilterRemoteMethodsEnum, FilterSlotNameEnum } from '@/enums/tableFilterEnum';
import { casePriorityOptions } from '@/views/api-test/components/config'; import { casePriorityOptions } from '@/views/api-test/components/config';
import { executionResultMap, getCaseLevels } from '@/views/case-management/caseManagementFeature/components/utils'; import { executionResultMap, getCaseLevels } from '@/views/case-management/caseManagementFeature/components/utils';
@ -245,6 +245,7 @@
const testPlanFeatureCaseStore = useTestPlanFeatureCaseStore(); const testPlanFeatureCaseStore = useTestPlanFeatureCaseStore();
const moduleTree = computed(() => unref(testPlanFeatureCaseStore.moduleTree)); const moduleTree = computed(() => unref(testPlanFeatureCaseStore.moduleTree));
async function initModules() { async function initModules() {
await testPlanFeatureCaseStore.initModules(route.query.id as string, props.treeType); await testPlanFeatureCaseStore.initModules(route.query.id as string, props.treeType);
} }
@ -350,6 +351,14 @@
showTooltip: true, showTooltip: true,
width: 150, width: 150,
showDrag: true, showDrag: true,
filterConfig: {
mode: 'remote',
loadOptionParams: {
projectId: appStore.currentProjectId,
},
remoteMethod: FilterRemoteMethodsEnum.PROJECT_PERMISSION_MEMBER,
placeholderText: t('caseManagement.featureCase.PleaseSelect'),
},
}, },
{ {
title: hasOperationPermission.value ? 'common.operation' : '', title: hasOperationPermission.value ? 'common.operation' : '',
@ -426,7 +435,9 @@
} }
return moduleIds; return moduleIds;
} }
const collectionId = computed(() => (props.activeModule === 'all' ? '' : props.activeModule)); const collectionId = computed(() => (props.activeModule === 'all' ? '' : props.activeModule));
async function getTableParams(isBatch: boolean) { async function getTableParams(isBatch: boolean) {
const selectModules = await getModuleIds(); const selectModules = await getModuleIds();
const commonParams = { const commonParams = {
@ -490,6 +501,7 @@
}); });
} }
} }
watch( watch(
() => props.activeModule, () => props.activeModule,
() => { () => {
@ -504,6 +516,7 @@
}); });
const modulesCount = computed(() => testPlanFeatureCaseStore.modulesCount); const modulesCount = computed(() => testPlanFeatureCaseStore.modulesCount);
async function getModuleCount() { async function getModuleCount() {
let params; let params;
const tableParams = await getTableParams(false); const tableParams = await getTableParams(false);
@ -524,6 +537,7 @@
* @param getCount 获取模块树数量 * @param getCount 获取模块树数量
*/ */
const msTestPlanFeatureCaseMinderRef = ref<InstanceType<typeof MsTestPlanFeatureCaseMinder>>(); const msTestPlanFeatureCaseMinderRef = ref<InstanceType<typeof MsTestPlanFeatureCaseMinder>>();
async function refresh(getCount = true) { async function refresh(getCount = true) {
if (showType.value === 'list') { if (showType.value === 'list') {
loadCaseList(getCount); loadCaseList(getCount);
@ -565,6 +579,7 @@
condition: {}, condition: {},
currentSelectCount: 0, currentSelectCount: 0,
}); });
function handleTableSelect(arr: (string | number)[]) { function handleTableSelect(arr: (string | number)[]) {
tableSelected.value = arr; tableSelected.value = arr;
} }
@ -614,6 +629,7 @@
// //
const disassociateLoading = ref(false); const disassociateLoading = ref(false);
async function handleDisassociateCase(record: PlanDetailFeatureCaseItem, done?: () => void) { async function handleDisassociateCase(record: PlanDetailFeatureCaseItem, done?: () => void) {
try { try {
disassociateLoading.value = true; disassociateLoading.value = true;
@ -679,6 +695,7 @@
const batchLoading = ref(false); const batchLoading = ref(false);
const batchExecuteModalVisible = ref(false); const batchExecuteModalVisible = ref(false);
const batchExecuteForm = ref<ExecuteFeatureCaseFormParams>({ ...defaultExecuteForm }); const batchExecuteForm = ref<ExecuteFeatureCaseFormParams>({ ...defaultExecuteForm });
async function handleBatchExecute() { async function handleBatchExecute() {
try { try {
batchLoading.value = true; batchLoading.value = true;
@ -729,6 +746,7 @@
break; break;
} }
} }
// //
function handleMinderOperation(type: string, node: MinderJsonNode) { function handleMinderOperation(type: string, node: MinderJsonNode) {
minderSelectData.value = node.data; minderSelectData.value = node.data;
@ -782,19 +800,24 @@
:deep(.param-input:not(.arco-input-focus, .arco-select-view-focus)) { :deep(.param-input:not(.arco-input-focus, .arco-select-view-focus)) {
&:not(:hover) { &:not(:hover) {
border-color: transparent !important; border-color: transparent !important;
.arco-input::placeholder { .arco-input::placeholder {
@apply invisible; @apply invisible;
} }
.arco-select-view-icon { .arco-select-view-icon {
@apply invisible; @apply invisible;
} }
.arco-select-view-value { .arco-select-view-value {
color: var(--color-text-brand); color: var(--color-text-brand);
} }
} }
} }
.list-show-type { .list-show-type {
padding: 0; padding: 0;
:deep(.arco-radio-button-content) { :deep(.arco-radio-button-content) {
padding: 4px 6px; padding: 4px 6px;
} }