fix(接口测试): 用例高级搜索查询关联的附件,带后缀的关键字搜索结果有误

--bug=1046954 --user=陈建星 【高级搜索】用例列表使用关联附件条件筛选,无法比较关联文件,只能比较本地上传的文件 https://www.tapd.cn/55049933/s/1586779
This commit is contained in:
AgAngle 2024-09-26 14:10:02 +08:00 committed by Craftsman
parent 4e9f7c6388
commit 47034570bf
1 changed files with 32 additions and 16 deletions

View File

@ -368,8 +368,12 @@
<sql id="associationAttachmentCondition"> <sql id="associationAttachmentCondition">
<choose> <choose>
<when test="${condition}.operator == 'EMPTY'"> <when test="${condition}.operator == 'EMPTY' or ${condition}.operator == 'NOT_EMPTY'">
functional_case.id not in ( functional_case.id
<if test="${condition}.operator == 'EMPTY'">
not
</if>
in (
select file_association.source_id from file_association where file_association.source_type = 'FUNCTIONAL_CASE' select file_association.source_id from file_association where file_association.source_type = 'FUNCTIONAL_CASE'
) )
</when> </when>
@ -382,20 +386,32 @@
in ( in (
select file_association.source_id from file_association join file_metadata on file_association.file_id = file_metadata.id select file_association.source_id from file_association join file_metadata on file_association.file_id = file_metadata.id
and file_association.source_type = 'FUNCTIONAL_CASE' and and file_association.source_type = 'FUNCTIONAL_CASE' and
<trim prefix="(" suffix=")">
<choose> <choose>
<when test="${condition}.operator == 'NOT_IN' or ${condition}.operator == 'NOT_EQUALS' or ${condition}.operator == 'NOT_CONTAINS'"> <when test="${condition}.operator == 'CONTAINS' or ${condition}.operator == 'NOT_CONTAINS'">
<include refid="io.metersphere.system.mapper.BaseMapper.associationReversalCondition"> <foreach collection="${condition}.value.split(' ')" item="item" separator="and">
<property name="condition" value="${condition}"/> <foreach collection="item.split('\\.')" index="index" item="subItem">
<property name="column" value="file_metadata.original_name"/> <if test="index == 0">
</include> file_metadata.name like CONCAT('%', #{subItem},'%')
</if>
<if test="index == 1">
and file_metadata.`type` like CONCAT('%', #{subItem},'%')
</if>
</foreach>
</foreach>
</when>
<when test="${condition}.operator == 'EQUALS' or ${condition}.operator == 'NOT_EQUALS'">
<foreach collection="${condition}.value.split('\\.')" index="index" item="item">
<if test="index == 0">
file_metadata.name = #{item}
</if>
<if test="index == 1">
and file_metadata.`type` = #{item}
</if>
</foreach>
</when> </when>
<otherwise>
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="${condition}"/>
<property name="column" value="file_metadata.original_name"/>
</include>
</otherwise>
</choose> </choose>
</trim>
) )
) )
</otherwise> </otherwise>