Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:用例支持按作者进行筛选的操作 #396

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
用例支持按作者进行筛选的操作
caofengbin committed Dec 20, 2023

Verified

This commit was signed with the committer’s verified signature.
rfratto Robert Fratto
commit 9ffd9358d8d15cdce1973923cb95d91d41edfdc7
Original file line number Diff line number Diff line change
@@ -59,10 +59,10 @@ public class TestCasesController {
@Parameter(name = "platform", description = "平台类型"),
@Parameter(name = "name", description = "用例名称"),
@Parameter(name = "moduleIds", description = "模块Id"),
@Parameter(name = "caseAuthorNames", description = "用例作者列表"),
@Parameter(name = "page", description = "页码"),
@Parameter(name = "pageSize", description = "页数据大小"),
@Parameter(name = "idSort", description = "控制id排序方式"),
@Parameter(name = "designerSort", description = "控制designer排序方式"),
@Parameter(name = "editTimeSort", description = "控制editTime排序方式")

})
@@ -71,15 +71,16 @@ public RespModel<CommentPage<TestCasesDTO>> findAll(@RequestParam(name = "projec
@RequestParam(name = "platform") int platform,
@RequestParam(name = "name", required = false) String name,
@RequestParam(name = "moduleIds[]", required = false) List<Integer> moduleIds,
@RequestParam(name = "caseAuthorNames[]", required = false) List<String> caseAuthorNames,
@RequestParam(name = "page") int page,
@RequestParam(name = "pageSize") int pageSize,
@RequestParam(name = "idSort", required = false) String idSort,
@RequestParam(value = "designerSort", required = false) String designerSort,
@RequestParam(value = "editTimeSort", required = false) String editTimeSort) {
Page<TestCases> pageable = new Page<>(page, pageSize);
return new RespModel<>(
RespEnum.SEARCH_OK,
testCasesService.findAll(projectId, platform, name, moduleIds, pageable, idSort, designerSort, editTimeSort)
testCasesService.findAll(projectId, platform, name, moduleIds, caseAuthorNames,
pageable, idSort, editTimeSort)
);
}

Original file line number Diff line number Diff line change
@@ -15,8 +15,9 @@
* @date 2021/8/20 17:51
*/
public interface TestCasesService extends IService<TestCases> {
CommentPage<TestCasesDTO> findAll(int projectId, int platform, String name, List<Integer> moduleIds, Page<TestCases> pageable,
String idSort, String designerSort, String editTimeSort);
CommentPage<TestCasesDTO> findAll(int projectId, int platform, String name, List<Integer> moduleIds,
List<String> caseAuthorNames, Page<TestCases> pageable,
String idSort, String editTimeSort);

List<TestCases> findAll(int projectId, int platform);

Original file line number Diff line number Diff line change
@@ -66,20 +66,22 @@ public class TestCasesServiceImpl extends SonicServiceImpl<TestCasesMapper, Test
private ModulesMapper modulesMapper;

@Override
public CommentPage<TestCasesDTO> findAll(int projectId, int platform, String name, List<Integer> moduleIds, Page<TestCases> pageable,
String idSort, String designerSort, String editTimeSort) {
public CommentPage<TestCasesDTO> findAll(int projectId, int platform, String name, List<Integer> moduleIds,
List<String> caseAuthorNames,
Page<TestCases> pageable,
String idSort, String editTimeSort) {

LambdaQueryChainWrapper<TestCases> lambdaQuery = lambdaQuery();

lambdaQuery.eq(projectId != 0, TestCases::getProjectId, projectId)
.eq(platform != 0, TestCases::getPlatform, platform)
.in(moduleIds != null && moduleIds.size() > 0, TestCases::getModuleId, moduleIds)
.in(caseAuthorNames != null && caseAuthorNames.size() > 0, TestCases::getDesigner, caseAuthorNames)
.like(!StringUtils.isEmpty(name), TestCases::getName, name)
.orderByDesc(StringUtils.isEmpty(editTimeSort) && StringUtils.isEmpty(idSort) && StringUtils.isEmpty(designerSort),
.orderByDesc(StringUtils.isEmpty(editTimeSort) && StringUtils.isEmpty(idSort),
TestCases::getEditTime)
.orderBy(!StringUtils.isEmpty(editTimeSort), "asc".equals(editTimeSort), TestCases::getEditTime)
.orderBy(!StringUtils.isEmpty(idSort), "asc".equals(idSort), TestCases::getId)
.orderBy(!StringUtils.isEmpty(designerSort), "asc".equals(designerSort), TestCases::getDesigner);
.orderBy(!StringUtils.isEmpty(idSort), "asc".equals(idSort), TestCases::getId);

//写入对应模块信息
Page<TestCases> page = lambdaQuery.page(pageable);