fix(用例管理): 功能用例高级搜索关联附件的条件,无法查询关联文件管理的文件

--bug=1046954 --user=陈建星 【高级搜索】用例列表使用关联附件条件筛选,无法比较关联文件,只能比较本地上传的文件 https://www.tapd.cn/55049933/s/1583991
This commit is contained in:
AgAngle 2024-09-23 17:26:51 +08:00 committed by jianxing
parent d140d0e6b4
commit 9e4a2e1ae8
1 changed files with 47 additions and 0 deletions

View File

@ -339,6 +339,17 @@
<property name="searchColumn" value="file_name"/> <property name="searchColumn" value="file_name"/>
<property name="condition" value="condition"/> <property name="condition" value="condition"/>
</include> </include>
<choose>
<when test="condition.operator == 'NOT_IN' or condition.operator == 'NOT_EQUALS' or condition.operator == 'NOT_CONTAINS'">
and
</when>
<otherwise>
or
</otherwise>
</choose>
<include refid="associationAttachmentCondition">
<property name="condition" value="condition"/>
</include>
</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"/>
@ -355,6 +366,42 @@
</trim> </trim>
</sql> </sql>
<sql id="associationAttachmentCondition">
<choose>
<when test="${condition}.operator == 'EMPTY'">
functional_case.id not in (
select file_association.source_id from file_association where file_association.source_type = 'FUNCTIONAL_CASE'
)
</when>
<otherwise>
(
functional_case.id
<if test="${condition}.operator == 'NOT_IN' or ${condition}.operator == 'NOT_EQUALS' or ${condition}.operator == 'NOT_CONTAINS'">
not
</if>
in (
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
<choose>
<when test="${condition}.operator == 'NOT_IN' or ${condition}.operator == 'NOT_EQUALS' or ${condition}.operator == 'NOT_CONTAINS'">
<include refid="io.metersphere.system.mapper.BaseMapper.associationReversalCondition">
<property name="condition" value="${condition}"/>
<property name="column" value="file_metadata.original_name"/>
</include>
</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>
)
)
</otherwise>
</choose>
</sql>
<sql id="queryVersionCondition"> <sql id="queryVersionCondition">
<choose> <choose>
<when test="request.versionId != null and request.versionId != ''"> <when test="request.versionId != null and request.versionId != ''">