diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/controller/BugController.java b/backend/services/bug-management/src/main/java/io/metersphere/bug/controller/BugController.java index 7b965813dc..76d1f94c51 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/controller/BugController.java +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/controller/BugController.java @@ -93,7 +93,7 @@ public class BugController { @CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project") public Pager> page(@Validated @RequestBody BugPageRequest request) { request.setUseTrash(false); - if (request.getRelatedToPlan() || request.getCreateByMe() || request.getAssignedToMe() || request.getUnresolved()) { + if (request.getBoardCount() || request.getRelatedToPlan() || request.getCreateByMe() || request.getAssignedToMe() || request.getUnresolved()) { request.setTodoParam(bugService.buildBugToDoParam(request, SessionUtils.getUserId(), SessionUtils.getCurrentOrganizationId())); } Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/dto/request/BugPageRequest.java b/backend/services/bug-management/src/main/java/io/metersphere/bug/dto/request/BugPageRequest.java index a4f1290773..e6f5a0196c 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/dto/request/BugPageRequest.java +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/dto/request/BugPageRequest.java @@ -32,6 +32,9 @@ public class BugPageRequest extends BasePageRequest { @Schema(description = "工作台参数: 是否待我处理的") private Boolean assignedToMe = false; + @Schema(description = "工作台参数: 缺陷数") + private Boolean boardCount = false; + @Schema(description = "工作台参数: 是否遗留的") private Boolean unresolved = false; } diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.xml b/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.xml index 4c1addd243..e7103e38ac 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.xml +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.xml @@ -202,8 +202,11 @@ and b.id in ( - select distinct b.id from bug b inner join bug_relation_case brc on b.id = brc.bug_id - where brc.test_plan_id is not null and b.project_id = #{request.projectId} + select distinct bug.id + from test_plan + left join bug_relation_case on test_plan.id = bug_relation_case.test_plan_id + left join bug on bug_relation_case.bug_id = bug.id + where test_plan.status = 'NOT_ARCHIVED' and bug.deleted = false and test_plan.project_id = #{request.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 7bab087f9e..ed1a5175cd 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 @@ -122,31 +122,8 @@ #{id} - - and ( - false - - or t.id in - - #{id} - - or t.group_id in - - #{id} - - - - or t.id in - - #{id} - - - ) - - - - + and ( @@ -161,7 +138,7 @@ ) - + and t.id in #{id} diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanManagementService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanManagementService.java index 67ca703d2c..3ec735318d 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanManagementService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanManagementService.java @@ -503,7 +503,6 @@ public class TestPlanManagementService { */ private void setTodoParam(TestPlanTableRequest request) { List doneIds = new ArrayList<>(); - List extraChildIds = new ArrayList<>(); // 筛选出已完成/进行中的计划或计划组 List statusList = new ArrayList<>(); statusList.add(TestPlanConstants.TEST_PLAN_SHOW_STATUS_COMPLETED); @@ -545,49 +544,15 @@ public class TestPlanManagementService { } calculateIds.addAll(childPlans.stream().map(TestPlan::getId).toList()); if (CollectionUtils.isNotEmpty(calculateIds)) { - boolean onlyPrepared = isOnlyFilterPreparedWithTodoParam(request.getFilter()); - boolean onlyUnderway = isOnlyFilterUnderwayWithTodoParam(request.getFilter()); List calcPlans = testPlanStatisticsService.calculateRate(calculateIds); calcPlans.forEach(plan -> { // 筛选出已完成 && 且通过率达到阈值的子计划 if (plan.getPassRate() >= plan.getPassThreshold() && StringUtils.equals(plan.getStatus(), TestPlanConstants.TEST_PLAN_SHOW_STATUS_COMPLETED)) { doneIds.add(plan.getId()); } - // 筛选出未执行的子计划 - if (StringUtils.equals(plan.getStatus(), TestPlanConstants.TEST_PLAN_SHOW_STATUS_PREPARED)) { - if (onlyPrepared) { - extraChildIds.add(plan.getId()); - } - if (onlyUnderway) { - doneIds.add(plan.getId()); - } - } }); } request.setDoneExcludeIds(doneIds); - request.setExtraIncludeChildIds(extraChildIds); } } - - /** - * 是否仅筛选待办列表中的未开始计划 - * @param filterStatusMap 筛选条件 - * @return boolean - */ - private boolean isOnlyFilterPreparedWithTodoParam(Map> filterStatusMap) { - return filterStatusMap != null && filterStatusMap.containsKey("status") - && filterStatusMap.get("status").contains(TestPlanConstants.TEST_PLAN_SHOW_STATUS_PREPARED) - && !filterStatusMap.get("status").contains(TestPlanConstants.TEST_PLAN_SHOW_STATUS_UNDERWAY); - } - - /** - * 是否仅筛选待办列表中的执行中计划 - * @param filterStatusMap 筛选条件 - * @return boolean - */ - private boolean isOnlyFilterUnderwayWithTodoParam(Map> filterStatusMap) { - return filterStatusMap != null && filterStatusMap.containsKey("status") - && filterStatusMap.get("status").contains(TestPlanConstants.TEST_PLAN_SHOW_STATUS_UNDERWAY) - && !filterStatusMap.get("status").contains(TestPlanConstants.TEST_PLAN_SHOW_STATUS_PREPARED); - } }