refactor(deps): 调整条件筛选sql
This commit is contained in:
parent
fd8b9b3a1c
commit
404bcff3b7
|
@ -122,12 +122,14 @@
|
||||||
</if>
|
</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">
|
||||||
and api_test.${key} in
|
and api_test.status in
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
#{value}
|
#{value}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
|
|
@ -89,10 +89,20 @@
|
||||||
<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">
|
||||||
and r.${key} in
|
<choose>
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
<when test="key=='status'">
|
||||||
#{value}
|
and r.status in
|
||||||
</foreach>
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
|
#{value}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
and r.trigger_mode in
|
||||||
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
|
#{value}
|
||||||
|
</foreach>
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
|
|
@ -51,7 +51,8 @@
|
||||||
</if>
|
</if>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="list" resultMap="BaseResultMap" parameterType="io.metersphere.track.request.testplan.QueryTestPlanRequest">
|
<select id="list" resultMap="BaseResultMap"
|
||||||
|
parameterType="io.metersphere.track.request.testplan.QueryTestPlanRequest">
|
||||||
select load_test.*, project.name as project_name, user.name as user_name
|
select load_test.*, project.name as project_name, user.name as user_name
|
||||||
from load_test
|
from load_test
|
||||||
left join project on load_test.project_id = project.id
|
left join project on load_test.project_id = project.id
|
||||||
|
@ -83,7 +84,7 @@
|
||||||
<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">
|
||||||
and load_test.${key} in
|
and load_test.status in
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
#{value}
|
#{value}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
<mapper namespace="io.metersphere.base.mapper.ext.ExtLoadTestReportMapper">
|
<mapper namespace="io.metersphere.base.mapper.ext.ExtLoadTestReportMapper">
|
||||||
|
|
||||||
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.LoadTestReport">
|
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.LoadTestReport">
|
||||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
<id column="id" jdbcType="VARCHAR" property="id"/>
|
||||||
<result column="test_id" jdbcType="VARCHAR" property="testId" />
|
<result column="test_id" jdbcType="VARCHAR" property="testId"/>
|
||||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
<result column="name" jdbcType="VARCHAR" property="name"/>
|
||||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
<result column="create_time" jdbcType="BIGINT" property="createTime"/>
|
||||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
<result column="update_time" jdbcType="BIGINT" property="updateTime"/>
|
||||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
<result column="status" jdbcType="VARCHAR" property="status"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
|
@ -95,10 +95,21 @@
|
||||||
<if test="reportRequest.filters != null and reportRequest.filters.size() > 0">
|
<if test="reportRequest.filters != null and reportRequest.filters.size() > 0">
|
||||||
<foreach collection="reportRequest.filters.entrySet()" index="key" item="values">
|
<foreach collection="reportRequest.filters.entrySet()" index="key" item="values">
|
||||||
<if test="values != null and values.size() > 0">
|
<if test="values != null and values.size() > 0">
|
||||||
and ltr.${key} in
|
<choose>
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
<when test="key=='status'">
|
||||||
#{value}
|
and ltr.status in
|
||||||
</foreach>
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
|
#{value}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
and ltr.trigger_mode in
|
||||||
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
|
#{value}
|
||||||
|
</foreach>
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
|
||||||
</if>
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
|
|
@ -168,10 +168,26 @@
|
||||||
<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">
|
||||||
and test_case.${key} in
|
<choose>
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
<when test="key=='priority'">
|
||||||
#{value}
|
and test_case.priority in
|
||||||
</foreach>
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
|
#{value}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
<when test="key=='type'">
|
||||||
|
and test_case.type in
|
||||||
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
|
#{value}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
and test_case.method in
|
||||||
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
|
#{value}
|
||||||
|
</foreach>
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
|
Loading…
Reference in New Issue