project search
This commit is contained in:
parent
fe2e2e3e73
commit
8c546b7afa
|
@ -6,7 +6,9 @@ import io.metersphere.base.domain.Project;
|
|||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.controller.request.ProjectRequest;
|
||||
import io.metersphere.service.ProjectService;
|
||||
import io.metersphere.user.SessionUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -33,9 +35,10 @@ public class ProjectController {
|
|||
|
||||
@PostMapping("/list/{goPage}/{pageSize}")
|
||||
@RequiresRoles(RoleConstants.TEST_MANAGER)
|
||||
public Pager<List<Project>> getProjectList(@PathVariable int goPage, @PathVariable int pageSize) {
|
||||
public Pager<List<Project>> getProjectList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ProjectRequest request) {
|
||||
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, projectService.getProjectList());
|
||||
return PageUtils.setPageInfo(page, projectService.getProjectList(request));
|
||||
}
|
||||
|
||||
@GetMapping("/delete/{projectId}")
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package io.metersphere.controller.request;
|
||||
|
||||
public class ProjectRequest {
|
||||
private String workspaceId;
|
||||
|
||||
public String getWorkspaceId() {
|
||||
return workspaceId;
|
||||
}
|
||||
|
||||
public void setWorkspaceId(String workspaceId) {
|
||||
this.workspaceId = workspaceId;
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ import io.metersphere.base.domain.Project;
|
|||
import io.metersphere.base.domain.ProjectExample;
|
||||
import io.metersphere.base.mapper.ProjectMapper;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.controller.request.ProjectRequest;
|
||||
import io.metersphere.user.SessionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -40,9 +41,13 @@ public class ProjectService {
|
|||
return project;
|
||||
}
|
||||
|
||||
public List<Project> getProjectList() {
|
||||
// todo 查询条件设置
|
||||
return projectMapper.selectByExample(null);
|
||||
public List<Project> getProjectList(ProjectRequest request) {
|
||||
ProjectExample example = new ProjectExample();
|
||||
ProjectExample.Criteria criteria = example.createCriteria();
|
||||
if (StringUtils.isNotBlank(request.getWorkspaceId())) {
|
||||
criteria.andWorkspaceIdEqualTo(request.getWorkspaceId());
|
||||
}
|
||||
return projectMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
public void deleteProject(String projectId) {
|
||||
|
|
Loading…
Reference in New Issue