refactor: 使用前台传入的 project_id

This commit is contained in:
Captain.B 2021-06-18 21:53:02 +08:00 committed by 刘瑞斌
parent 6a3fd3de77
commit ffdc5afb0b
4 changed files with 0 additions and 30 deletions

View File

@ -46,12 +46,6 @@ public class ApiAutomationController {
@PostMapping("/list/{goPage}/{pageSize}")
@RequiresPermissions("PROJECT_API_SCENARIO:READ")
public Pager<List<ApiScenarioDTO>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiScenarioRequest request) {
if (StringUtils.isBlank(request.getProjectId())) {
List<String> sourceIds = SessionUtils.getUser().getUserGroups().stream().map(UserGroup::getSourceId).collect(Collectors.toList());
request.setFilters(new HashMap<String, List<String>>() {{
put("project_id", sourceIds);
}});
}
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, apiAutomationService.list(request));

View File

@ -87,12 +87,6 @@ public class ProjectController {
@PostMapping("/list/{goPage}/{pageSize}")
public Pager<List<ProjectDTO>> getProjectList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ProjectRequest request) {
if (StringUtils.isBlank(request.getProjectId())) {
List<String> sourceIds = SessionUtils.getUser().getUserGroups().stream().map(UserGroup::getSourceId).collect(Collectors.toList());
request.setFilters(new HashMap<String, List<String>>() {{
put("workspace_id", sourceIds);
}});
}
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, projectService.getProjectList(request));
}

View File

@ -39,12 +39,6 @@ public class PerformanceReportController {
@PostMapping("/recent/{count}")
@RequiresPermissions("PROJECT_PERFORMANCE_REPORT:READ")
public List<ReportDTO> recentProjects(@PathVariable int count, @RequestBody ReportRequest request) {
if (StringUtils.isBlank(request.getProjectId())) {
List<String> sourceIds = SessionUtils.getUser().getUserGroups().stream().map(UserGroup::getSourceId).collect(Collectors.toList());
request.setFilters(new HashMap<String, List<String>>() {{
put("project_id", sourceIds);
}});
}
// 最近 `count` 个项目
PageHelper.startPage(1, count);
return performanceReportService.getRecentReportList(request);
@ -53,12 +47,6 @@ public class PerformanceReportController {
@PostMapping("/list/all/{goPage}/{pageSize}")
@RequiresPermissions("PROJECT_PERFORMANCE_REPORT:READ")
public Pager<List<ReportDTO>> getReportList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ReportRequest request) {
if (StringUtils.isBlank(request.getProjectId())) {
List<String> sourceIds = SessionUtils.getUser().getUserGroups().stream().map(UserGroup::getSourceId).collect(Collectors.toList());
request.setFilters(new HashMap<String, List<String>>() {{
put("project_id", sourceIds);
}});
}
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, performanceReportService.getReportList(request));
}

View File

@ -56,12 +56,6 @@ public class PerformanceTestController {
@PostMapping("/list/{goPage}/{pageSize}")
@RequiresPermissions("PROJECT_PERFORMANCE_TEST:READ")
public Pager<List<LoadTestDTO>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestPlanRequest request) {
if (StringUtils.isBlank(request.getProjectId())) {
List<String> sourceIds = SessionUtils.getUser().getUserGroups().stream().map(UserGroup::getSourceId).collect(Collectors.toList());
request.setFilters(new HashMap<String, List<String>>() {{
put("project_id", sourceIds);
}});
}
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, performanceTestService.list(request));
}