测试列表按照名称搜索

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;
import io.metersphere.controller.request.testplan.QueryTestPlanRequest;
import io.metersphere.dto.LoadTestDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
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"/>
</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
from load_test
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>
</mapper>

View File

@ -1,4 +1,15 @@
package io.metersphere.controller.request.testplan;
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) {
return extLoadTestMapper.list(null);
return extLoadTestMapper.list(request);
}
public void delete(DeleteTestPlanRequest request) {

View File

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