From 1631803bbd1c9f1e50bfb63a8b59f2e4efb3cfaa Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Wed, 30 Dec 2020 18:15:07 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):?= =?UTF-8?q?=20=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/base/domain/TestPlan.java | 5 +- .../base/domain/TestPlanExample.java | 70 +++++++++++++++++++ .../base/mapper/TestPlanMapper.xml | 31 ++++++-- .../base/mapper/ext/ExtTestPlanMapper.xml | 18 +++-- .../testcase/QueryTestPlanRequest.java | 2 + .../track/service/TestPlanProjectService.java | 15 ++-- .../track/service/TestPlanService.java | 52 +++++++++----- .../V59__test_plan_add_project_id.sql | 55 +++++++++++++++ .../track/plan/components/TestPlanEdit.vue | 10 +-- .../track/plan/components/TestPlanList.vue | 4 +- frontend/src/i18n/en-US.js | 2 + frontend/src/i18n/zh-CN.js | 2 + frontend/src/i18n/zh-TW.js | 2 + 13 files changed, 224 insertions(+), 44 deletions(-) create mode 100644 backend/src/main/resources/db/migration/V59__test_plan_add_project_id.sql diff --git a/backend/src/main/java/io/metersphere/base/domain/TestPlan.java b/backend/src/main/java/io/metersphere/base/domain/TestPlan.java index f66f9aa094..e08e5acda2 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestPlan.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestPlan.java @@ -1,8 +1,7 @@ package io.metersphere.base.domain; -import lombok.Data; - import java.io.Serializable; +import lombok.Data; @Data public class TestPlan implements Serializable { @@ -40,6 +39,8 @@ public class TestPlan implements Serializable { private String creator; + private String projectId; + private String tags; private static final long serialVersionUID = 1L; diff --git a/backend/src/main/java/io/metersphere/base/domain/TestPlanExample.java b/backend/src/main/java/io/metersphere/base/domain/TestPlanExample.java index 4512f8f5d2..9c32388ed3 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestPlanExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestPlanExample.java @@ -1233,6 +1233,76 @@ public class TestPlanExample { addCriterion("creator not between", value1, value2, "creator"); return (Criteria) this; } + + public Criteria andProjectIdIsNull() { + addCriterion("project_id is null"); + return (Criteria) this; + } + + public Criteria andProjectIdIsNotNull() { + addCriterion("project_id is not null"); + return (Criteria) this; + } + + public Criteria andProjectIdEqualTo(String value) { + addCriterion("project_id =", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdNotEqualTo(String value) { + addCriterion("project_id <>", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdGreaterThan(String value) { + addCriterion("project_id >", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdGreaterThanOrEqualTo(String value) { + addCriterion("project_id >=", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdLessThan(String value) { + addCriterion("project_id <", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdLessThanOrEqualTo(String value) { + addCriterion("project_id <=", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdLike(String value) { + addCriterion("project_id like", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdNotLike(String value) { + addCriterion("project_id not like", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdIn(List values) { + addCriterion("project_id in", values, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdNotIn(List values) { + addCriterion("project_id not in", values, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdBetween(String value1, String value2) { + addCriterion("project_id between", value1, value2, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdNotBetween(String value1, String value2) { + addCriterion("project_id not between", value1, value2, "projectId"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestPlanMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/TestPlanMapper.xml index d423f2d073..933036e208 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/TestPlanMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/TestPlanMapper.xml @@ -19,6 +19,7 @@ + @@ -84,7 +85,7 @@ id, workspace_id, report_id, `name`, description, `status`, stage, principal, test_case_match_rule, executor_match_rule, create_time, update_time, actual_end_time, planned_start_time, - planned_end_time, actual_start_time, creator + planned_end_time, actual_start_time, creator, project_id tags @@ -143,15 +144,15 @@ stage, principal, test_case_match_rule, executor_match_rule, create_time, update_time, actual_end_time, planned_start_time, planned_end_time, - actual_start_time, creator, tags - ) + actual_start_time, creator, project_id, + tags) values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{stage,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{testCaseMatchRule,jdbcType=VARCHAR}, #{executorMatchRule,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{actualEndTime,jdbcType=BIGINT}, #{plannedStartTime,jdbcType=BIGINT}, #{plannedEndTime,jdbcType=BIGINT}, - #{actualStartTime,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, #{tags,jdbcType=LONGVARCHAR} - ) + #{actualStartTime,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, + #{tags,jdbcType=LONGVARCHAR}) insert into test_plan @@ -207,6 +208,9 @@ creator, + + project_id, + tags, @@ -263,6 +267,9 @@ #{creator,jdbcType=VARCHAR}, + + #{projectId,jdbcType=VARCHAR}, + #{tags,jdbcType=LONGVARCHAR}, @@ -328,6 +335,9 @@ creator = #{record.creator,jdbcType=VARCHAR}, + + project_id = #{record.projectId,jdbcType=VARCHAR}, + tags = #{record.tags,jdbcType=LONGVARCHAR}, @@ -355,6 +365,7 @@ planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT}, actual_start_time = #{record.actualStartTime,jdbcType=BIGINT}, creator = #{record.creator,jdbcType=VARCHAR}, + project_id = #{record.projectId,jdbcType=VARCHAR}, tags = #{record.tags,jdbcType=LONGVARCHAR} @@ -378,7 +389,8 @@ planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT}, planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT}, actual_start_time = #{record.actualStartTime,jdbcType=BIGINT}, - creator = #{record.creator,jdbcType=VARCHAR} + creator = #{record.creator,jdbcType=VARCHAR}, + project_id = #{record.projectId,jdbcType=VARCHAR} @@ -434,6 +446,9 @@ creator = #{creator,jdbcType=VARCHAR}, + + project_id = #{projectId,jdbcType=VARCHAR}, + tags = #{tags,jdbcType=LONGVARCHAR}, @@ -458,6 +473,7 @@ planned_end_time = #{plannedEndTime,jdbcType=BIGINT}, actual_start_time = #{actualStartTime,jdbcType=BIGINT}, creator = #{creator,jdbcType=VARCHAR}, + project_id = #{projectId,jdbcType=VARCHAR}, tags = #{tags,jdbcType=LONGVARCHAR} where id = #{id,jdbcType=VARCHAR} @@ -478,7 +494,8 @@ planned_start_time = #{plannedStartTime,jdbcType=BIGINT}, planned_end_time = #{plannedEndTime,jdbcType=BIGINT}, actual_start_time = #{actualStartTime,jdbcType=BIGINT}, - creator = #{creator,jdbcType=VARCHAR} + creator = #{creator,jdbcType=VARCHAR}, + project_id = #{projectId,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/ExtTestPlanMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanMapper.xml index b7c5a14959..587b589566 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanMapper.xml @@ -98,9 +98,9 @@