From 4002924c0b256144b9311bbc7980753a32fcc412 Mon Sep 17 00:00:00 2001 From: caofengbin <1050430934@qq.com> Date: Wed, 20 Dec 2023 14:58:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E6=94=AF=E6=8C=81=E6=9F=A5=E8=AF=A2=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=EF=BC=8C=E6=8C=87=E5=AE=9A=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E4=B8=8B=EF=BC=8C=E6=89=80=E6=9C=89=E7=9A=84=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E4=BD=9C=E8=80=85=E5=88=97=E8=A1=A8=E9=9B=86=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TestCasesController.java | 15 +++++++++++++++ .../sonic/controller/mapper/TestCasesMapper.java | 3 +++ .../controller/services/TestCasesService.java | 9 +++++++++ .../services/impl/TestCasesServiceImpl.java | 5 +++++ 4 files changed, 32 insertions(+) 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..3f27e715 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 @@ -167,4 +167,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..9276f17b 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 @@ -41,4 +41,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..173436de 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 @@ -286,5 +286,10 @@ public Boolean updateTestCaseModuleByModuleId(Integer module) { } return true; } + + @Override + public List findAllCaseAuthor(int projectId, int platform) { + return testCasesMapper.listAllTestCaseAuthor(projectId, platform); + } } From 9ffd9358d8d15cdce1973923cb95d91d41edfdc7 Mon Sep 17 00:00:00 2001 From: caofengbin <1050430934@qq.com> Date: Wed, 20 Dec 2023 15:04:48 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=94=A8=E4=BE=8B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=8C=89=E4=BD=9C=E8=80=85=E8=BF=9B=E8=A1=8C=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E7=9A=84=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/controller/TestCasesController.java | 7 ++++--- .../sonic/controller/services/TestCasesService.java | 5 +++-- .../services/impl/TestCasesServiceImpl.java | 12 +++++++----- 3 files changed, 14 insertions(+), 10 deletions(-) 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 3f27e715..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) ); } 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 9276f17b..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); 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 173436de..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);