测试列表按照名称搜索

This commit is contained in:
haifeng414 2020-02-17 16:55:33 +08:00
parent 25a8ca4604
commit a5de8cebbb
5 changed files with 29 additions and 8 deletions

View File

@ -1,10 +1,11 @@
package io.metersphere.base.mapper.ext; package io.metersphere.base.mapper.ext;
import io.metersphere.controller.request.testplan.QueryTestPlanRequest;
import io.metersphere.dto.LoadTestDTO; import io.metersphere.dto.LoadTestDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
public interface ExtLoadTestMapper { public interface ExtLoadTestMapper {
List<LoadTestDTO> list(Map<String, Object> params); List<LoadTestDTO> list(@Param("request") QueryTestPlanRequest params);
} }

View File

@ -7,10 +7,15 @@
<result column="project_name" property="projectName"/> <result column="project_name" property="projectName"/>
</resultMap> </resultMap>
<select id="list" resultMap="BaseResultMap"> <select id="list" resultMap="BaseResultMap" parameterType="io.metersphere.controller.request.testplan.QueryTestPlanRequest">
select load_test.*, project.name as project_name select load_test.*, project.name as project_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
<where>
<if test="request.name != null">
and load_test.name like CONCAT('%', #{request.name},'%')
</if>
</where>
</select> </select>
</mapper> </mapper>

View File

@ -1,4 +1,15 @@
package io.metersphere.controller.request.testplan; package io.metersphere.controller.request.testplan;
public class QueryTestPlanRequest extends TestPlanRequest { public class QueryTestPlanRequest extends TestPlanRequest {
private String name;
@Override
public String getName() {
return name;
}
@Override
public void setName(String name) {
this.name = name;
}
} }

View File

@ -63,7 +63,7 @@ public class LoadTestService {
} }
public List<LoadTestDTO> list(QueryTestPlanRequest request) { public List<LoadTestDTO> list(QueryTestPlanRequest request) {
return extLoadTestMapper.list(null); return extLoadTestMapper.list(request);
} }
public void delete(DeleteTestPlanRequest request) { public void delete(DeleteTestPlanRequest request) {

View File

@ -6,8 +6,8 @@
<el-row type="flex" justify="space-between" align="middle"> <el-row type="flex" justify="space-between" align="middle">
<span class="title">测试</span> <span class="title">测试</span>
<span class="search"> <span class="search">
<el-input type="text" size="small" placeholder="根据ID名称搜索" prefix-icon="el-icon-search" maxlength="60" <el-input type="text" size="small" placeholder="根据名称搜索" prefix-icon="el-icon-search" maxlength="60"
v-model="condition" clearable/> v-model="condition" @change="search" clearable/>
</span> </span>
</el-row> </el-row>
</div> </div>
@ -97,8 +97,9 @@
}, },
methods: { methods: {
initTableData() { initTableData() {
/// todo: let param = {
let param = {}; name: this.condition
};
this.$post(this.buildPagePath(this.queryPath), param).then(response => { this.$post(this.buildPagePath(this.queryPath), param).then(response => {
if (response.data.success) { if (response.data.success) {
@ -110,6 +111,9 @@
} }
}) })
}, },
search() {
this.initTableData();
},
buildPagePath(path) { buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize; return path + "/" + this.currentPage + "/" + this.pageSize;
}, },