fix(测试计划): 修复测试计划关联用例高级搜索多项目情况下所属模块搜索问题

--bug=1049199 --user=王旭 【测试计划】计划详情-接口用例/场景用例列表-筛选-所属模块筛选未搜索到数据 https://www.tapd.cn/55049933/s/1613503
This commit is contained in:
WangXu10 2024-11-21 13:45:12 +08:00 committed by 刘瑞斌
parent d726c9cee4
commit a5a64ba5a4
3 changed files with 60 additions and 8 deletions

View File

@ -511,13 +511,27 @@
<when test="condition.operator == 'IN'"> <when test="condition.operator == 'IN'">
concat(a.project_id, '_', a.module_id) in concat(a.project_id, '_', a.module_id) in
<foreach collection="condition.value" item="v" separator="," open="(" close=")"> <foreach collection="condition.value" item="v" separator="," open="(" close=")">
<choose>
<when test="v.contains('_root')">
#{v} #{v}
</when>
<otherwise>
concat(a.project_id, '_', #{v})
</otherwise>
</choose>
</foreach> </foreach>
</when> </when>
<when test="condition.operator == 'NOT_IN'"> <when test="condition.operator == 'NOT_IN'">
concat(a.project_id, '_', a.module_id) not in concat(a.project_id, '_', a.module_id) not in
<foreach collection="condition.value" item="v" separator="," open="(" close=")"> <foreach collection="condition.value" item="v" separator="," open="(" close=")">
<choose>
<when test="v.contains('_root')">
#{v} #{v}
</when>
<otherwise>
concat(a.project_id, '_', #{v})
</otherwise>
</choose>
</foreach> </foreach>
</when> </when>
</choose> </choose>

View File

@ -275,13 +275,27 @@
<when test="condition.operator == 'IN'"> <when test="condition.operator == 'IN'">
concat(api_scenario.project_id, '_', api_scenario.module_id) in concat(api_scenario.project_id, '_', api_scenario.module_id) in
<foreach collection="condition.value" item="v" separator="," open="(" close=")"> <foreach collection="condition.value" item="v" separator="," open="(" close=")">
<choose>
<when test="v.contains('_root')">
#{v} #{v}
</when>
<otherwise>
concat(api_scenario.project_id, '_', #{v})
</otherwise>
</choose>
</foreach> </foreach>
</when> </when>
<when test="condition.operator == 'NOT_IN'"> <when test="condition.operator == 'NOT_IN'">
concat(api_scenario.project_id, '_', api_scenario.module_id) not in concat(api_scenario.project_id, '_', api_scenario.module_id) not in
<foreach collection="condition.value" item="v" separator="," open="(" close=")"> <foreach collection="condition.value" item="v" separator="," open="(" close=")">
<choose>
<when test="v.contains('_root')">
#{v} #{v}
</when>
<otherwise>
concat(api_scenario.project_id, '_', #{v})
</otherwise>
</choose>
</foreach> </foreach>
</when> </when>
</choose> </choose>

View File

@ -316,10 +316,34 @@
</include> </include>
<!-- 所属模块(项目ID_模块ID 组合查询) --> <!-- 所属模块(项目ID_模块ID 组合查询) -->
<if test="condition.name == 'moduleId'"> <if test="condition.name == 'moduleId'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition"> <choose>
<property name="condition" value="condition"/> <when test="condition.operator == 'IN'">
<property name="column" value="functional_case.module_id"/> concat(functional_case.project_id, '_', functional_case.module_id) in
</include> <foreach collection="condition.value" item="v" separator="," open="(" close=")">
<choose>
<when test="v.contains('_root')">
#{v}
</when>
<otherwise>
concat(functional_case.project_id, '_', #{v})
</otherwise>
</choose>
</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=")">
<choose>
<when test="v.contains('_root')">
#{v}
</when>
<otherwise>
concat(functional_case.project_id, '_', #{v})
</otherwise>
</choose>
</foreach>
</when>
</choose>
</if> </if>
<!-- 测试点 --> <!-- 测试点 -->
<if test="condition.name == 'testPlanCollectionId'"> <if test="condition.name == 'testPlanCollectionId'">