From 7adf0a87b9ad5bc3ad930b39cdd2992504bc43d3 Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Tue, 13 Jun 2023 10:18:09 +0800 Subject: [PATCH] build: add project and organization update user field --- .../metersphere/project/domain/Project.java | 6 +- .../project/domain/ProjectExample.java | 70 +++++++++++++++++++ .../project/mapper/ProjectMapper.xml | 31 +++++--- .../system/domain/Organization.java | 6 +- .../system/domain/OrganizationExample.java | 70 +++++++++++++++++++ .../system/mapper/OrganizationMapper.xml | 29 ++++++-- .../3.0.0/ddl/V3.0.0_11__system_ddl.sql | 2 + .../3.0.0/ddl/V3.0.0_4__project_ddl.sql | 4 +- .../migration/3.0.0/dml/V3.0.0_11_1__data.sql | 4 +- 9 files changed, 201 insertions(+), 21 deletions(-) diff --git a/backend/framework/domain/src/main/java/io/metersphere/project/domain/Project.java b/backend/framework/domain/src/main/java/io/metersphere/project/domain/Project.java index 240a04e2fb..aefc0fb6e8 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/project/domain/Project.java +++ b/backend/framework/domain/src/main/java/io/metersphere/project/domain/Project.java @@ -13,8 +13,7 @@ public class Project implements Serializable { @Size(min = 1, max = 50, message = "{project.id.length_range}", groups = {Created.class, Updated.class}) private String id; - @Schema(title = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "{project.num.not_blank}", groups = {Created.class}) + @Schema(title = "项目编号") private Long num; @Schema(title = "组织ID", requiredMode = Schema.RequiredMode.REQUIRED) @@ -36,6 +35,9 @@ public class Project implements Serializable { @Schema(title = "更新时间") private Long updateTime; + @Schema(title = "修改人") + private String updateUser; + @Schema(title = "创建人") private String createUser; diff --git a/backend/framework/domain/src/main/java/io/metersphere/project/domain/ProjectExample.java b/backend/framework/domain/src/main/java/io/metersphere/project/domain/ProjectExample.java index f31f7a3b90..9369657ecb 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/project/domain/ProjectExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/project/domain/ProjectExample.java @@ -564,6 +564,76 @@ public class ProjectExample { return (Criteria) this; } + public Criteria andUpdateUserIsNull() { + addCriterion("update_user is null"); + return (Criteria) this; + } + + public Criteria andUpdateUserIsNotNull() { + addCriterion("update_user is not null"); + return (Criteria) this; + } + + public Criteria andUpdateUserEqualTo(String value) { + addCriterion("update_user =", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserNotEqualTo(String value) { + addCriterion("update_user <>", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserGreaterThan(String value) { + addCriterion("update_user >", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserGreaterThanOrEqualTo(String value) { + addCriterion("update_user >=", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserLessThan(String value) { + addCriterion("update_user <", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserLessThanOrEqualTo(String value) { + addCriterion("update_user <=", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserLike(String value) { + addCriterion("update_user like", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserNotLike(String value) { + addCriterion("update_user not like", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserIn(List values) { + addCriterion("update_user in", values, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserNotIn(List values) { + addCriterion("update_user not in", values, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserBetween(String value1, String value2) { + addCriterion("update_user between", value1, value2, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserNotBetween(String value1, String value2) { + addCriterion("update_user not between", value1, value2, "updateUser"); + return (Criteria) this; + } + public Criteria andCreateUserIsNull() { addCriterion("create_user is null"); return (Criteria) this; diff --git a/backend/framework/domain/src/main/java/io/metersphere/project/mapper/ProjectMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/project/mapper/ProjectMapper.xml index dfb5e6003b..d0f276249f 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/project/mapper/ProjectMapper.xml +++ b/backend/framework/domain/src/main/java/io/metersphere/project/mapper/ProjectMapper.xml @@ -9,6 +9,7 @@ + @@ -74,8 +75,8 @@ - id, num, organization_id, `name`, description, create_time, update_time, create_user, - delete_time, deleted, delete_user, `enable` + id, num, organization_id, `name`, description, create_time, update_time, update_user, + create_user, delete_time, deleted, delete_user, `enable` select @@ -109,12 +110,14 @@ insert into organization (id, num, `name`, description, create_time, update_time, - create_user, deleted, delete_user, - delete_time, `enable`) + create_user, update_user, deleted, + delete_user, delete_time, `enable` + ) values (#{id,jdbcType=VARCHAR}, #{num,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, - #{createUser,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT}, #{deleteUser,jdbcType=VARCHAR}, - #{deleteTime,jdbcType=BIGINT}, #{enable,jdbcType=BIT}) + #{createUser,jdbcType=VARCHAR}, #{updateUser,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT}, + #{deleteUser,jdbcType=VARCHAR}, #{deleteTime,jdbcType=BIGINT}, #{enable,jdbcType=BIT} + ) insert into organization @@ -140,6 +143,9 @@ create_user, + + update_user, + deleted, @@ -175,6 +181,9 @@ #{createUser,jdbcType=VARCHAR}, + + #{updateUser,jdbcType=VARCHAR}, + #{deleted,jdbcType=BIT}, @@ -219,6 +228,9 @@ create_user = #{record.createUser,jdbcType=VARCHAR}, + + update_user = #{record.updateUser,jdbcType=VARCHAR}, + deleted = #{record.deleted,jdbcType=BIT}, @@ -245,6 +257,7 @@ create_time = #{record.createTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT}, create_user = #{record.createUser,jdbcType=VARCHAR}, + update_user = #{record.updateUser,jdbcType=VARCHAR}, deleted = #{record.deleted,jdbcType=BIT}, delete_user = #{record.deleteUser,jdbcType=VARCHAR}, delete_time = #{record.deleteTime,jdbcType=BIGINT}, @@ -274,6 +287,9 @@ create_user = #{createUser,jdbcType=VARCHAR}, + + update_user = #{updateUser,jdbcType=VARCHAR}, + deleted = #{deleted,jdbcType=BIT}, @@ -297,6 +313,7 @@ create_time = #{createTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT}, create_user = #{createUser,jdbcType=VARCHAR}, + update_user = #{updateUser,jdbcType=VARCHAR}, deleted = #{deleted,jdbcType=BIT}, delete_user = #{deleteUser,jdbcType=VARCHAR}, delete_time = #{deleteTime,jdbcType=BIGINT}, diff --git a/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_11__system_ddl.sql b/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_11__system_ddl.sql index 00df7e8be1..0efc2ec727 100644 --- a/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_11__system_ddl.sql +++ b/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_11__system_ddl.sql @@ -401,6 +401,7 @@ CREATE TABLE organization `create_time` BIGINT NOT NULL COMMENT '创建时间', `update_time` BIGINT NOT NULL COMMENT '更新时间', `create_user` VARCHAR(50) NOT NULL COMMENT '创建人', + `update_user` VARCHAR(50) NOT NULL COMMENT '修改人', `deleted` BIT NOT NULL DEFAULT 0 COMMENT '是否删除', `delete_user` VARCHAR(50) COMMENT '删除人', `delete_time` BIGINT COMMENT '删除时间', @@ -417,6 +418,7 @@ CREATE INDEX idx_create_user ON organization (`create_user`); CREATE INDEX idx_create_time ON organization (`create_time`); CREATE INDEX idx_update_time ON organization (`update_time`); CREATE INDEX idx_deleted ON organization (`deleted`); +CREATE INDEX idx_update_user ON organization(`update_user`); DROP TABLE IF EXISTS user_extend; CREATE TABLE user_extend diff --git a/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_4__project_ddl.sql b/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_4__project_ddl.sql index 85e1b81e40..4bb2d620ac 100644 --- a/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_4__project_ddl.sql +++ b/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_4__project_ddl.sql @@ -168,6 +168,7 @@ CREATE TABLE project `description` VARCHAR(500) COMMENT '项目描述', `create_time` BIGINT NOT NULL COMMENT '创建时间', `update_time` BIGINT NOT NULL COMMENT '更新时间', + `update_user` VARCHAR(50) NOT NULL COMMENT '修改人', `create_user` VARCHAR(50) COMMENT '创建人', `delete_time` BIGINT(255) COMMENT '删除时间', `deleted` BIT NOT NULL DEFAULT 0 COMMENT '是否删除', @@ -181,9 +182,10 @@ CREATE TABLE project CREATE INDEX idx_organization_id ON project (organization_id); CREATE INDEX idx_create_user ON project (create_user); CREATE INDEX idx_create_time ON project (create_time); -CREATE INDEX idex_update_time ON project (update_time); +CREATE INDEX idx_update_time ON project (update_time); CREATE INDEX idx_name ON project (name); CREATE INDEX idx_deleted ON project (deleted); +CREATE INDEX idx_update_user ON project(update_user); DROP TABLE IF EXISTS project_application; CREATE TABLE project_application diff --git a/backend/framework/domain/src/main/resources/migration/3.0.0/dml/V3.0.0_11_1__data.sql b/backend/framework/domain/src/main/resources/migration/3.0.0/dml/V3.0.0_11_1__data.sql index 7add5c1428..176eef4d81 100644 --- a/backend/framework/domain/src/main/resources/migration/3.0.0/dml/V3.0.0_11_1__data.sql +++ b/backend/framework/domain/src/main/resources/migration/3.0.0/dml/V3.0.0_11_1__data.sql @@ -2,9 +2,9 @@ SET SESSION innodb_lock_wait_timeout = 7200; -- 初始化组织 -INSERT INTO organization (id, num, name, description, create_user, create_time, update_time) VALUES (uuid(), 100001, '默认组织', '系统默认创建的组织', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000); +INSERT INTO organization (id, num, name, description, create_user, update_user, create_time, update_time) VALUES (uuid(), 100001, '默认组织', '系统默认创建的组织', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000); -- 初始化项目 -INSERT INTO project (id, num, organization_id, name, description, create_user, create_time, update_time) VALUES (uuid(), 100001, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目', '系统默认创建的项目', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000); +INSERT INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time) VALUES (uuid(), 100001, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000); -- 初始化用户 insert into user(id, name, email, password, create_time, update_time, language, last_organization_id, phone, source, last_project_id, create_user, update_user)