This commit is contained in:
fit2-zhao 2021-01-11 14:45:33 +08:00
commit bcbc9e5a53
2 changed files with 45 additions and 23 deletions

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="io.metersphere.base.mapper.ext.ExtLoadTestMapper"> <mapper namespace="io.metersphere.base.mapper.ext.ExtLoadTestMapper">
<resultMap id="BaseResultMap" type="io.metersphere.dto.LoadTestDTO" <resultMap id="BaseResultMap" type="io.metersphere.dto.LoadTestDTO"
extends="io.metersphere.base.mapper.LoadTestMapper.BaseResultMap"> extends="io.metersphere.base.mapper.LoadTestMapper.BaseResultMap">
<result column="project_name" property="projectName"/> <result column="project_name" property="projectName"/>
@ -14,37 +13,37 @@
<sql id="combine"> <sql id="combine">
<if test='${condition}.name != null and (${name} == null or ${name} == "")'> <if test='${condition}.name != null and (${name} == null or ${name} == "")'>
and load_test.name AND load_test.name
<include refid="condition"> <include refid="condition">
<property name="object" value="${condition}.name"/> <property name="object" value="${condition}.name"/>
</include> </include>
</if> </if>
<if test="${condition}.updateTime != null"> <if test="${condition}.updateTime != null">
and load_test.update_time AND load_test.update_time
<include refid="condition"> <include refid="condition">
<property name="object" value="${condition}.updateTime"/> <property name="object" value="${condition}.updateTime"/>
</include> </include>
</if> </if>
<if test="${condition}.projectName != null"> <if test="${condition}.projectName != null">
and project.name AND project.name
<include refid="condition"> <include refid="condition">
<property name="object" value="${condition}.projectName"/> <property name="object" value="${condition}.projectName"/>
</include> </include>
</if> </if>
<if test="${condition}.createTime != null"> <if test="${condition}.createTime != null">
and load_test.create_time AND load_test.create_time
<include refid="condition"> <include refid="condition">
<property name="object" value="${condition}.createTime"/> <property name="object" value="${condition}.createTime"/>
</include> </include>
</if> </if>
<if test="${condition}.status != null"> <if test="${condition}.status != null">
and load_test.status AND load_test.status
<include refid="condition"> <include refid="condition">
<property name="object" value="${condition}.status"/> <property name="object" value="${condition}.status"/>
</include> </include>
</if> </if>
<if test="${condition}.creator != null"> <if test="${condition}.creator != null">
and load_test.user_id AND load_test.user_id
<include refid="condition"> <include refid="condition">
<property name="object" value="${condition}.creator"/> <property name="object" value="${condition}.creator"/>
</include> </include>
@ -53,10 +52,10 @@
<select id="list" resultMap="BaseResultMap" <select id="list" resultMap="BaseResultMap"
parameterType="io.metersphere.track.request.testplan.QueryTestPlanRequest"> 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
left join user on load_test.user_id = user.id LEFT JOIN user ON load_test.user_id = user.id
<where> <where>
<if test="request.combine != null"> <if test="request.combine != null">
<include refid="combine"> <include refid="combine">
@ -65,10 +64,10 @@
</include> </include>
</if> </if>
<if test="request.name != null"> <if test="request.name != null">
and load_test.name like CONCAT('%', #{request.name},'%') and load_test.name LIKE CONCAT('%', #{request.name}, '%')
</if> </if>
<if test="request.userId != null"> <if test="request.userId != null">
and load_test.user_id= #{request.userId} AND load_test.user_id = #{request.userId}
</if> </if>
<if test="request.workspaceId != null"> <if test="request.workspaceId != null">
AND project.workspace_id = #{request.workspaceId} AND project.workspace_id = #{request.workspaceId}
@ -82,16 +81,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 load_test.status in <choose>
<when test="key == 'status'">
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>
</when>
<when test="key == 'user_id'">
AND load_test.user_id IN
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if> </if>
</foreach> </foreach>
</if> </if>
</where> </where>
<if test="request.orders != null and request.orders.size() > 0"> <if test="request.orders != null and request.orders.size() > 0">
order by ORDER BY
<foreach collection="request.orders" separator="," item="order"> <foreach collection="request.orders" separator="," item="order">
load_test.${order.name} ${order.type} load_test.${order.name} ${order.type}
</foreach> </foreach>

View File

@ -27,6 +27,9 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="userName" prop="userName"
sortable="custom"
:filters="userFilters"
column-key="user_id"
:label="$t('load_test.user_name')" :label="$t('load_test.user_name')"
width="150" width="150"
show-overflow-tooltip> show-overflow-tooltip>
@ -80,11 +83,11 @@ import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer"; import MsMainContainer from "../../common/components/MsMainContainer";
import MsPerformanceTestStatus from "./PerformanceTestStatus"; import MsPerformanceTestStatus from "./PerformanceTestStatus";
import MsTableOperators from "../../common/components/MsTableOperators"; import MsTableOperators from "../../common/components/MsTableOperators";
import {_filter, _sort} from "@/common/js/utils"; import {_filter, _sort, getCurrentProjectID} from "@/common/js/utils";
import MsTableHeader from "../../common/components/MsTableHeader"; import MsTableHeader from "../../common/components/MsTableHeader";
import {TEST_CONFIGS} from "../../common/components/search/search-components"; import {TEST_CONFIGS} from "../../common/components/search/search-components";
import {LIST_CHANGE, PerformanceEvent} from "@/business/components/common/head/ListEvent"; import {LIST_CHANGE, PerformanceEvent} from "@/business/components/common/head/ListEvent";
import {getCurrentProjectID} from "../../../../common/js/utils"; import {WORKSPACE_ID} from "@/common/js/constants";
export default { export default {
components: { components: {
@ -131,7 +134,8 @@ export default {
{text: 'Reporting', value: 'Reporting'}, {text: 'Reporting', value: 'Reporting'},
{text: 'Completed', value: 'Completed'}, {text: 'Completed', value: 'Completed'},
{text: 'Error', value: 'Error'} {text: 'Error', value: 'Error'}
] ],
userFilters: [],
} }
}, },
watch: { watch: {
@ -143,8 +147,17 @@ export default {
created: function () { created: function () {
this.projectId = this.$route.params.projectId; this.projectId = this.$route.params.projectId;
this.initTableData(); this.initTableData();
this.getMaintainerOptions();
}, },
methods: { methods: {
getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
this.userFilters = response.data.map(u => {
return {text: u.name, value: u.id}
});
});
},
initTableData() { initTableData() {
if (this.projectId !== 'all') { if (this.projectId !== 'all') {
this.condition.projectId = this.projectId; this.condition.projectId = this.projectId;