feat(接口测试): 接口case支持通过路径搜索

--story=1011245 --user=宋天阳 接口case支持通过路径搜索
https://www.tapd.cn/55049933/s/1359680
This commit is contained in:
song-tianyang 2023-04-06 11:02:36 +08:00 committed by 建国
parent 5705ac1f54
commit c64211a2b9
1 changed files with 35 additions and 34 deletions

View File

@ -453,9 +453,12 @@
</foreach>
</if>
<if test="request.name != null and request.name!=''">
and (t1.name like CONCAT('%', #{request.name},'%')
and (
t1.name like CONCAT('%', #{request.name},'%')
or t1.tags like CONCAT('%', #{request.name},'%')
or t1.num like CONCAT('%', #{request.name},'%'))
or t1.num like CONCAT('%', #{request.name},'%')
or a.path like CONCAT('%', #{request.name},'%')
)
</if>
<if test="request.createTime > 0">
and t1.create_time >= #{request.createTime}
@ -664,9 +667,9 @@
<select id="countProtocolByProjectID" resultType="io.metersphere.api.dto.datacount.ApiDataCountResult">
SELECT apiDef.protocol AS groupField, COUNT(testCase.id) AS countNumber
FROM api_test_case testCase
INNER JOIN api_definition apiDef ON testCase.api_definition_id = apiDef.id
INNER JOIN api_definition apiDef ON testCase.api_definition_id = apiDef.id
WHERE testCase.project_id = #{projectId}
AND (testCase.status IS NULL or testCase.status != "Trash")
AND (testCase.status IS NULL or testCase.status != "Trash")
<if test="versionId != null">
AND apiDef.version_id = #{versionId}
</if>
@ -686,12 +689,12 @@
<select id="countByProjectIDAndCreateInThisWeek" resultType="java.lang.Long">
SELECT count(testCase.id) AS countNumber
FROM api_test_case testCase
INNER JOIN api_definition apiDef ON testCase.api_definition_id = apiDef.id
INNER JOIN api_definition apiDef ON testCase.api_definition_id = apiDef.id
WHERE testCase.project_id = #{projectId} AND apiDef.status != "Trash"
AND (testCase.create_time BETWEEN #{firstDayTimestamp}
AND #{lastDayTimestamp})
AND (testCase.status is null
or testCase.status != 'Trash')
AND (testCase.create_time BETWEEN #{firstDayTimestamp}
AND #{lastDayTimestamp})
AND (testCase.status is null
or testCase.status != 'Trash')
<if test="versionId != null">
AND apiDef.version_id = #{versionId}
</if>
@ -744,7 +747,8 @@
SELECT *
FROM api_test_case
WHERE api_test_case.api_definition_id = #{definitionId}
ORDER BY num DESC LIMIT 1;
ORDER BY num DESC
LIMIT 1;
</select>
<select id="selectEffectiveTestCaseByProjectId" resultType="io.metersphere.base.domain.ApiTestCase">
select id, api_definition_id
@ -1035,15 +1039,15 @@
WHERE
( testCase.`status` IS NULL OR testCase.`status` != 'Trash' )
AND testCase.api_definition_id IN (
SELECT id FROM api_definition
WHERE project_id = #{projectId}
<if test="versionId != null">
AND version_id = #{versionId}
</if>
<if test="versionId == null">
AND latest IS TRUE
</if>
)
SELECT id FROM api_definition
WHERE project_id = #{projectId}
<if test="versionId != null">
AND version_id = #{versionId}
</if>
<if test="versionId == null">
AND latest IS TRUE
</if>
)
GROUP BY
execResult.`status`;
@ -1286,22 +1290,22 @@
<select id="selectApiBasicInfoByCaseId" resultType="io.metersphere.base.domain.ApiDefinition">
select id, project_id, name, version_id
FROM api_definition
WHERE id IN (
SELECT api_definition_id FROM api_test_case WHERE id = #{0}
)
WHERE id IN (SELECT api_definition_id
FROM api_test_case
WHERE id = #{0})
</select>
<select id="selectApiCaseBasicInfoById" resultType="io.metersphere.api.dto.ApiCaseBasicInfoDTO">
SELECT apiCase.id,apiCase.project_id,api.version_id
SELECT apiCase.id, apiCase.project_id, api.version_id
FROM api_definition api
INNER JOIN api_test_case apiCase ON api.id = apiCase.api_definition_id
WHERE apiCase.id = #{0}
INNER JOIN api_test_case apiCase ON api.id = apiCase.api_definition_id
WHERE apiCase.id = #{0}
</select>
<select id="selectSourceIdByProjectIdIsNull" resultType="java.lang.String">
SELECT DISTINCT source_id
FROM api_case_execution_info
WHERE project_id IS NULL
FROM api_case_execution_info
WHERE project_id IS NULL
</select>
<select id="countSourceIdByProjectIdIsNull" resultType="java.lang.Long">
@ -1311,12 +1315,9 @@
</select>
<select id="findPassRateById" resultType="java.lang.String">
SELECT
CONCAT( FORMAT( SUM( IF ( t2.`status` = 'success', 1, 0 ))/ COUNT( t2.id )* 100, 2 ), '%' )
VALUE
FROM
api_definition_exec_result t2
WHERE
t2.resource_id = #{0}
SELECT CONCAT(FORMAT(SUM(IF(t2.`status` = 'success', 1, 0)) / COUNT(t2.id) * 100, 2), '%')
VALUE
FROM api_definition_exec_result t2
WHERE t2.resource_id = #{0}
</select>
</mapper>