fix(接口自动化): 所有高级搜索增加TAGS

This commit is contained in:
fit2-zhao 2021-01-11 15:54:49 +08:00
parent c10920aff0
commit 6b57e3a3e2
6 changed files with 920 additions and 804 deletions

View File

@ -7,7 +7,94 @@
<result column="project_name" property="projectName"/>
<result column="user_name" property="userName"/>
</resultMap>
<sql id="condition">
<choose>
<when test='${object}.operator == "like"'>
like CONCAT('%', #{${object}.value},'%')
</when>
<when test='${object}.operator == "not like"'>
not like CONCAT('%', #{${object}.value},'%')
</when>
<when test='${object}.operator == "in"'>
in
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test='${object}.operator == "not in"'>
not in
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test='${object}.operator == "between"'>
between #{${object}.value[0]} and #{${object}.value[1]}
</when>
<when test='${object}.operator == "gt"'>
&gt; #{${object}.value}
</when>
<when test='${object}.operator == "lt"'>
&lt; #{${object}.value}
</when>
<when test='${object}.operator == "ge"'>
&gt;= #{${object}.value}
</when>
<when test='${object}.operator == "le"'>
&lt;= #{${object}.value}
</when>
<when test='${object}.operator == "current user"'>
= '${@io.metersphere.commons.utils.SessionUtils@getUserId()}'
</when>
<otherwise>
= #{${object}.value}
</otherwise>
</choose>
</sql>
<sql id="combine">
<if test='${condition}.name != null and (${name} == null or ${name} == "")'>
and api_scenario.name
<include refid="condition">
<property name="object" value="${condition}.name"/>
</include>
</if>
<if test="${condition}.updateTime != null">
and api_scenario.update_time
<include refid="condition">
<property name="object" value="${condition}.updateTime"/>
</include>
</if>
<if test="${condition}.createTime != null">
and api_scenario.create_time
<include refid="condition">
<property name="object" value="${condition}.createTime"/>
</include>
</if>
<if test="${condition}.priority != null">
and api_scenario.level
<include refid="condition">
<property name="object" value="${condition}.priority"/>
</include>
</if>
<if test="${condition}.creator != null">
and api_scenario.user_id
<include refid="condition">
<property name="object" value="${condition}.creator"/>
</include>
</if>
<if test="${condition}.tags != null">
and api_scenario.tags
<include refid="condition">
<property name="object" value="${condition}.tags"/>
</include>
</if>
<if test="${condition}.status != null">
and api_scenario.last_result
<include refid="condition">
<property name="object" value="${condition}.status"/>
</include>
</if>
</sql>
<select id="list" resultMap="BaseResultMap">
select api_scenario.id, api_scenario.project_id, api_scenario.tags, api_scenario.user_id, api_scenario.num,
api_scenario.api_scenario_module_id,api_scenario.module_path, api_scenario.name, api_scenario.level,
@ -19,6 +106,13 @@
left join project on api_scenario.project_id = project.id
left join user on api_scenario.user_id = user.id
<where>
<if test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
</include>
</if>
<if test="request.name != null">
and api_scenario.name like CONCAT('%', #{request.name},'%')
</if>

View File

@ -259,14 +259,14 @@
<select id="listSimple" resultType="io.metersphere.api.dto.definition.ApiTestCaseDTO">
select
c.id, c.project_id, c.name, c.api_definition_id, c.priority, c.description, c.create_user_id, c.update_user_id, c.create_time, c.update_time, c.num,
atc.id, atc.project_id, atc.name, atc.api_definition_id, atc.priority, atc.description, atc.create_user_id, atc.update_user_id, atc.create_time, atc.update_time, atc.num,
a.module_id, a.path, a.protocol
from
api_test_case c
api_test_case atc
inner join
api_definition a
on
c.api_definition_id = a.id
atc.api_definition_id = a.id
<if test="request.protocol != null and request.protocol!=''">
and a.protocol = #{request.protocol}
</if>
@ -278,27 +278,33 @@
and a.status != 'Trash'
</otherwise>
</choose>
where
<where>
<if test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
</include>
</if>
<if test="request.projectId != null and request.projectId!=''">
c.project_id = #{request.projectId}
and atc.project_id = #{request.projectId}
</if>
<if test="request.id != null and request.id!=''">
and c.id = #{request.id}
and atc.id = #{request.id}
</if>
<if test="request.ids != null and request.ids.size() > 0">
<if test="request.projectId != null and request.projectId!=''">
and
</if>
c.id in
atc.id in
<foreach collection="request.ids" item="caseId" separator="," open="(" close=")">
#{caseId}
</foreach>
</if>
<if test="request.name != null and request.name!=''">
and c.name like CONCAT('%', #{request.name},'%')
and atc.name like CONCAT('%', #{request.name},'%')
</if>
<if test="request.createTime > 0">
and c.create_time >= #{request.createTime}
and atc.create_time >= #{request.createTime}
</if>
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
and a.module_id in
@ -311,7 +317,7 @@
<if test="values != null and values.size() > 0">
<choose>
<when test="key == 'priority'">
and c.priority in
and atc.priority in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
@ -320,6 +326,7 @@
</if>
</foreach>
</if>
</where>
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">

View File

@ -95,6 +95,13 @@
<property name="object" value="${condition}.creator"/>
</include>
</if>
<if test="${condition}.tags != null">
and test_case.tags
<include refid="condition">
<property name="object" value="${condition}.tags"/>
</include>
</if>
</sql>
<select id="getTestCaseByNotInReview" resultType="io.metersphere.base.domain.TestCase">

View File

@ -93,6 +93,7 @@
</el-drawer>
</div>
</el-card>
</div>
</template>
@ -107,6 +108,7 @@ import MsTableMoreBtn from "./TableMoreBtn";
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns";
import MsTestPlanList from "./testplan/TestPlanList";
import MsTableSelectAll from "../../../common/components/table/MsTableSelectAll";
import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
export default {
name: "MsApiScenarioList",
@ -135,7 +137,9 @@ export default {
data() {
return {
loading: false,
condition: {},
condition: {
components: API_CASE_CONFIGS
},
currentScenario: {},
schedule: {},
selection: [],
@ -226,7 +230,6 @@ export default {
break;
}
this.selection = [];
this.selectAll = false;
this.unSelection = [];
this.selectDataCounts = 0;

View File

@ -3,6 +3,7 @@
<api-list-container
:is-api-list-enable="isApiListEnable"
@isApiListEnableChange="isApiListEnableChange">
<el-link type="primary" style="float:right;margin-top: 5px" @click="open">{{$t('commons.adv_search.title')}}</el-link>
<el-input placeholder="搜索" @blur="search" @keyup.enter.native="search" class="search-input" size="small"
v-model="condition.name"/>
@ -89,6 +90,9 @@
<ms-set-environment ref="setEnvironment" :testCase="clickRow" @createPerformance="createPerformance"/>
<!--查看引用-->
<ms-reference-view ref="viewRef"/>
<!--高级搜索-->
<ms-table-adv-search-bar :condition.sync="condition" :showLink="false" ref="searchBar" @search="initTable"/>
</div>
</template>
@ -120,6 +124,8 @@ import TestPlan from "@/business/components/api/definition/components/jmeter/com
import ThreadGroup from "@/business/components/api/definition/components/jmeter/components/thread-group";
import {parseEnvironment} from "@/business/components/api/test/model/EnvironmentModel";
import MsTableSelectAll from "../../../../common/components/table/MsTableSelectAll";
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
export default {
name: "ApiCaseSimpleList",
@ -140,10 +146,13 @@ export default {
MsBatchEdit,
MsApiCaseTableExtendBtns,
MsReferenceView,
MsTableAdvSearchBar
},
data() {
return {
condition: {},
condition: {
components: API_CASE_CONFIGS
},
selectCase: {},
result: {},
moduleId: "",
@ -275,7 +284,6 @@ export default {
this.condition.id = selectParamArr[1];
}
}
if (this.condition.projectId) {
this.result = this.$post('/api/testcase/list/' + this.currentPage + "/" + this.pageSize, this.condition, response => {
this.total = response.data.itemCount;
@ -284,12 +292,9 @@ export default {
});
}
},
// getMaintainerOptions() {
// let workspaceId = localStorage.getItem(WORKSPACE_ID);
// this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
// this.valueArr.userId = response.data;
// });
// },
open() {
this.$refs.searchBar.open();
},
handleSelect(selection, row) {
_handleSelect(this, selection, row, this.selectRows);
this.selectRowsCount(this.selectRows)
@ -561,7 +566,7 @@ export default {
float: right;
width: 300px;
/*margin-bottom: 20px;*/
margin-right: 20px;
margin-right: 10px;
}
.ms-select-all >>> th:first-child {

View File

@ -410,7 +410,7 @@ export const TEST_CONFIGS = [NAME, UPDATE_TIME, CREATE_TIME, STATUS, CREATOR];
export const REPORT_CONFIGS = [NAME, TEST_NAME, CREATE_TIME, STATUS, CREATOR, TRIGGER_MODE];
export const TEST_CASE_CONFIGS = [NAME, MODULE, PRIORITY, CREATE_TIME, TYPE, UPDATE_TIME, METHOD, CREATOR, EXECUTOR];
export const TEST_CASE_CONFIGS = [NAME, API_TAGS, MODULE, PRIORITY, CREATE_TIME, TYPE, UPDATE_TIME, METHOD, CREATOR, EXECUTOR];
export const TEST_PLAN_CONFIGS = [NAME, UPDATE_TIME, CREATE_TIME, PRINCIPAL, TEST_PLAN_STATUS, STAGE];