fix: 高级搜索问题#1006737,#1006717

--bug=1006737 --user=lyh 【测试计划】-关联性能测试用例-高级搜索-用例名包含“测试”搜索sql报错
https://www.tapd.cn/55049933/s/1048238
--bug=1006717 --user=lyh
【测试跟踪】测试用例关联接口的高级搜索,根据创建人搜索没生效 https://www.tapd.cn/55049933/s/1048241
This commit is contained in:
shiziyuan9527 2021-09-17 18:46:00 +08:00 committed by 刘瑞斌
parent 845d817a09
commit 3a6311692b
5 changed files with 63 additions and 7 deletions

View File

@ -271,6 +271,56 @@
<property name="object" value="${condition}.tags"/> <property name="object" value="${condition}.tags"/>
</include> </include>
</if> </if>
<if test="${condition}.creator != null">
and atc.create_user_id
<include refid="condition">
<property name="object" value="${condition}.creator"/>
</include>
</if>
</sql>
<sql id="loadCaseCombine">
<if test='${condition}.name != null and (${name} == null or ${name} == "")'>
and atc.name
<include refid="condition">
<property name="object" value="${condition}.name"/>
</include>
</if>
<if test="${condition}.updateTime != null">
and atc.update_time
<include refid="condition">
<property name="object" value="${condition}.updateTime"/>
</include>
</if>
<if test="${condition}.createTime != null">
and atc.create_time
<include refid="condition">
<property name="object" value="${condition}.createTime"/>
</include>
</if>
<if test="${condition}.priority != null">
and atc.priority
<include refid="condition">
<property name="object" value="${condition}.priority"/>
</include>
</if>
<if test="${condition}.status != null">
and atc.status
<include refid="condition">
<property name="object" value="${condition}.status"/>
</include>
</if>
<if test='${condition}.tags != null and ${objectKey}.operator == "like"'>
and atc.tags
<include refid="condition">
<property name="object" value="${condition}.tags"/>
</include>
</if>
<if test="${condition}.creator != null">
and atc.create_user
<include refid="condition">
<property name="object" value="${condition}.creator"/>
</include>
</if>
</sql> </sql>
<sql id="scenarioCombine"> <sql id="scenarioCombine">
<if test='${condition}.name != null and (${name} == null or ${name} == "")'> <if test='${condition}.name != null and (${name} == null or ${name} == "")'>
@ -309,6 +359,12 @@
<property name="object" value="${condition}.tags"/> <property name="object" value="${condition}.tags"/>
</include> </include>
</if> </if>
<if test='${condition}.creator != null'>
and atc.create_user
<include refid="condition">
<property name="object" value="${condition}.creator"/>
</include>
</if>
</sql> </sql>
<select id="relevanceScenarioList" resultType="io.metersphere.api.dto.automation.ApiScenarioDTO"> <select id="relevanceScenarioList" resultType="io.metersphere.api.dto.automation.ApiScenarioDTO">
SELECT SELECT
@ -353,7 +409,7 @@
or atc.num like CONCAT('%', #{request.name},'%')) or atc.num like CONCAT('%', #{request.name},'%'))
</if> </if>
<if test="request.combine != null"> <if test="request.combine != null">
<include refid="scenarioCombine"> <include refid="loadCaseCombine">
<property name="condition" value="request.combine"/> <property name="condition" value="request.combine"/>
<property name="name" value="request.name"/> <property name="name" value="request.name"/>
<property name="objectKey" value="request.combine.tags"/> <property name="objectKey" value="request.combine.tags"/>

View File

@ -17,6 +17,9 @@
select load_test.id select load_test.id
from load_test from load_test
where load_test.project_id = #{request.projectId} where load_test.project_id = #{request.projectId}
and load_test.id not in (
select tplc.load_case_id from test_plan_load_case tplc where tplc.test_plan_id = #{request.testPlanId}
)
<if test="request.name != null and request.name != ''"> <if test="request.name != null and request.name != ''">
and load_test.name like CONCAT('%', #{request.name},'%') and load_test.name like CONCAT('%', #{request.name},'%')
</if> </if>
@ -41,9 +44,6 @@
<property name="objectKey" value="request.combine.tags"/> <property name="objectKey" value="request.combine.tags"/>
</include> </include>
</if> </if>
and load_test.id not in (
select tplc.load_case_id from test_plan_load_case tplc where tplc.test_plan_id = #{request.testPlanId}
)
</select> </select>
<sql id="condition"> <sql id="condition">
<choose> <choose>

View File

@ -3,7 +3,7 @@
<test-case-relevance-base <test-case-relevance-base
@setProject="setProject" @setProject="setProject"
@save="saveCaseRelevance" @save="saveCaseRelevance"
width="50%" width="60%"
ref="baseRelevance"> ref="baseRelevance">
<template v-slot:aside> <template v-slot:aside>

View File

@ -3,7 +3,7 @@
<test-case-relevance-base <test-case-relevance-base
@setProject="setProject" @setProject="setProject"
@save="saveCaseRelevance" @save="saveCaseRelevance"
width="50%" width="60%"
ref="baseRelevance"> ref="baseRelevance">
<test-case-relate-load-list <test-case-relate-load-list

View File

@ -3,7 +3,7 @@
<test-case-relevance-base <test-case-relevance-base
@setProject="setProject" @setProject="setProject"
@save="saveCaseRelevance" @save="saveCaseRelevance"
width="50%" width="60%"
ref="baseRelevance"> ref="baseRelevance">
<template v-slot:aside> <template v-slot:aside>