fix(测试跟踪): 高级搜索字段查询问题

--bug=1037138 --user=宋昌昌 【测试跟踪】github#29458,【缺陷管理】【高级搜索】高级搜索不属于某条件时查询出来出来的都是属于该条件的 https://www.tapd.cn/55049933/s/1624407
This commit is contained in:
song-cc-rock 2024-12-04 11:39:28 +08:00 committed by Craftsman
parent 7c5750deb4
commit 351a02ee93
1 changed files with 20 additions and 5 deletions

View File

@ -395,12 +395,26 @@
</if> </if>
<if test="${condition}.customs != null and ${condition}.customs.size() > 0"> <if test="${condition}.customs != null and ${condition}.customs.size() > 0">
<foreach collection="${condition}.customs" item="custom" separator="" open="" close=""> <foreach collection="${condition}.customs" item="custom" separator="" open="" close="">
and issues.id in ( <!-- 多选字段查询条件已经拼接好 -->
<if test="custom.type == 'multipleMember' or custom.type == 'checkbox' or custom.type == 'multipleSelect'">
and issues.id
<choose>
<when test='custom.operator == "in"'>
in
</when>
<when test='custom.operator == "not in"'>
not in
</when>
<otherwise>
in
</otherwise>
</choose>
(select resource_id from custom_field_issues where field_id = #{custom.id} and ${custom.value})
</if>
<if test="custom.type != 'multipleMember' and custom.type != 'checkbox' and custom.type != 'multipleSelect'">
and issues.id in (
select resource_id from custom_field_issues where field_id = #{custom.id} select resource_id from custom_field_issues where field_id = #{custom.id}
<choose> <choose>
<when test="custom.type == 'multipleMember' or custom.type == 'checkbox' or custom.type == 'multipleSelect'">
and ${custom.value}
</when>
<when test="custom.type == 'date' or custom.type == 'datetime'"> <when test="custom.type == 'date' or custom.type == 'datetime'">
and left(replace(unix_timestamp(trim(both '"' from `value`)), '.', ''), 13) and left(replace(unix_timestamp(trim(both '"' from `value`)), '.', ''), 13)
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition"> <include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
@ -420,7 +434,8 @@
</include> </include>
</otherwise> </otherwise>
</choose> </choose>
) )
</if>
</foreach> </foreach>
</if> </if>
</sql> </sql>