fix(用例管理): 用例自定义字段多条件查询结果有误

--bug=1046674 --user=陈建星 【用例评审】评审详情-高级筛选-自动定义字段整数类型+输入框类型筛选失败 https://www.tapd.cn/55049933/s/1580542
This commit is contained in:
AgAngle 2024-09-19 11:05:24 +08:00 committed by jianxing
parent 6ddada0d3b
commit 5699075845
1 changed files with 38 additions and 40 deletions

View File

@ -72,6 +72,7 @@
<if test="${combineSearch}.customFiledNoneConditions.size() > 0"> <if test="${combineSearch}.customFiledNoneConditions.size() > 0">
<foreach collection="${combineSearch}.customFiledNoneConditions" item="condition"> <foreach collection="${combineSearch}.customFiledNoneConditions" item="condition">
<trim prefix="(" suffix=")">
${mainIdColumn} not in ( ${mainIdColumn} not in (
select ${associationIdColumn} from ${associationTable} where select ${associationIdColumn} from ${associationTable} where
field_id = #{condition.name} and field_id = #{condition.name} and
@ -98,6 +99,7 @@
</otherwise> </otherwise>
</choose> </choose>
) )
</trim>
<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"/>
</include> </include>
@ -105,11 +107,9 @@
</if> </if>
<if test="${combineSearch}.customFiledConditions.size() > 0"> <if test="${combineSearch}.customFiledConditions.size() > 0">
<foreach collection="${combineSearch}.customFiledConditions" item="condition">
${mainIdColumn} in ( ${mainIdColumn} in (
select ${associationIdColumn} from ${associationTable} where select ${associationIdColumn} from ${associationTable} where
<trim suffixOverrides="AND|OR">
<foreach collection="${combineSearch}.customFiledConditions" item="condition">
<trim prefix="(" suffix=")">
field_id = #{condition.name} and field_id = #{condition.name} and
<choose> <choose>
<when test="condition.customFieldType != null and condition.isMultipleCustomField()"> <when test="condition.customFieldType != null and condition.isMultipleCustomField()">
@ -125,13 +125,11 @@
</include> </include>
</otherwise> </otherwise>
</choose> </choose>
</trim> )
<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"/>
</include> </include>
</foreach> </foreach>
</trim>
)
</if> </if>
</sql> </sql>
@ -151,13 +149,13 @@
<when test="${condition}.operator == 'NOT_CONTAINS'"> <when test="${condition}.operator == 'NOT_CONTAINS'">
${column} is null or ${column} = '[]' or ${column} is null or ${column} = '[]' or
<foreach collection="${condition}.value" item="tag" separator="and" open="(" close=")"> <foreach collection="${condition}.value" item="tag" separator="and" open="(" close=")">
!JSON_CONTAINS(${column}, JSON_ARRAY(#{tag})) not JSON_CONTAINS(${column}, JSON_ARRAY(#{tag}))
</foreach> </foreach>
</when> </when>
<when test="${condition}.operator == 'NOT_IN'"> <when test="${condition}.operator == 'NOT_IN'">
${column} is null or ${column} = '[]' or ${column} is null or ${column} = '[]' or
<foreach collection="${condition}.value" item="tag" separator="and" open="(" close=")"> <foreach collection="${condition}.value" item="tag" separator="and" open="(" close=")">
!JSON_CONTAINS(${column}, JSON_ARRAY(#{tag})) not JSON_CONTAINS(${column}, JSON_ARRAY(#{tag}))
</foreach> </foreach>
</when> </when>
<when test="${condition}.operator == 'COUNT_GT'"> <when test="${condition}.operator == 'COUNT_GT'">