From 2a9d37ada51d4a64388ded62cd385cb321479ca4 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 13 Jun 2024 11:22:30 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=E5=AE=B9=E9=87=8F?= =?UTF-8?q?=E9=99=90=E5=88=B6=E6=96=B9=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/system/domain/User.java | 39 ++++++----- .../system/domain/UserExample.java | 70 +++++++++++++++++++ .../metersphere/system/mapper/UserMapper.xml | 38 +++++++--- .../migration/3.0.1/ddl/V3.0.1_2__ga_ddl.sql | 3 + .../system/mapper/ExtUserMapper.java | 1 + .../system/mapper/ExtUserMapper.xml | 7 +- 6 files changed, 131 insertions(+), 27 deletions(-) diff --git a/backend/framework/domain/src/main/java/io/metersphere/system/domain/User.java b/backend/framework/domain/src/main/java/io/metersphere/system/domain/User.java index e86ce38e8f..ae50e6fec4 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/system/domain/User.java +++ b/backend/framework/domain/src/main/java/io/metersphere/system/domain/User.java @@ -10,59 +10,65 @@ import lombok.Data; @Data public class User implements Serializable { - @Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{user.id.not_blank}", groups = {Updated.class}) @Size(min = 1, max = 50, message = "{user.id.length_range}", groups = {Created.class, Updated.class}) private String id; - @Schema(description = "用户名", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "用户名", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{user.name.not_blank}", groups = {Created.class}) @Size(min = 1, max = 255, message = "{user.name.length_range}", groups = {Created.class, Updated.class}) private String name; - @Schema(description = "用户邮箱", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "用户邮箱", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{user.email.not_blank}", groups = {Created.class}) @Size(min = 1, max = 64, message = "{user.email.length_range}", groups = {Created.class, Updated.class}) private String email; - @Schema(description = "用户密码") + @Schema(description = "用户密码") private String password; - @Schema(description = "是否启用") + @Schema(description = "是否启用") private Boolean enable; - @Schema(description = "创建时间") + @Schema(description = "创建时间") private Long createTime; - @Schema(description = "更新时间") + @Schema(description = "更新时间") private Long updateTime; - @Schema(description = "语言") + @Schema(description = "语言") private String language; - @Schema(description = "当前组织ID") + @Schema(description = "当前组织ID") private String lastOrganizationId; - @Schema(description = "手机号") + @Schema(description = "手机号") private String phone; - @Schema(description = "来源:LOCAL OIDC CAS OAUTH2", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "来源:LOCAL OIDC CAS OAUTH2", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{user.source.not_blank}", groups = {Created.class}) @Size(min = 1, max = 50, message = "{user.source.length_range}", groups = {Created.class, Updated.class}) private String source; - @Schema(description = "当前项目ID") + @Schema(description = "当前项目ID") private String lastProjectId; - @Schema(description = "创建人") + @Schema(description = "创建人") private String createUser; - @Schema(description = "修改人") + @Schema(description = "修改人") private String updateUser; - @Schema(description = "是否删除") + @Schema(description = "是否删除", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "{user.deleted.not_blank}", groups = {Created.class}) private Boolean deleted; + @Schema(description = "身份令牌", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{user.cft_token.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 255, message = "{user.cft_token.length_range}", groups = {Created.class, Updated.class}) + private String cftToken; + private static final long serialVersionUID = 1L; public enum Column { @@ -80,7 +86,8 @@ public class User implements Serializable { lastProjectId("last_project_id", "lastProjectId", "VARCHAR", false), createUser("create_user", "createUser", "VARCHAR", false), updateUser("update_user", "updateUser", "VARCHAR", false), - deleted("deleted", "deleted", "BIT", false); + deleted("deleted", "deleted", "BIT", false), + cftToken("cft_token", "cftToken", "VARCHAR", false); private static final String BEGINNING_DELIMITER = "`"; diff --git a/backend/framework/domain/src/main/java/io/metersphere/system/domain/UserExample.java b/backend/framework/domain/src/main/java/io/metersphere/system/domain/UserExample.java index d3cf382104..2dc108487f 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/system/domain/UserExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/system/domain/UserExample.java @@ -1113,6 +1113,76 @@ public class UserExample { addCriterion("deleted not between", value1, value2, "deleted"); return (Criteria) this; } + + public Criteria andCftTokenIsNull() { + addCriterion("cft_token is null"); + return (Criteria) this; + } + + public Criteria andCftTokenIsNotNull() { + addCriterion("cft_token is not null"); + return (Criteria) this; + } + + public Criteria andCftTokenEqualTo(String value) { + addCriterion("cft_token =", value, "cftToken"); + return (Criteria) this; + } + + public Criteria andCftTokenNotEqualTo(String value) { + addCriterion("cft_token <>", value, "cftToken"); + return (Criteria) this; + } + + public Criteria andCftTokenGreaterThan(String value) { + addCriterion("cft_token >", value, "cftToken"); + return (Criteria) this; + } + + public Criteria andCftTokenGreaterThanOrEqualTo(String value) { + addCriterion("cft_token >=", value, "cftToken"); + return (Criteria) this; + } + + public Criteria andCftTokenLessThan(String value) { + addCriterion("cft_token <", value, "cftToken"); + return (Criteria) this; + } + + public Criteria andCftTokenLessThanOrEqualTo(String value) { + addCriterion("cft_token <=", value, "cftToken"); + return (Criteria) this; + } + + public Criteria andCftTokenLike(String value) { + addCriterion("cft_token like", value, "cftToken"); + return (Criteria) this; + } + + public Criteria andCftTokenNotLike(String value) { + addCriterion("cft_token not like", value, "cftToken"); + return (Criteria) this; + } + + public Criteria andCftTokenIn(List values) { + addCriterion("cft_token in", values, "cftToken"); + return (Criteria) this; + } + + public Criteria andCftTokenNotIn(List values) { + addCriterion("cft_token not in", values, "cftToken"); + return (Criteria) this; + } + + public Criteria andCftTokenBetween(String value1, String value2) { + addCriterion("cft_token between", value1, value2, "cftToken"); + return (Criteria) this; + } + + public Criteria andCftTokenNotBetween(String value1, String value2) { + addCriterion("cft_token not between", value1, value2, "cftToken"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/framework/domain/src/main/java/io/metersphere/system/mapper/UserMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/system/mapper/UserMapper.xml index 9ba99324aa..9ac12498a5 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/system/mapper/UserMapper.xml +++ b/backend/framework/domain/src/main/java/io/metersphere/system/mapper/UserMapper.xml @@ -17,6 +17,7 @@ + @@ -78,7 +79,7 @@ id, `name`, email, `password`, `enable`, create_time, update_time, `language`, last_organization_id, - phone, `source`, last_project_id, create_user, update_user, deleted + phone, `source`, last_project_id, create_user, update_user, deleted, cft_token @@ -275,6 +282,9 @@ deleted = #{record.deleted,jdbcType=BIT}, + + cft_token = #{record.cftToken,jdbcType=VARCHAR}, + @@ -296,7 +306,8 @@ last_project_id = #{record.lastProjectId,jdbcType=VARCHAR}, create_user = #{record.createUser,jdbcType=VARCHAR}, update_user = #{record.updateUser,jdbcType=VARCHAR}, - deleted = #{record.deleted,jdbcType=BIT} + deleted = #{record.deleted,jdbcType=BIT}, + cft_token = #{record.cftToken,jdbcType=VARCHAR} @@ -346,6 +357,9 @@ deleted = #{deleted,jdbcType=BIT}, + + cft_token = #{cftToken,jdbcType=VARCHAR}, + where id = #{id,jdbcType=VARCHAR} @@ -364,21 +378,22 @@ last_project_id = #{lastProjectId,jdbcType=VARCHAR}, create_user = #{createUser,jdbcType=VARCHAR}, update_user = #{updateUser,jdbcType=VARCHAR}, - deleted = #{deleted,jdbcType=BIT} + deleted = #{deleted,jdbcType=BIT}, + cft_token = #{cftToken,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR} insert into user (id, `name`, email, `password`, `enable`, create_time, update_time, `language`, last_organization_id, - phone, `source`, last_project_id, create_user, update_user, deleted) + phone, `source`, last_project_id, create_user, update_user, deleted, cft_token) values (#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.email,jdbcType=VARCHAR}, #{item.password,jdbcType=VARCHAR}, #{item.enable,jdbcType=BIT}, #{item.createTime,jdbcType=BIGINT}, #{item.updateTime,jdbcType=BIGINT}, #{item.language,jdbcType=VARCHAR}, #{item.lastOrganizationId,jdbcType=VARCHAR}, #{item.phone,jdbcType=VARCHAR}, #{item.source,jdbcType=VARCHAR}, #{item.lastProjectId,jdbcType=VARCHAR}, - #{item.createUser,jdbcType=VARCHAR}, #{item.updateUser,jdbcType=VARCHAR}, #{item.deleted,jdbcType=BIT} - ) + #{item.createUser,jdbcType=VARCHAR}, #{item.updateUser,jdbcType=VARCHAR}, #{item.deleted,jdbcType=BIT}, + #{item.cftToken,jdbcType=VARCHAR}) @@ -436,6 +451,9 @@ #{item.deleted,jdbcType=BIT} + + #{item.cftToken,jdbcType=VARCHAR} + ) diff --git a/backend/framework/domain/src/main/resources/migration/3.0.1/ddl/V3.0.1_2__ga_ddl.sql b/backend/framework/domain/src/main/resources/migration/3.0.1/ddl/V3.0.1_2__ga_ddl.sql index 65239b0146..f6c0b8d0f9 100644 --- a/backend/framework/domain/src/main/resources/migration/3.0.1/ddl/V3.0.1_2__ga_ddl.sql +++ b/backend/framework/domain/src/main/resources/migration/3.0.1/ddl/V3.0.1_2__ga_ddl.sql @@ -172,6 +172,9 @@ WHERE -- 默认资源池固定ID update test_resource_pool set id ='100001100001' where `name`= '默认资源池'; +ALTER TABLE `user` + ADD COLUMN `cft_token` varchar(255) NOT NULL DEFAULT 'NONE' COMMENT '身份令牌'; + -- set innodb lock wait timeout to default SET SESSION innodb_lock_wait_timeout = DEFAULT; diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserMapper.java b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserMapper.java index 90cf03490d..d2534c405c 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserMapper.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserMapper.java @@ -46,4 +46,5 @@ public interface ExtUserMapper { */ long gaInstalledTime(); + void updateInstalled(); } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserMapper.xml index 4e59546ef7..ac8e5d051a 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserMapper.xml +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtUserMapper.xml @@ -102,6 +102,11 @@ SELECT UNIX_TIMESTAMP(installed_on) * 1000 as installed_on FROM metersphere_version - WHERE version ='3.0.1.2' + WHERE version ='3.0.1.2' and description = 'ga ddl' + + + \ No newline at end of file