From a56a3b15826ab19cc68a91ff714de85f48e14969 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Mon, 2 Dec 2024 11:59:10 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=B7=A5=E4=BD=9C=E5=8F=B0):=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=A0=B9=E6=8D=AE=E9=A1=B9=E7=9B=AEid=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E8=AE=A1=E5=88=92=E7=BB=84=E4=B8=8E=E5=AD=90=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E5=8F=8A=E8=81=94=E5=85=B3=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migration/3.6.0/ddl/V3.6.0_1__init.sql | 1 + .../migration/3.6.0/ddl/V3.6.0_2__ga_ddl.sql | 8 ++ .../migration/3.6.0/dml/V3.6.0_2_1__data.sql | 6 ++ .../controller/DashboardController.java | 8 ++ .../metersphere/dashboard/dto/CascadeDTO.java | 23 ++++++ .../response/CascadeChildrenDTO.java | 26 +++++++ .../dashboard/service/DashboardService.java | 73 ++++++++++++++----- .../DashboardFrontPageControllerTests.java | 20 +++++ .../src/test/resources/dml/init_dashboard.sql | 8 ++ .../plan/dto/TestPlanAndGroupInfoDTO.java | 21 ++++++ .../plan/mapper/ExtTestPlanMapper.java | 7 ++ .../plan/mapper/ExtTestPlanMapper.xml | 7 ++ 12 files changed, 189 insertions(+), 19 deletions(-) create mode 100644 backend/framework/domain/src/main/resources/migration/3.6.0/ddl/V3.6.0_1__init.sql create mode 100644 backend/framework/domain/src/main/resources/migration/3.6.0/ddl/V3.6.0_2__ga_ddl.sql create mode 100644 backend/framework/domain/src/main/resources/migration/3.6.0/dml/V3.6.0_2_1__data.sql create mode 100644 backend/services/dashboard/src/main/java/io/metersphere/dashboard/dto/CascadeDTO.java create mode 100644 backend/services/dashboard/src/main/java/io/metersphere/dashboard/response/CascadeChildrenDTO.java create mode 100644 backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanAndGroupInfoDTO.java diff --git a/backend/framework/domain/src/main/resources/migration/3.6.0/ddl/V3.6.0_1__init.sql b/backend/framework/domain/src/main/resources/migration/3.6.0/ddl/V3.6.0_1__init.sql new file mode 100644 index 0000000000..d3fec9ab66 --- /dev/null +++ b/backend/framework/domain/src/main/resources/migration/3.6.0/ddl/V3.6.0_1__init.sql @@ -0,0 +1 @@ +select database(); \ No newline at end of file diff --git a/backend/framework/domain/src/main/resources/migration/3.6.0/ddl/V3.6.0_2__ga_ddl.sql b/backend/framework/domain/src/main/resources/migration/3.6.0/ddl/V3.6.0_2__ga_ddl.sql new file mode 100644 index 0000000000..ffeb83f45a --- /dev/null +++ b/backend/framework/domain/src/main/resources/migration/3.6.0/ddl/V3.6.0_2__ga_ddl.sql @@ -0,0 +1,8 @@ +-- set innodb lock wait timeout +SET SESSION innodb_lock_wait_timeout = 7200; + +CREATE INDEX idx_type_project_id + ON test_plan (type, project_id); + +-- set innodb lock wait timeout to default +SET SESSION innodb_lock_wait_timeout = DEFAULT; diff --git a/backend/framework/domain/src/main/resources/migration/3.6.0/dml/V3.6.0_2_1__data.sql b/backend/framework/domain/src/main/resources/migration/3.6.0/dml/V3.6.0_2_1__data.sql new file mode 100644 index 0000000000..82dc8ebdbc --- /dev/null +++ b/backend/framework/domain/src/main/resources/migration/3.6.0/dml/V3.6.0_2_1__data.sql @@ -0,0 +1,6 @@ +-- set innodb lock wait timeout +SET SESSION innodb_lock_wait_timeout = 7200; + + +-- set innodb lock wait timeout to default +SET SESSION innodb_lock_wait_timeout = DEFAULT; \ No newline at end of file diff --git a/backend/services/dashboard/src/main/java/io/metersphere/dashboard/controller/DashboardController.java b/backend/services/dashboard/src/main/java/io/metersphere/dashboard/controller/DashboardController.java index 49fcd6b94d..f714141930 100644 --- a/backend/services/dashboard/src/main/java/io/metersphere/dashboard/controller/DashboardController.java +++ b/backend/services/dashboard/src/main/java/io/metersphere/dashboard/controller/DashboardController.java @@ -8,6 +8,7 @@ import io.metersphere.bug.service.BugCommonService; import io.metersphere.bug.service.BugService; import io.metersphere.dashboard.dto.LayoutDTO; import io.metersphere.dashboard.request.DashboardFrontPageRequest; +import io.metersphere.dashboard.response.CascadeChildrenDTO; import io.metersphere.dashboard.response.OverViewCountDTO; import io.metersphere.dashboard.response.StatisticsDTO; import io.metersphere.dashboard.service.DashboardService; @@ -215,4 +216,11 @@ public class DashboardController { return bugService.getHeaderOption(projectId); } + @GetMapping("/plan/option/{projectId}") + @Operation(summary = "获取测试计划列表") + @CheckOwner(resourceId = "#projectId", resourceType = "project") + public List getPlanOption(@PathVariable String projectId) { + return dashboardService.getPlanOption(projectId); + } + } diff --git a/backend/services/dashboard/src/main/java/io/metersphere/dashboard/dto/CascadeDTO.java b/backend/services/dashboard/src/main/java/io/metersphere/dashboard/dto/CascadeDTO.java new file mode 100644 index 0000000000..4363523d04 --- /dev/null +++ b/backend/services/dashboard/src/main/java/io/metersphere/dashboard/dto/CascadeDTO.java @@ -0,0 +1,23 @@ +package io.metersphere.dashboard.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serial; +import java.io.Serializable; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class CascadeDTO implements Serializable { + @Serial + private static final long serialVersionUID = 1L; + + @Schema(description = "值/id") + private String value; + @Schema(description = "名称/标签") + private String label; + +} diff --git a/backend/services/dashboard/src/main/java/io/metersphere/dashboard/response/CascadeChildrenDTO.java b/backend/services/dashboard/src/main/java/io/metersphere/dashboard/response/CascadeChildrenDTO.java new file mode 100644 index 0000000000..77833eb3e2 --- /dev/null +++ b/backend/services/dashboard/src/main/java/io/metersphere/dashboard/response/CascadeChildrenDTO.java @@ -0,0 +1,26 @@ +package io.metersphere.dashboard.response; + + +import io.metersphere.dashboard.dto.CascadeDTO; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class CascadeChildrenDTO { + + @Schema(description = "值/id") + private String value; + + @Schema(description = "名称/标签") + private String label; + + @Schema(description = "关联子集") + private List children; + +} diff --git a/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java b/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java index 3eb878aed2..5bb2d38e2e 100644 --- a/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java +++ b/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java @@ -18,11 +18,9 @@ import io.metersphere.bug.mapper.ExtBugMapper; import io.metersphere.bug.service.BugCommonService; import io.metersphere.bug.service.BugStatusService; import io.metersphere.dashboard.constants.DashboardUserLayoutKeys; -import io.metersphere.dashboard.dto.LayoutDTO; -import io.metersphere.dashboard.dto.NameArrayDTO; -import io.metersphere.dashboard.dto.NameCountDTO; -import io.metersphere.dashboard.dto.StatusPercentDTO; +import io.metersphere.dashboard.dto.*; import io.metersphere.dashboard.request.DashboardFrontPageRequest; +import io.metersphere.dashboard.response.CascadeChildrenDTO; import io.metersphere.dashboard.response.OverViewCountDTO; import io.metersphere.dashboard.response.StatisticsDTO; import io.metersphere.functional.constants.CaseReviewStatus; @@ -33,7 +31,11 @@ import io.metersphere.functional.mapper.ExtCaseReviewMapper; import io.metersphere.functional.mapper.ExtFunctionalCaseMapper; import io.metersphere.functional.request.CaseReviewPageRequest; import io.metersphere.functional.service.CaseReviewService; +import io.metersphere.plan.domain.TestPlan; +import io.metersphere.plan.domain.TestPlanExample; +import io.metersphere.plan.dto.TestPlanAndGroupInfoDTO; import io.metersphere.plan.mapper.ExtTestPlanMapper; +import io.metersphere.plan.mapper.TestPlanMapper; import io.metersphere.plugin.platform.dto.SelectOption; import io.metersphere.project.domain.Project; import io.metersphere.project.dto.ProjectCountDTO; @@ -120,6 +122,8 @@ public class DashboardService { @Resource private UserLayoutMapper userLayoutMapper; @Resource + private TestPlanMapper testPlanMapper; + @Resource private BugCommonService bugCommonService; @Resource private BugStatusService bugStatusService; @@ -258,7 +262,7 @@ public class DashboardService { map.put(BUG_COUNT, bugCount); projectBugCountMap = projectBugCount.stream().collect(Collectors.toMap(ProjectCountDTO::getProjectId, ProjectCountDTO::getCount)); - }else { + } else { projectBugCountMap = new HashMap<>(); } @@ -407,7 +411,7 @@ public class DashboardService { List orgProjectMemberList = extProjectMemberMapper.getOrgProjectMemberList(organizationId, null); if (CollectionUtils.isEmpty(userLayouts)) { List userIds = orgProjectMemberList.stream().map(ProjectUserMemberDTO::getId).distinct().toList(); - return getDefaultLayoutDTOS(allPermissionProjects.getFirst().getId(),userIds); + return getDefaultLayoutDTOS(allPermissionProjects.getFirst().getId(), userIds); } UserLayout userLayout = userLayouts.getFirst(); byte[] configuration = userLayout.getConfiguration(); @@ -501,10 +505,10 @@ public class DashboardService { /** * 获取默认布局 * - * @param projectId 项目ID + * @param projectId 项目ID * @return List */ - private static List getDefaultLayoutDTOS(String projectId, List userIds) { + private static List getDefaultLayoutDTOS(String projectId, List userIds) { List layoutDTOS = new ArrayList<>(); LayoutDTO projectLayoutDTO = buildDefaultLayoutDTO(DashboardUserLayoutKeys.PROJECT_VIEW, "workbench.homePage.projectOverview", 0, new ArrayList<>(), new ArrayList<>()); layoutDTOS.add(projectLayoutDTO); @@ -796,7 +800,7 @@ public class DashboardService { } long caseTestCount = extFunctionalCaseMapper.caseTestCount(projectId, null, null); long simpleCaseCount = extFunctionalCaseMapper.simpleCaseCount(projectId, null, null); - List coverList = getCoverList((int) simpleCaseCount,Translator.get("functional_case.associateRate"), (int) caseTestCount,Translator.get("functional_case.hasAssociate"), (int) (simpleCaseCount - caseTestCount), Translator.get("functional_case.unAssociate")); + List coverList = getCoverList((int) simpleCaseCount, Translator.get("functional_case.associateRate"), (int) caseTestCount, Translator.get("functional_case.hasAssociate"), (int) (simpleCaseCount - caseTestCount), Translator.get("functional_case.unAssociate")); Map> statusStatisticsMap = new HashMap<>(); statusStatisticsMap.put("cover", coverList); statisticsDTO.setStatusStatisticsMap(statusStatisticsMap); @@ -977,7 +981,7 @@ public class DashboardService { List statisticListByProjectId = extFunctionalCaseMapper.getStatisticListByProjectId(projectId, null, null); List unReviewCaseList = statisticListByProjectId.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getReviewStatus(), FunctionalCaseReviewStatus.UN_REVIEWED.toString())).toList(); int reviewCount = statisticListByProjectId.size() - unReviewCaseList.size(); - List coverList = getCoverList(statisticListByProjectId.size(), Translator.get("functional_case.reviewRate"), reviewCount,Translator.get("functional_case.hasReview"), unReviewCaseList.size(), Translator.get("functional_case.unReview")); + List coverList = getCoverList(statisticListByProjectId.size(), Translator.get("functional_case.reviewRate"), reviewCount, Translator.get("functional_case.hasReview"), unReviewCaseList.size(), Translator.get("functional_case.unReview")); Map> statusStatisticsMap = new HashMap<>(); statusStatisticsMap.put("cover", coverList); statisticsDTO.setStatusStatisticsMap(statusStatisticsMap); @@ -1061,10 +1065,10 @@ public class DashboardService { @NotNull private List getStatusPercentList(List statisticListByProjectId) { List statusPercentList = new ArrayList<>(); - ListstatusNameList = buildStatusNameMap(); + List statusNameList = buildStatusNameMap(); int totalCount = CollectionUtils.isEmpty(statisticListByProjectId) ? 0 : statisticListByProjectId.size(); Map> reviewStatusMap = statisticListByProjectId.stream().collect(Collectors.groupingBy(FunctionalCaseStatisticDTO::getReviewStatus)); - statusNameList.forEach(t->{ + statusNameList.forEach(t -> { StatusPercentDTO statusPercentDTO = new StatusPercentDTO(); List functionalCaseStatisticDTOS = reviewStatusMap.get(t.getId()); int count = CollectionUtils.isEmpty(functionalCaseStatisticDTOS) ? 0 : functionalCaseStatisticDTOS.size(); @@ -1082,14 +1086,14 @@ public class DashboardService { } @NotNull - private static List getCoverList(int totalCount, String rateName, int coverCount,String coverName, int unCoverCount, String unCoverName) { + private static List getCoverList(int totalCount, String rateName, int coverCount, String coverName, int unCoverCount, String unCoverName) { List coverList = new ArrayList<>(); NameCountDTO coverRate = new NameCountDTO(); if (totalCount > 0) { BigDecimal divide = BigDecimal.valueOf(coverCount).divide(BigDecimal.valueOf(totalCount), 2, RoundingMode.HALF_UP); coverRate.setCount(getTurnCount(divide)); } - coverRate.setName(rateName ); + coverRate.setName(rateName); coverList.add(coverRate); NameCountDTO hasCover = new NameCountDTO(); hasCover.setCount(coverCount); @@ -1103,7 +1107,7 @@ public class DashboardService { } private static List buildStatusNameMap() { - ListoptionDTOList = new ArrayList<>(); + List optionDTOList = new ArrayList<>(); optionDTOList.add(new OptionDTO(FunctionalCaseReviewStatus.UN_REVIEWED.toString(), Translator.get("case.review.status.un_reviewed"))); optionDTOList.add(new OptionDTO(FunctionalCaseReviewStatus.UNDER_REVIEWED.toString(), Translator.get("case.review.status.under_reviewed"))); optionDTOList.add(new OptionDTO(FunctionalCaseReviewStatus.PASS.toString(), Translator.get("case.review.status.pass"))); @@ -1308,7 +1312,7 @@ public class DashboardService { if (CollectionUtils.isNotEmpty(simpleAllApiScenarioList)) { simpleAllApiScenarioSize = simpleAllApiScenarioList.size(); } - List lastReportStatuList = new ArrayList<>(); + List lastReportStatuList = new ArrayList<>(); lastReportStatuList.add(StringUtils.EMPTY); lastReportStatuList.add(ExecStatus.PENDING.toString()); List unExecList = simpleAllApiScenarioList.stream().filter(t -> lastReportStatuList.contains(t.getLastReportStatus())).toList(); @@ -1341,7 +1345,7 @@ public class DashboardService { statisticsDTO.setErrorCode(NO_PROJECT_PERMISSION.getCode()); return statisticsDTO; } - SethandleUsers = new HashSet<>(); + Set handleUsers = new HashSet<>(); String localHandleUser = hasHandleUser ? userId : null; if (StringUtils.isNotBlank(localHandleUser)) { handleUsers.add(localHandleUser); @@ -1357,7 +1361,7 @@ public class DashboardService { if (hasHandleUser) { allSimpleList = extBugMapper.getByHandleUser(projectId, null, null, localHandleUser, createUser, handleUser, platformName); } else { - allSimpleList= extBugMapper.getSimpleList(projectId, null, null, handleUsers, createUser, platforms); + allSimpleList = extBugMapper.getSimpleList(projectId, null, null, handleUsers, createUser, platforms); } List localLastStepStatus = getBugEndStatus(projectId, platformName); List statusList = allSimpleList.stream().filter(t -> !localLastStepStatus.contains(t.getStatus())).toList(); @@ -1501,7 +1505,7 @@ public class DashboardService { headerStatusOption.addAll(thirdStatusOptions); } } - headerStatusOption = headerStatusOption.stream().filter(t->!endStatus.contains(t.getValue())).distinct().toList(); + headerStatusOption = headerStatusOption.stream().filter(t -> !endStatus.contains(t.getValue())).distinct().toList(); return headerStatusOption; } @@ -1512,6 +1516,37 @@ public class DashboardService { } return extSystemProjectMapper.getMemberByProjectId(projectId, keyword); } + + public List getPlanOption(String projectId) { + List cascadeDTOList = new ArrayList<>(); + List groupAndPlanInfo = extTestPlanMapper.getGroupAndPlanInfo(projectId); + TestPlanExample testPlanExample = new TestPlanExample(); + testPlanExample.createCriteria().andProjectIdEqualTo(projectId).andTypeEqualTo(TestPlanConstants.TEST_PLAN_TYPE_PLAN).andGroupIdEqualTo("NONE"); + List testPlans = testPlanMapper.selectByExample(testPlanExample); + Map> groupMap = groupAndPlanInfo.stream().collect(Collectors.groupingBy(TestPlanAndGroupInfoDTO::getGroupId)); + groupMap.forEach((t, list)->{ + CascadeChildrenDTO father = new CascadeChildrenDTO(); + father.setValue(t); + father.setLabel(list.getFirst().getGroupName()); + List children = new ArrayList<>(); + for (TestPlanAndGroupInfoDTO testPlanAndGroupInfoDTO : list) { + CascadeDTO cascadeChildrenDTO = new CascadeDTO(); + cascadeChildrenDTO.setValue(testPlanAndGroupInfoDTO.getId()); + cascadeChildrenDTO.setLabel(testPlanAndGroupInfoDTO.getName()); + children.add(cascadeChildrenDTO); + } + father.setChildren(children); + cascadeDTOList.add(father); + }); + for (TestPlan testPlan : testPlans) { + CascadeChildrenDTO father = new CascadeChildrenDTO(); + father.setValue(testPlan.getId()); + father.setLabel(testPlan.getName()); + cascadeDTOList.add(father); + } + return cascadeDTOList; + + } } diff --git a/backend/services/dashboard/src/test/java/io/metersphere/dashboard/controller/DashboardFrontPageControllerTests.java b/backend/services/dashboard/src/test/java/io/metersphere/dashboard/controller/DashboardFrontPageControllerTests.java index 17d49da82a..45c7ce6879 100644 --- a/backend/services/dashboard/src/test/java/io/metersphere/dashboard/controller/DashboardFrontPageControllerTests.java +++ b/backend/services/dashboard/src/test/java/io/metersphere/dashboard/controller/DashboardFrontPageControllerTests.java @@ -9,6 +9,7 @@ import io.metersphere.bug.service.BugStatusService; import io.metersphere.dashboard.constants.DashboardUserLayoutKeys; import io.metersphere.dashboard.dto.LayoutDTO; import io.metersphere.dashboard.request.DashboardFrontPageRequest; +import io.metersphere.dashboard.response.CascadeChildrenDTO; import io.metersphere.dashboard.response.OverViewCountDTO; import io.metersphere.dashboard.response.StatisticsDTO; import io.metersphere.dashboard.service.DashboardService; @@ -105,6 +106,9 @@ public class DashboardFrontPageControllerTests extends BaseTest { private static final String PROJECT_MEMBER_USER_LIST = "/dashboard/member/get-project-member/option/"; + private static final String PROJECT_PLAN_LIST = "/dashboard/plan/option/"; + + @Test @Order(1) @Sql(scripts = {"/dml/init_dashboard.sql"}, config = @SqlConfig(encoding = "utf-8", transactionMode = SqlConfig.TransactionMode.ISOLATED)) @@ -591,6 +595,22 @@ public class DashboardFrontPageControllerTests extends BaseTest { Assertions.assertNotNull(list); } + @Test + @Order(7) + public void testProjectPlanList() throws Exception { + MvcResult mvcResult = this.requestGetWithOkAndReturn(PROJECT_PLAN_LIST + DEFAULT_PROJECT_ID); + String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); + ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class); + List list = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), CascadeChildrenDTO.class); + Assertions.assertNotNull(list); + + mvcResult = this.requestGetWithOkAndReturn(PROJECT_MEMBER_USER_LIST + "id"); + returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); + resultHolder = JSON.parseObject(returnData, ResultHolder.class); + list = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), CascadeChildrenDTO.class); + Assertions.assertNotNull(list); + } + private void enableDefaultPlatformConfig() { ProjectApplication record = new ProjectApplication(); record.setTypeValue("true"); diff --git a/backend/services/dashboard/src/test/resources/dml/init_dashboard.sql b/backend/services/dashboard/src/test/resources/dml/init_dashboard.sql index e47f9dda00..4d93e4cdac 100644 --- a/backend/services/dashboard/src/test/resources/dml/init_dashboard.sql +++ b/backend/services/dashboard/src/test/resources/dml/init_dashboard.sql @@ -121,6 +121,14 @@ INSERT INTO test_plan(id, num, project_id, group_id, module_id, name, status, ty VALUE ('dashboard_test-plan-id', 500, '100001100001', 'NONE', 'case_plan_module', 'test_plan_associate_case_name_three', 'NOT_ARCHIVED', 'TEST_PLAN', null, UNIX_TIMESTAMP() * 1000,'admin', UNIX_TIMESTAMP() * 1000,'admin',UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, null); +INSERT INTO test_plan(id, num, project_id, group_id, module_id, name, status, type, tags, create_time, create_user, update_time, update_user, planned_start_time, planned_end_time, actual_start_time, actual_end_time, description) + VALUE ('dashboard_test-plan-id2', 500, '100001100001', 'dashboard_group-plan', 'case_plan_module', 'test_plan_name_three', 'NOT_ARCHIVED', 'TEST_PLAN', null, UNIX_TIMESTAMP() * 1000,'admin', + UNIX_TIMESTAMP() * 1000,'admin',UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, null); + +INSERT INTO test_plan(id, num, project_id, group_id, module_id, name, status, type, tags, create_time, create_user, update_time, update_user, planned_start_time, planned_end_time, actual_start_time, actual_end_time, description) + VALUE ('dashboard_group-plan', 500, '100001100001', 'NONE', 'case_plan_module', 'test_plan_group_name_three', 'NOT_ARCHIVED', 'GROUP', null, UNIX_TIMESTAMP() * 1000,'admin', + UNIX_TIMESTAMP() * 1000,'admin',UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, null); + INSERT INTO project_application (project_id, type, type_value) VALUES ('100001100001', 'BUG_SYNC_BUG_PLATFORM_CONFIG', '{"jiraKey":"TES","jiraBugTypeId":"10009"}'), ('100001100001', 'BUG_SYNC_PLATFORM_KEY', 'jira'), diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanAndGroupInfoDTO.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanAndGroupInfoDTO.java new file mode 100644 index 0000000000..2fbbc331d5 --- /dev/null +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanAndGroupInfoDTO.java @@ -0,0 +1,21 @@ +package io.metersphere.plan.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class TestPlanAndGroupInfoDTO { + @Schema(description = "计划id") + private String id; + @Schema(description = "计划名称") + private String name; + @Schema(description = "计划组ID") + private String groupId; + @Schema(description = "计划组名称") + private String groupName; + @Schema(description = "项目ID") + private String projectId; + +} diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanMapper.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanMapper.java index 002c72a857..f123adcf38 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanMapper.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanMapper.java @@ -1,6 +1,7 @@ package io.metersphere.plan.mapper; import io.metersphere.plan.domain.TestPlan; +import io.metersphere.plan.dto.TestPlanAndGroupInfoDTO; import io.metersphere.plan.dto.TestPlanExecuteHisDTO; import io.metersphere.plan.dto.TestPlanGroupCountDTO; import io.metersphere.plan.dto.TestPlanQueryConditions; @@ -97,4 +98,10 @@ public interface ExtTestPlanMapper { List getPlanBugList(@Param("projectId") String projectId, @Param("type") String type, @Param("platforms") List platform, @Param("statusList") List statusList); List selectIdAndStatusByProjectIdAndCreateTimeRangeAndType(@Param("projectId") String projectId, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("type") String testPlanTypePlan); + + /** + * @param projectId 项目 + * 获取项目下计划组和计划的名称 + */ + List getGroupAndPlanInfo(@Param("projectId") String projectId); } diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanMapper.xml b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanMapper.xml index 3a7a4c17fa..1a162218c9 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanMapper.xml +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanMapper.xml @@ -939,6 +939,13 @@ +