fix(接口测试): 补充接口用例批量勾选的筛选条件
This commit is contained in:
parent
368ad8f11d
commit
ce88b5593a
|
@ -366,18 +366,18 @@
|
||||||
<select id="list" resultType="io.metersphere.api.dto.definition.ApiTestCaseResult">
|
<select id="list" resultType="io.metersphere.api.dto.definition.ApiTestCaseResult">
|
||||||
SELECT
|
SELECT
|
||||||
t1.*,
|
t1.*,
|
||||||
t2.status AS execResult,
|
t3.status AS execResult,
|
||||||
t2.create_time AS execTime,
|
t3.create_time AS execTime,
|
||||||
u2.name AS createUser,
|
u2.name AS createUser,
|
||||||
u1.name AS updateUser,
|
u1.name AS updateUser,
|
||||||
a.method AS apiMethod
|
a.method AS apiMethod
|
||||||
FROM
|
FROM
|
||||||
api_test_case t1
|
api_test_case t1
|
||||||
LEFT JOIN api_definition_exec_result t2 ON t1.last_result_id = t2.id
|
LEFT JOIN api_definition_exec_result t3 ON t1.last_result_id = t3.id
|
||||||
inner join api_definition a on t1.api_definition_id = a.id
|
inner join api_definition a on t1.api_definition_id = a.id
|
||||||
LEFT JOIN `user` u1 ON t1.update_user_id = u1.id
|
LEFT JOIN `user` u1 ON t1.update_user_id = u1.id
|
||||||
LEFT JOIN `user` u2 ON t1.create_user_id = u2.id
|
LEFT JOIN `user` u2 ON t1.create_user_id = u2.id
|
||||||
LEFT JOIN `user` u3 ON t2.user_id = u3.id
|
LEFT JOIN `user` u3 ON t3.user_id = u3.id
|
||||||
<include refid="queryWhereCondition"/>
|
<include refid="queryWhereCondition"/>
|
||||||
<if test="request.orders != null and request.orders.size() > 0">
|
<if test="request.orders != null and request.orders.size() > 0">
|
||||||
order by
|
order by
|
||||||
|
@ -846,6 +846,21 @@
|
||||||
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
|
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
|
||||||
AND t1.api_definition_id = #{request.apiDefinitionId}
|
AND t1.api_definition_id = #{request.apiDefinitionId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="request.redirectFilter == 'unexecuteCount' ">
|
||||||
|
and (t3.status IS NULL or t3.status NOT IN ('SUCCESS','ERROR','FAKE_ERROR') )
|
||||||
|
</if>
|
||||||
|
<if test="request.redirectFilter == 'executionPassCount' ">
|
||||||
|
and t3.status = 'SUCCESS'
|
||||||
|
</if>
|
||||||
|
<if test="request.redirectFilter == 'executionFailedCount' ">
|
||||||
|
and t3.status = 'ERROR'
|
||||||
|
</if>
|
||||||
|
<if test="request.redirectFilter == 'fakeErrorCount' ">
|
||||||
|
and t3.status = 'FAKE_ERROR'
|
||||||
|
</if>
|
||||||
|
<if test="request.redirectFilter == 'executedCount' ">
|
||||||
|
and t3.status IN ('SUCCESS','ERROR','FAKE_ERROR')
|
||||||
|
</if>
|
||||||
<if test="request.filters != null and request.filters.size() > 0">
|
<if test="request.filters != null and request.filters.size() > 0">
|
||||||
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
||||||
<if test="values != null and values.size() > 0">
|
<if test="values != null and values.size() > 0">
|
||||||
|
@ -856,17 +871,53 @@
|
||||||
#{value}
|
#{value}
|
||||||
</foreach>
|
</foreach>
|
||||||
</when>
|
</when>
|
||||||
|
<when test="key == 'version_id'">
|
||||||
|
and t1.version_id in
|
||||||
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
|
#{value}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
<when test="key=='status'">
|
<when test="key=='status'">
|
||||||
and t1.status in
|
and t1.status in
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
#{value}
|
#{value}
|
||||||
</foreach>
|
</foreach>
|
||||||
</when>
|
</when>
|
||||||
|
<when test="key=='caseStatus' or key=='case_status'">
|
||||||
|
and t1.case_status in
|
||||||
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
|
#{value}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
<when test="key=='execResult' or key=='exec_result'">
|
||||||
|
and (t3.status in
|
||||||
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
|
#{value}
|
||||||
|
</foreach>
|
||||||
|
<if test="values.contains(''.toString()) or values.contains('PENDING'.toString())">
|
||||||
|
or t3.status is null or t3.status = ''
|
||||||
|
</if>)
|
||||||
|
</when>
|
||||||
|
<when test="key=='create_user' or key=='createUser'">
|
||||||
|
and t1.create_user_id in
|
||||||
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
|
(#{value})
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
<when test="key=='environment'">
|
||||||
|
and JSON_UNQUOTE(JSON_EXTRACT(t1.request, '$.useEnvironment')) in
|
||||||
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
|
(#{value})
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
|
||||||
</choose>
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="request.toUpdate == null || request.toUpdate == false ">
|
||||||
<if test="key=='status' and values.size == 0">
|
<if test="key=='status' and values.size == 0">
|
||||||
and (t1.status is null or t1.status != 'Trash')
|
and (t1.status is null or t1.status != 'Trash')
|
||||||
</if>
|
</if>
|
||||||
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="request.filters == null || request.filters.size() == 0 ">
|
<if test="request.filters == null || request.filters.size() == 0 ">
|
||||||
|
@ -915,6 +966,7 @@
|
||||||
<select id="selectIdsByQuery" resultType="java.lang.String">
|
<select id="selectIdsByQuery" resultType="java.lang.String">
|
||||||
SELECT t1.id
|
SELECT t1.id
|
||||||
FROM api_test_case t1
|
FROM api_test_case t1
|
||||||
|
LEFT JOIN api_definition_exec_result t3 ON t1.last_result_id = t3.id
|
||||||
<if test="(request.moduleIds != null and request.moduleIds.size() > 0 ) or (request.protocol!=null and request.protocol!='' )">
|
<if test="(request.moduleIds != null and request.moduleIds.size() > 0 ) or (request.protocol!=null and request.protocol!='' )">
|
||||||
inner join api_definition a on t1.api_definition_id = a.id
|
inner join api_definition a on t1.api_definition_id = a.id
|
||||||
</if>
|
</if>
|
||||||
|
|
Loading…
Reference in New Issue