From 3db9e9374c0c0375449a753e0df31fc92760fecc Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Thu, 25 Aug 2022 10:52:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=B7=A5=E4=BD=9C=E5=8F=B0):=20=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E5=8F=B0=E7=BC=BA=E9=99=B7=E7=8A=B6=E6=80=81=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1016061 --user=陈建星 【工作台】-我创建的缺陷-github#17150展示状态只有【新建】,【测试跟踪】-【缺陷管理】处的【已解决】和【已关闭】状态也被当做【新建】状态被展示 https://www.tapd.cn/55049933/s/1233613 --- .../io/metersphere/base/domain/IssuesDao.java | 1 - .../base/domain/IssuesStatusCountDao.java | 12 +++++++++++ .../base/mapper/ext/ExtIssuesMapper.java | 4 +++- .../base/mapper/ext/ExtIssuesMapper.xml | 21 ++++++++++++++----- .../track/controller/IssuesController.java | 7 +++---- .../request/testcase/IssuesCountRequest.java | 11 ++++++++++ .../track/service/IssuesService.java | 15 ++++++++++--- 7 files changed, 57 insertions(+), 14 deletions(-) create mode 100644 backend/src/main/java/io/metersphere/base/domain/IssuesStatusCountDao.java create mode 100644 backend/src/main/java/io/metersphere/track/request/testcase/IssuesCountRequest.java diff --git a/backend/src/main/java/io/metersphere/base/domain/IssuesDao.java b/backend/src/main/java/io/metersphere/base/domain/IssuesDao.java index 753ea19e2b..04b1cc8b73 100644 --- a/backend/src/main/java/io/metersphere/base/domain/IssuesDao.java +++ b/backend/src/main/java/io/metersphere/base/domain/IssuesDao.java @@ -17,7 +17,6 @@ public class IssuesDao extends IssuesWithBLOBs { private long caseCount; private List caseIds; private String caseId; - private int totalIssueCount; private List tapdUsers; private ListzentaoBuilds; private String zentaoAssigned; diff --git a/backend/src/main/java/io/metersphere/base/domain/IssuesStatusCountDao.java b/backend/src/main/java/io/metersphere/base/domain/IssuesStatusCountDao.java new file mode 100644 index 0000000000..92b47798da --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/IssuesStatusCountDao.java @@ -0,0 +1,12 @@ +package io.metersphere.base.domain; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class IssuesStatusCountDao { + private int count; + private String statusValue; + private String platform; +} diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.java index a9b13e86fd..b2509aedaa 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.java @@ -2,9 +2,11 @@ package io.metersphere.base.mapper.ext; import io.metersphere.base.domain.Issues; import io.metersphere.base.domain.IssuesDao; +import io.metersphere.base.domain.IssuesStatusCountDao; import io.metersphere.dto.CustomFieldItemDTO; import io.metersphere.track.dto.CustomFieldResourceCompatibleDTO; import io.metersphere.track.dto.PlanReportIssueDTO; +import io.metersphere.track.request.testcase.IssuesCountRequest; import io.metersphere.track.request.testcase.IssuesRequest; import org.apache.ibatis.annotations.Param; @@ -26,7 +28,7 @@ public interface ExtIssuesMapper { List selectForPlanReport(String planId); - List getCountByStatus(@Param("request") IssuesRequest issuesRequest); + List getCountByStatus(@Param("request") IssuesCountRequest issuesRequest); List selectIdNotInUuIds(@Param("projectId") String projectId, @Param("platform") String platform, @Param("platformIds") List platformIds); diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.xml index 96a146972c..d4a8aed3e3 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.xml @@ -83,11 +83,22 @@ - + select count(1) as `count`, if(i.platform = 'Local', cfi.value, i.platform_status) as statusValue, i.platform + from issues i + inner join project p + on i.project_id = p.id and p.workspace_id = #{request.workspaceId} + left join custom_field_issues cfi + on i.id = cfi.resource_id and field_id in ( + select cf.id + from custom_field cf + left join project pr + on cf.project_id = pr.id + where cf.scene = 'ISSUE' and cf.name = '状态' + and (pr.workspace_id = #{request.workspaceId} or global = true) + ) + where i.creator = #{request.creator} + group by statusValue;