From e2db6fa104a8df744e7937544cb37336d7c567e3 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Wed, 16 Feb 2022 10:01:23 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B=E7=BC=BA=E9=99=B7=E4=B8=8E?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E7=BC=BA=E9=99=B7=E5=88=86?= =?UTF-8?q?=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/domain/TestCaseIssues.java | 8 +- .../base/domain/TestCaseIssuesExample.java | 198 +++++++++++++++--- .../base/mapper/TestCaseIssuesMapper.xml | 70 +++++-- .../base/mapper/ext/ExtIssuesMapper.java | 2 +- .../base/mapper/ext/ExtIssuesMapper.xml | 48 +++-- .../base/mapper/ext/ExtProjectMapper.xml | 4 +- .../base/mapper/ext/ExtTestCaseMapper.xml | 4 +- .../commons/constants/IssueRefType.java | 5 + .../track/controller/IssuesController.java | 13 +- .../track/domain/ReportResultComponent.java | 6 +- .../track/issue/AbstractIssuePlatform.java | 63 ++---- .../issues/IssuesRelevanceRequest.java | 5 + .../track/request/testcase/IssuesRequest.java | 11 + .../request/testcase/IssuesUpdateRequest.java | 8 +- .../track/service/IssuesService.java | 92 ++++---- .../track/service/TestCaseIssueService.java | 74 ++++--- .../track/service/TestCaseService.java | 15 +- .../track/service/TestPlanService.java | 2 +- .../service/TestPlanTestCaseService.java | 7 +- .../db/migration/V107__v1.18_release.sql | 26 ++- .../track/case/components/IssueRelateList.vue | 15 +- .../case/components/TestCaseEditOtherInfo.vue | 4 +- .../case/components/TestCaseIssueRelate.vue | 29 ++- .../case/components/TestPlanIssueEdit.vue | 9 +- .../track/common/minder/TestCaseMinder.vue | 15 +- .../track/common/minder/TestPlanMinder.vue | 20 +- .../track/common/minder/minderUtils.js | 4 +- .../track/issue/IssueEditDetail.vue | 35 +++- .../track/issue/TestCaseIssueList.vue | 16 +- .../track/issue/TestCaseRelateList.vue | 4 - frontend/src/network/Issue.js | 4 +- 31 files changed, 551 insertions(+), 265 deletions(-) create mode 100644 backend/src/main/java/io/metersphere/commons/constants/IssueRefType.java diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseIssues.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseIssues.java index cff8104fd7..467ed84f06 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestCaseIssues.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseIssues.java @@ -7,9 +7,13 @@ import lombok.Data; public class TestCaseIssues implements Serializable { private String id; - private String testCaseId; + private String resourceId; private String issuesId; + private String refId; + + private String refType; + private static final long serialVersionUID = 1L; -} \ No newline at end of file +} diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseIssuesExample.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseIssuesExample.java index 02920aa81a..6a665564a3 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestCaseIssuesExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseIssuesExample.java @@ -174,73 +174,73 @@ public class TestCaseIssuesExample { return (Criteria) this; } - public Criteria andTestCaseIdIsNull() { - addCriterion("test_case_id is null"); + public Criteria andResourceIdIsNull() { + addCriterion("resource_id is null"); return (Criteria) this; } - public Criteria andTestCaseIdIsNotNull() { - addCriterion("test_case_id is not null"); + public Criteria andResourceIdIsNotNull() { + addCriterion("resource_id is not null"); return (Criteria) this; } - public Criteria andTestCaseIdEqualTo(String value) { - addCriterion("test_case_id =", value, "testCaseId"); + public Criteria andResourceIdEqualTo(String value) { + addCriterion("resource_id =", value, "resourceId"); return (Criteria) this; } - public Criteria andTestCaseIdNotEqualTo(String value) { - addCriterion("test_case_id <>", value, "testCaseId"); + public Criteria andResourceIdNotEqualTo(String value) { + addCriterion("resource_id <>", value, "resourceId"); return (Criteria) this; } - public Criteria andTestCaseIdGreaterThan(String value) { - addCriterion("test_case_id >", value, "testCaseId"); + public Criteria andResourceIdGreaterThan(String value) { + addCriterion("resource_id >", value, "resourceId"); return (Criteria) this; } - public Criteria andTestCaseIdGreaterThanOrEqualTo(String value) { - addCriterion("test_case_id >=", value, "testCaseId"); + public Criteria andResourceIdGreaterThanOrEqualTo(String value) { + addCriterion("resource_id >=", value, "resourceId"); return (Criteria) this; } - public Criteria andTestCaseIdLessThan(String value) { - addCriterion("test_case_id <", value, "testCaseId"); + public Criteria andResourceIdLessThan(String value) { + addCriterion("resource_id <", value, "resourceId"); return (Criteria) this; } - public Criteria andTestCaseIdLessThanOrEqualTo(String value) { - addCriterion("test_case_id <=", value, "testCaseId"); + public Criteria andResourceIdLessThanOrEqualTo(String value) { + addCriterion("resource_id <=", value, "resourceId"); return (Criteria) this; } - public Criteria andTestCaseIdLike(String value) { - addCriterion("test_case_id like", value, "testCaseId"); + public Criteria andResourceIdLike(String value) { + addCriterion("resource_id like", value, "resourceId"); return (Criteria) this; } - public Criteria andTestCaseIdNotLike(String value) { - addCriterion("test_case_id not like", value, "testCaseId"); + public Criteria andResourceIdNotLike(String value) { + addCriterion("resource_id not like", value, "resourceId"); return (Criteria) this; } - public Criteria andTestCaseIdIn(List values) { - addCriterion("test_case_id in", values, "testCaseId"); + public Criteria andResourceIdIn(List values) { + addCriterion("resource_id in", values, "resourceId"); return (Criteria) this; } - public Criteria andTestCaseIdNotIn(List values) { - addCriterion("test_case_id not in", values, "testCaseId"); + public Criteria andResourceIdNotIn(List values) { + addCriterion("resource_id not in", values, "resourceId"); return (Criteria) this; } - public Criteria andTestCaseIdBetween(String value1, String value2) { - addCriterion("test_case_id between", value1, value2, "testCaseId"); + public Criteria andResourceIdBetween(String value1, String value2) { + addCriterion("resource_id between", value1, value2, "resourceId"); return (Criteria) this; } - public Criteria andTestCaseIdNotBetween(String value1, String value2) { - addCriterion("test_case_id not between", value1, value2, "testCaseId"); + public Criteria andResourceIdNotBetween(String value1, String value2) { + addCriterion("resource_id not between", value1, value2, "resourceId"); return (Criteria) this; } @@ -313,6 +313,146 @@ public class TestCaseIssuesExample { addCriterion("issues_id not between", value1, value2, "issuesId"); return (Criteria) this; } + + public Criteria andRefIdIsNull() { + addCriterion("ref_id is null"); + return (Criteria) this; + } + + public Criteria andRefIdIsNotNull() { + addCriterion("ref_id is not null"); + return (Criteria) this; + } + + public Criteria andRefIdEqualTo(String value) { + addCriterion("ref_id =", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdNotEqualTo(String value) { + addCriterion("ref_id <>", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdGreaterThan(String value) { + addCriterion("ref_id >", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdGreaterThanOrEqualTo(String value) { + addCriterion("ref_id >=", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdLessThan(String value) { + addCriterion("ref_id <", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdLessThanOrEqualTo(String value) { + addCriterion("ref_id <=", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdLike(String value) { + addCriterion("ref_id like", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdNotLike(String value) { + addCriterion("ref_id not like", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdIn(List values) { + addCriterion("ref_id in", values, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdNotIn(List values) { + addCriterion("ref_id not in", values, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdBetween(String value1, String value2) { + addCriterion("ref_id between", value1, value2, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdNotBetween(String value1, String value2) { + addCriterion("ref_id not between", value1, value2, "refId"); + return (Criteria) this; + } + + public Criteria andRefTypeIsNull() { + addCriterion("ref_type is null"); + return (Criteria) this; + } + + public Criteria andRefTypeIsNotNull() { + addCriterion("ref_type is not null"); + return (Criteria) this; + } + + public Criteria andRefTypeEqualTo(String value) { + addCriterion("ref_type =", value, "refType"); + return (Criteria) this; + } + + public Criteria andRefTypeNotEqualTo(String value) { + addCriterion("ref_type <>", value, "refType"); + return (Criteria) this; + } + + public Criteria andRefTypeGreaterThan(String value) { + addCriterion("ref_type >", value, "refType"); + return (Criteria) this; + } + + public Criteria andRefTypeGreaterThanOrEqualTo(String value) { + addCriterion("ref_type >=", value, "refType"); + return (Criteria) this; + } + + public Criteria andRefTypeLessThan(String value) { + addCriterion("ref_type <", value, "refType"); + return (Criteria) this; + } + + public Criteria andRefTypeLessThanOrEqualTo(String value) { + addCriterion("ref_type <=", value, "refType"); + return (Criteria) this; + } + + public Criteria andRefTypeLike(String value) { + addCriterion("ref_type like", value, "refType"); + return (Criteria) this; + } + + public Criteria andRefTypeNotLike(String value) { + addCriterion("ref_type not like", value, "refType"); + return (Criteria) this; + } + + public Criteria andRefTypeIn(List values) { + addCriterion("ref_type in", values, "refType"); + return (Criteria) this; + } + + public Criteria andRefTypeNotIn(List values) { + addCriterion("ref_type not in", values, "refType"); + return (Criteria) this; + } + + public Criteria andRefTypeBetween(String value1, String value2) { + addCriterion("ref_type between", value1, value2, "refType"); + return (Criteria) this; + } + + public Criteria andRefTypeNotBetween(String value1, String value2) { + addCriterion("ref_type not between", value1, value2, "refType"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { @@ -407,4 +547,4 @@ public class TestCaseIssuesExample { this(condition, value, secondValue, null); } } -} \ No newline at end of file +} diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestCaseIssuesMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/TestCaseIssuesMapper.xml index 10755b5265..47c1a95b06 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/TestCaseIssuesMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseIssuesMapper.xml @@ -3,8 +3,10 @@ - + + + @@ -65,7 +67,7 @@ - id, test_case_id, issues_id + id, resource_id, issues_id, ref_id, ref_type @@ -140,12 +154,18 @@ id = #{record.id,jdbcType=VARCHAR}, - - test_case_id = #{record.testCaseId,jdbcType=VARCHAR}, + + resource_id = #{record.resourceId,jdbcType=VARCHAR}, issues_id = #{record.issuesId,jdbcType=VARCHAR}, + + ref_id = #{record.refId,jdbcType=VARCHAR}, + + + ref_type = #{record.refType,jdbcType=VARCHAR}, + @@ -154,8 +174,10 @@ update test_case_issues set id = #{record.id,jdbcType=VARCHAR}, - test_case_id = #{record.testCaseId,jdbcType=VARCHAR}, - issues_id = #{record.issuesId,jdbcType=VARCHAR} + resource_id = #{record.resourceId,jdbcType=VARCHAR}, + issues_id = #{record.issuesId,jdbcType=VARCHAR}, + ref_id = #{record.refId,jdbcType=VARCHAR}, + ref_type = #{record.refType,jdbcType=VARCHAR} @@ -163,19 +185,27 @@ update test_case_issues - - test_case_id = #{testCaseId,jdbcType=VARCHAR}, + + resource_id = #{resourceId,jdbcType=VARCHAR}, issues_id = #{issuesId,jdbcType=VARCHAR}, + + ref_id = #{refId,jdbcType=VARCHAR}, + + + ref_type = #{refType,jdbcType=VARCHAR}, + where id = #{id,jdbcType=VARCHAR} update test_case_issues - set test_case_id = #{testCaseId,jdbcType=VARCHAR}, - issues_id = #{issuesId,jdbcType=VARCHAR} + set resource_id = #{resourceId,jdbcType=VARCHAR}, + issues_id = #{issuesId,jdbcType=VARCHAR}, + ref_id = #{refId,jdbcType=VARCHAR}, + ref_type = #{refType,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR} - \ No newline at end of file + 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 b12315220a..1be154ab26 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 @@ -12,7 +12,7 @@ public interface ExtIssuesMapper { List getIssuesByCaseId(@Param("request") IssuesRequest issuesRequest); - List getIssueForMinder(@Param("caseIds") List caseIds); + List getIssueForMinder(@Param("caseIds") List caseIds, @Param("refType") String refType); List getIssues(@Param("request") IssuesRequest issuesRequest); 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 5341c06b31..9575540d2f 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 @@ -7,25 +7,33 @@ from issues inner join test_case_issues on test_case_issues.issues_id = issues.id - - left join - project on issues.project_id = project.id - and (issues.platform_status != 'delete' or issues.platform_status is NULL) @@ -54,13 +62,13 @@ select count(distinct (tci.issues_id)) from test_plan_test_case tptc - join test_case_issues tci on tptc.case_id = tci.test_case_id - right join test_case on test_case.id = tci.test_case_id + join test_case_issues tci on tptc.case_id = tci.resource_id + right join test_case on test_case.id = tci.resource_id join issues on tci.issues_id = issues.id join test_plan on tptc.plan_id = test_plan.id where test_plan.project_id = #{projectId} diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml index 4aace876ec..8a5ac6142c 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml @@ -724,9 +724,9 @@