diff --git a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/controller/TestCasesController.java b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/controller/TestCasesController.java index 3afc3428..56be6e10 100644 --- a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/controller/TestCasesController.java +++ b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/controller/TestCasesController.java @@ -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> findAll(@RequestParam(name = "projec @RequestParam(name = "platform") int platform, @RequestParam(name = "name", required = false) String name, @RequestParam(name = "moduleIds[]", required = false) List moduleIds, + @RequestParam(name = "caseAuthorNames[]", required = false) List 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 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) ); } @@ -167,4 +168,19 @@ public RespModel copyTestById(@RequestParam(name = "id") Integer id) { testCasesService.copyTestById(id); return new RespModel<>(RespEnum.COPY_OK); } + + @WebAspect + @Operation(summary = "查询用例所有的作者列表", description = "查找对应项目id下对应平台的所有作者列表") + @Parameters(value = { + @Parameter(name = "projectId", description = "项目id"), + @Parameter(name = "platform", description = "平台类型"), + }) + @GetMapping("/listAllCaseAuthor") + public RespModel> findAllCaseAuthor(@RequestParam(name = "projectId") int projectId, + @RequestParam(name = "platform") int platform) { + return new RespModel<>( + RespEnum.SEARCH_OK, + testCasesService.findAllCaseAuthor(projectId, platform) + ); + } } diff --git a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/mapper/TestCasesMapper.java b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/mapper/TestCasesMapper.java index f0c55bfc..37f3b6b0 100644 --- a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/mapper/TestCasesMapper.java +++ b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/mapper/TestCasesMapper.java @@ -22,4 +22,7 @@ public interface TestCasesMapper extends BaseMapper { "where tstc.test_suites_id = #{suiteId} " + "order by tstc.sort asc") List listByTestSuitesId(@Param("suiteId") int suiteId); + + @Select("select DISTINCT designer from test_cases WHERE project_id= #{projectId} and platform= #{platform}") + List listAllTestCaseAuthor(@Param("projectId") int projectId, @Param("platform") int platform); } diff --git a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/services/TestCasesService.java b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/services/TestCasesService.java index 23078975..d3d7beba 100644 --- a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/services/TestCasesService.java +++ b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/services/TestCasesService.java @@ -15,8 +15,9 @@ * @date 2021/8/20 17:51 */ public interface TestCasesService extends IService { - CommentPage findAll(int projectId, int platform, String name, List moduleIds, Page pageable, - String idSort, String designerSort, String editTimeSort); + CommentPage findAll(int projectId, int platform, String name, List moduleIds, + List caseAuthorNames, Page pageable, + String idSort, String editTimeSort); List findAll(int projectId, int platform); @@ -41,4 +42,13 @@ CommentPage findAll(int projectId, int platform, String name, List boolean copyTestById(int id); Boolean updateTestCaseModuleByModuleId(Integer module); + + /** + * 查询指定项目,指定平台下,所有的用例作者列表集合 + * + * @param projectId 项目id + * @param platform 平台 + * @return 用例作者列表集合 + */ + List findAllCaseAuthor(int projectId, int platform); } diff --git a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/services/impl/TestCasesServiceImpl.java b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/services/impl/TestCasesServiceImpl.java index 0802319a..30d74683 100644 --- a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/services/impl/TestCasesServiceImpl.java +++ b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/services/impl/TestCasesServiceImpl.java @@ -66,20 +66,22 @@ public class TestCasesServiceImpl extends SonicServiceImpl findAll(int projectId, int platform, String name, List moduleIds, Page pageable, - String idSort, String designerSort, String editTimeSort) { + public CommentPage findAll(int projectId, int platform, String name, List moduleIds, + List caseAuthorNames, + Page pageable, + String idSort, String editTimeSort) { LambdaQueryChainWrapper 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 page = lambdaQuery.page(pageable); @@ -286,5 +288,10 @@ public Boolean updateTestCaseModuleByModuleId(Integer module) { } return true; } + + @Override + public List findAllCaseAuthor(int projectId, int platform) { + return testCasesMapper.listAllTestCaseAuthor(projectId, platform); + } }