fix(测试计划): 修复测试计划列表高级搜索问题

--bug=1048906 --user=王旭 【测试计划】-筛选-使用计划名称与其他条件组合筛选,筛选结果错误 https://www.tapd.cn/55049933/s/1611266
This commit is contained in:
WangXu10 2024-11-18 15:12:03 +08:00 committed by Craftsman
parent 9bedceefe2
commit eeda5334ce
3 changed files with 99 additions and 77 deletions

View File

@ -29,6 +29,7 @@ public class TestPlanTableRequest extends BasePageRequest {
@Schema(description = "通过其他条件查询出来的必须要包含的测试计划ID") @Schema(description = "通过其他条件查询出来的必须要包含的测试计划ID")
private List<String> innerIds; private List<String> innerIds;
private List<String> combineInnerIds; private List<String> combineInnerIds;
private String combineOperator;
@Schema(description = "是否我的待办, 默认查询全部") @Schema(description = "是否我的待办, 默认查询全部")
private boolean myTodo = false; private boolean myTodo = false;

View File

@ -137,7 +137,13 @@
</when> </when>
</choose>--> </choose>-->
<if test="request.combineInnerIds != null and request.combineInnerIds.size() > 0"> <if test="request.combineInnerIds != null and request.combineInnerIds.size() > 0">
and t.id in and t.id
<if test="request.combineOperator != 'NOT_IN'">
in
</if>
<if test="request.combineOperator == 'NOT_IN'">
not in
</if>
<foreach collection="request.combineInnerIds" item="id" open="(" separator="," close=")"> <foreach collection="request.combineInnerIds" item="id" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
@ -214,10 +220,12 @@
</include> </include>
</if> </if>
<if test="condition.name == 'name'"> <if test="condition.name == 'name'">
<trim prefix="(" suffix=")">
<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="t.name"/> <property name="column" value="t.name"/>
</include> </include>
<if test="request.type != 'TEST_PLAN'" >
<if test="condition.operator == 'CONTAINS' or condition.operator == 'EQUALS'"> <if test="condition.operator == 'CONTAINS' or condition.operator == 'EQUALS'">
or t.id in or t.id in
( (
@ -232,7 +240,10 @@
) )
</if> </if>
</if> </if>
</trim>
</if>
<if test="condition.name == 'num'"> <if test="condition.name == 'num'">
<trim prefix="(" suffix=")">
<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="t.num"/> <property name="column" value="t.num"/>
@ -252,6 +263,7 @@
) )
</if> </if>
</if> </if>
</trim>
</if> </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">
@ -278,10 +290,12 @@
</include> </include>
</if> </if>
<if test="condition.name == 'tags'"> <if test="condition.name == 'tags'">
<trim prefix="(" suffix=")">
<include refid="io.metersphere.system.mapper.BaseMapper.arrayValueCondition"> <include refid="io.metersphere.system.mapper.BaseMapper.arrayValueCondition">
<property name="condition" value="condition"/> <property name="condition" value="condition"/>
<property name="column" value="t.tags"/> <property name="column" value="t.tags"/>
</include> </include>
<if test="request.type != 'TEST_PLAN'" >
<if test="condition.operator == 'CONTAINS'"> <if test="condition.operator == 'CONTAINS'">
or t.id in or t.id in
( (
@ -296,13 +310,15 @@
) )
</if> </if>
</if> </if>
</trim>
</if>
<!-- 状态 --> <!-- 状态 -->
<if test="condition.name == 'status'"> <if test="condition.name == 'status'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition"> status in
<property name="condition" value="condition"/> <foreach collection="condition.value" item="v" separator="," open="(" close=")">
<property name="column" value="t.status"/> #{v}
</include> </foreach>
</if> </if>
<include refid="io.metersphere.system.mapper.BaseMapper.queryType"> <include refid="io.metersphere.system.mapper.BaseMapper.queryType">
<property name="searchMode" value="${combineSearch}.searchMode"/> <property name="searchMode" value="${combineSearch}.searchMode"/>
@ -976,6 +992,7 @@
<property name="condition" value="condition"/> <property name="condition" value="condition"/>
<property name="column" value="t.name"/> <property name="column" value="t.name"/>
</include> </include>
<if test="request.type != 'TEST_PLAN'" >
<if test="condition.operator == 'CONTAINS' or condition.operator == 'EQUALS'"> <if test="condition.operator == 'CONTAINS' or condition.operator == 'EQUALS'">
or t.id in or t.id in
( (
@ -990,6 +1007,7 @@
) )
</if> </if>
</if> </if>
</if>
<if test="condition.name == 'num'"> <if test="condition.name == 'num'">
<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"/>
@ -1040,6 +1058,7 @@
<property name="condition" value="condition"/> <property name="condition" value="condition"/>
<property name="column" value="t.tags"/> <property name="column" value="t.tags"/>
</include> </include>
<if test="request.type != 'TEST_PLAN'" >
<if test="condition.operator == 'CONTAINS'"> <if test="condition.operator == 'CONTAINS'">
or t.id in or t.id in
( (
@ -1054,6 +1073,7 @@
) )
</if> </if>
</if> </if>
</if>
<!-- 状态 --> <!-- 状态 -->
<if test="condition.name == 'status'"> <if test="condition.name == 'status'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition"> <include refid="io.metersphere.system.mapper.BaseMapper.condition">

View File

@ -202,6 +202,7 @@ public class TestPlanManagementService {
//目前未归档的测试计划只有3中类型所以这里判断如果是3个的话等于直接查询未归档 //目前未归档的测试计划只有3中类型所以这里判断如果是3个的话等于直接查询未归档
if (statusList.size() < 3) { if (statusList.size() < 3) {
request.setCombineInnerIds(this.selectTestPlanIdByProjectIdAndStatus(request.getProjectId(), statusList)); request.setCombineInnerIds(this.selectTestPlanIdByProjectIdAndStatus(request.getProjectId(), statusList));
request.setCombineOperator(item.getOperator());
} }
} }
}); });