refactor(接口测试): 优化导入查询sql (#15309)

--task=1008278 --user=王孝刚
接口测试导入逻辑优化(1.20同步上)
https://www.tapd.cn/55049933/s/1187315

Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
MeterSphere Bot 2022-06-28 11:33:25 +08:00 committed by GitHub
parent bf8c39cee3
commit 3899c4be50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 21 deletions

View File

@ -1020,20 +1020,24 @@
</select> </select>
<sql id="Same_Where_Clause"> <sql id="Same_Where_Clause">
<where> <where>
<foreach collection="blobs" item="blob" separator="or"> <if test="blobs">
<trim prefix="(" prefixOverrides="and" suffix=")"> <trim prefix="(" prefixOverrides="and" suffix=")">
<if test="blob.method"> <foreach collection="blobs" item="blob" separator="or">
and api_definition.method = #{blob.method} <trim prefix="(" prefixOverrides="and" suffix=")">
</if> <if test="blob.method">
<if test="blob.path"> and api_definition.method = #{blob.method}
and api_definition.path = #{blob.path} </if>
</if> <if test="blob.path">
<if test="blob.projectId"> and api_definition.path = #{blob.path}
and api_definition.project_id = #{blob.projectId} </if>
</if> <if test="blob.projectId">
</trim> and api_definition.project_id = #{blob.projectId}
</if>
</trim>
</foreach> </foreach>
</trim>
</if>
</where> </where>
</sql> </sql>
</mapper> </mapper>

View File

@ -786,17 +786,22 @@
<sql id="Same_Where_Clause"> <sql id="Same_Where_Clause">
<where> <where>
<foreach collection="blobs" item="blob" separator="or"> <if test="blobs">
<trim prefix="(" prefixOverrides="and" suffix=")"> <trim prefix="(" prefixOverrides="and" suffix=")">
<if test="blob.name"> <foreach collection="blobs" item="blob" separator="or">
and api_scenario.name = #{blob.name} <trim prefix="(" prefixOverrides="and" suffix=")">
</if> <if test="blob.name">
<if test="blob.projectId"> and api_scenario.name = #{blob.name}
and api_scenario.project_id = #{blob.projectId} </if>
</if> <if test="blob.projectId">
</trim> and api_scenario.project_id = #{blob.projectId}
</if>
</trim>
</foreach>
</trim>
</if>
</foreach>
</where> </where>
</sql> </sql>