部分查询
This commit is contained in:
parent
ed9d972bee
commit
2d17d227eb
|
@ -7,9 +7,14 @@
|
||||||
p.create_time, w.id as workspaceId, w.name as workspaceName
|
p.create_time, w.id as workspaceId, w.name as workspaceName
|
||||||
from project p
|
from project p
|
||||||
join workspace w on p.workspace_id = w.id
|
join workspace w on p.workspace_id = w.id
|
||||||
<if test="proRequest.workspaceId != null">
|
<where>
|
||||||
where w.id = #{proRequest.workspaceId}
|
<if test="proRequest.name != ''">
|
||||||
|
and p.name like #{proRequest.name, jdbcType=VARCHAR}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="proRequest.workspaceId != null">
|
||||||
|
and w.id = #{proRequest.workspaceId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -2,6 +2,15 @@ package io.metersphere.controller.request;
|
||||||
|
|
||||||
public class ProjectRequest {
|
public class ProjectRequest {
|
||||||
private String workspaceId;
|
private String workspaceId;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
public String getWorkspaceId() {
|
public String getWorkspaceId() {
|
||||||
return workspaceId;
|
return workspaceId;
|
||||||
|
|
|
@ -47,6 +47,9 @@ public class ProjectService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ProjectDTO> getProjectList(ProjectRequest request) {
|
public List<ProjectDTO> getProjectList(ProjectRequest request) {
|
||||||
|
if (StringUtils.isNotBlank(request.getName())) {
|
||||||
|
request.setName(StringUtils.wrapIfMissing(request.getName(), "%"));
|
||||||
|
}
|
||||||
return extProjectMapper.getProjectWithWorkspace(request);
|
return extProjectMapper.getProjectWithWorkspace(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
<span class="search">
|
<span class="search">
|
||||||
<el-input type="text" size="small" :placeholder="$t('project.search_by_name')"
|
<el-input type="text" size="small" :placeholder="$t('project.search_by_name')"
|
||||||
prefix-icon="el-icon-search"
|
prefix-icon="el-icon-search"
|
||||||
|
@change="search"
|
||||||
maxlength="60" v-model="condition" clearable/>
|
maxlength="60" v-model="condition" clearable/>
|
||||||
</span>
|
</span>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
@ -172,9 +173,12 @@
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
search() {
|
||||||
|
this.list();
|
||||||
|
},
|
||||||
list() {
|
list() {
|
||||||
let url = "/project/list/" + this.currentPage + '/' + this.pageSize;
|
let url = "/project/list/" + this.currentPage + '/' + this.pageSize;
|
||||||
this.result = this.$post(url, {}, (response) => {
|
this.result = this.$post(url, {name: this.condition}, (response) => {
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
this.items = data.listObject;
|
this.items = data.listObject;
|
||||||
this.total = data.itemCount;
|
this.total = data.itemCount;
|
||||||
|
|
Loading…
Reference in New Issue