From 1ff77583a40acaa272cc22a9c7c63e7ac68bc9bf Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Wed, 9 Dec 2020 10:55:33 +0800 Subject: [PATCH] refactor: flyway --- .../java/io/metersphere/base/domain/User.java | 2 + .../metersphere/base/domain/UserExample.java | 70 +++++++++++++++++++ .../io/metersphere/base/mapper/UserMapper.xml | 29 ++++++-- .../db/migration/V49__user_add_project_id.sql | 1 + 4 files changed, 95 insertions(+), 7 deletions(-) create mode 100644 backend/src/main/resources/db/migration/V49__user_add_project_id.sql diff --git a/backend/src/main/java/io/metersphere/base/domain/User.java b/backend/src/main/java/io/metersphere/base/domain/User.java index e5e79131a3..2eb1fb1785 100644 --- a/backend/src/main/java/io/metersphere/base/domain/User.java +++ b/backend/src/main/java/io/metersphere/base/domain/User.java @@ -29,5 +29,7 @@ public class User implements Serializable { private String source; + private String lastProjectId; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/UserExample.java b/backend/src/main/java/io/metersphere/base/domain/UserExample.java index 986bec6d9d..d4d5db7577 100644 --- a/backend/src/main/java/io/metersphere/base/domain/UserExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/UserExample.java @@ -923,6 +923,76 @@ public class UserExample { addCriterion("`source` not between", value1, value2, "source"); return (Criteria) this; } + + public Criteria andLastProjectIdIsNull() { + addCriterion("last_project_id is null"); + return (Criteria) this; + } + + public Criteria andLastProjectIdIsNotNull() { + addCriterion("last_project_id is not null"); + return (Criteria) this; + } + + public Criteria andLastProjectIdEqualTo(String value) { + addCriterion("last_project_id =", value, "lastProjectId"); + return (Criteria) this; + } + + public Criteria andLastProjectIdNotEqualTo(String value) { + addCriterion("last_project_id <>", value, "lastProjectId"); + return (Criteria) this; + } + + public Criteria andLastProjectIdGreaterThan(String value) { + addCriterion("last_project_id >", value, "lastProjectId"); + return (Criteria) this; + } + + public Criteria andLastProjectIdGreaterThanOrEqualTo(String value) { + addCriterion("last_project_id >=", value, "lastProjectId"); + return (Criteria) this; + } + + public Criteria andLastProjectIdLessThan(String value) { + addCriterion("last_project_id <", value, "lastProjectId"); + return (Criteria) this; + } + + public Criteria andLastProjectIdLessThanOrEqualTo(String value) { + addCriterion("last_project_id <=", value, "lastProjectId"); + return (Criteria) this; + } + + public Criteria andLastProjectIdLike(String value) { + addCriterion("last_project_id like", value, "lastProjectId"); + return (Criteria) this; + } + + public Criteria andLastProjectIdNotLike(String value) { + addCriterion("last_project_id not like", value, "lastProjectId"); + return (Criteria) this; + } + + public Criteria andLastProjectIdIn(List values) { + addCriterion("last_project_id in", values, "lastProjectId"); + return (Criteria) this; + } + + public Criteria andLastProjectIdNotIn(List values) { + addCriterion("last_project_id not in", values, "lastProjectId"); + return (Criteria) this; + } + + public Criteria andLastProjectIdBetween(String value1, String value2) { + addCriterion("last_project_id between", value1, value2, "lastProjectId"); + return (Criteria) this; + } + + public Criteria andLastProjectIdNotBetween(String value1, String value2) { + addCriterion("last_project_id not between", value1, value2, "lastProjectId"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/src/main/java/io/metersphere/base/mapper/UserMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/UserMapper.xml index 5481b28259..af2f52d402 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/UserMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/UserMapper.xml @@ -14,6 +14,7 @@ + @@ -75,7 +76,7 @@ id, `name`, email, `password`, `status`, create_time, update_time, `language`, last_workspace_id, - last_organization_id, phone, `source` + last_organization_id, phone, `source`, last_project_id @@ -243,6 +250,9 @@ `source` = #{record.source,jdbcType=VARCHAR}, + + last_project_id = #{record.lastProjectId,jdbcType=VARCHAR}, + @@ -261,7 +271,8 @@ last_workspace_id = #{record.lastWorkspaceId,jdbcType=VARCHAR}, last_organization_id = #{record.lastOrganizationId,jdbcType=VARCHAR}, phone = #{record.phone,jdbcType=VARCHAR}, - `source` = #{record.source,jdbcType=VARCHAR} + `source` = #{record.source,jdbcType=VARCHAR}, + last_project_id = #{record.lastProjectId,jdbcType=VARCHAR} @@ -302,6 +313,9 @@ `source` = #{source,jdbcType=VARCHAR}, + + last_project_id = #{lastProjectId,jdbcType=VARCHAR}, + where id = #{id,jdbcType=VARCHAR} @@ -317,7 +331,8 @@ last_workspace_id = #{lastWorkspaceId,jdbcType=VARCHAR}, last_organization_id = #{lastOrganizationId,jdbcType=VARCHAR}, phone = #{phone,jdbcType=VARCHAR}, - `source` = #{source,jdbcType=VARCHAR} + `source` = #{source,jdbcType=VARCHAR}, + last_project_id = #{lastProjectId,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR} \ No newline at end of file diff --git a/backend/src/main/resources/db/migration/V49__user_add_project_id.sql b/backend/src/main/resources/db/migration/V49__user_add_project_id.sql new file mode 100644 index 0000000000..c282253624 --- /dev/null +++ b/backend/src/main/resources/db/migration/V49__user_add_project_id.sql @@ -0,0 +1 @@ +alter table user add last_project_id varchar(50) null; \ No newline at end of file