refactor(接口测试): 优化接口列表默认排序

This commit is contained in:
wxg0103 2024-04-24 16:37:00 +08:00 committed by 刘瑞斌
parent d3c490fa61
commit 57b59bda49
3 changed files with 4 additions and 4 deletions

View File

@ -131,7 +131,7 @@ public class ApiDefinitionController {
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
public Pager<List<ApiDefinitionDTO>> getPage(@Validated @RequestBody ApiDefinitionPageRequest request) {
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : request.getDeleted() ? "delete_time desc" : "pos desc");
StringUtils.isNotBlank(request.getSortString("id")) ? request.getSortString("id") : request.getDeleted() ? "delete_time desc, id desc" : "pos desc, id desc");
return PageUtils.setPageInfo(page, apiDefinitionService.getApiDefinitionPage(request, SessionUtils.getUserId()));
}

View File

@ -155,7 +155,7 @@ public class ApiTestCaseController {
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
public Pager<List<ApiTestCaseDTO>> page(@Validated @RequestBody ApiTestCasePageRequest request) {
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "pos desc");
StringUtils.isNotBlank(request.getSortString("id")) ? request.getSortString("id") : "pos desc, id desc");
return PageUtils.setPageInfo(page, apiTestCaseService.page(request, false));
}
@ -197,7 +197,7 @@ public class ApiTestCaseController {
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
public Pager<List<ApiTestCaseDTO>> pageTrash(@Validated @RequestBody ApiTestCasePageRequest request) {
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "delete_time desc");
StringUtils.isNotBlank(request.getSortString("id")) ? request.getSortString("id") : "delete_time desc, id desc");
return PageUtils.setPageInfo(page, apiTestCaseService.page(request, true));
}

View File

@ -68,7 +68,7 @@ public class ApiScenarioController {
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
public Pager<List<ApiScenarioDTO>> getTrashPage(@Validated @RequestBody ApiScenarioPageRequest request) {
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "delete_time desc");
StringUtils.isNotBlank(request.getSortString("id")) ? request.getSortString("id") : "delete_time desc, id desc");
request.setDeleted(true);
return PageUtils.setPageInfo(page, apiScenarioService.getScenarioPage(request));
}