chore: 优化容量限制方案

This commit is contained in:
fit2-zhao 2024-06-13 11:22:30 +08:00 committed by Craftsman
parent d759105e57
commit 2a9d37ada5
6 changed files with 131 additions and 27 deletions

View File

@ -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 = "`";

View File

@ -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<String> values) {
addCriterion("cft_token in", values, "cftToken");
return (Criteria) this;
}
public Criteria andCftTokenNotIn(List<String> 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 {

View File

@ -17,6 +17,7 @@
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="update_user" jdbcType="VARCHAR" property="updateUser" />
<result column="deleted" jdbcType="BIT" property="deleted" />
<result column="cft_token" jdbcType="VARCHAR" property="cftToken" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -78,7 +79,7 @@
</sql>
<sql id="Base_Column_List">
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
</sql>
<select id="selectByExample" parameterType="io.metersphere.system.domain.UserExample" resultMap="BaseResultMap">
select
@ -115,14 +116,14 @@
`password`, `enable`, create_time,
update_time, `language`, last_organization_id,
phone, `source`, last_project_id,
create_user, update_user, deleted
)
create_user, update_user, deleted,
cft_token)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR}, #{enable,jdbcType=BIT}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT}, #{language,jdbcType=VARCHAR}, #{lastOrganizationId,jdbcType=VARCHAR},
#{phone,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR}, #{lastProjectId,jdbcType=VARCHAR},
#{createUser,jdbcType=VARCHAR}, #{updateUser,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT}
)
#{createUser,jdbcType=VARCHAR}, #{updateUser,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT},
#{cftToken,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.system.domain.User">
insert into user
@ -172,6 +173,9 @@
<if test="deleted != null">
deleted,
</if>
<if test="cftToken != null">
cft_token,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -219,6 +223,9 @@
<if test="deleted != null">
#{deleted,jdbcType=BIT},
</if>
<if test="cftToken != null">
#{cftToken,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.system.domain.UserExample" resultType="java.lang.Long">
@ -275,6 +282,9 @@
<if test="record.deleted != null">
deleted = #{record.deleted,jdbcType=BIT},
</if>
<if test="record.cftToken != null">
cft_token = #{record.cftToken,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -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}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -346,6 +357,9 @@
<if test="deleted != null">
deleted = #{deleted,jdbcType=BIT},
</if>
<if test="cftToken != null">
cft_token = #{cftToken,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -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}
</update>
<insert id="batchInsert" parameterType="map">
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
<foreach collection="list" item="item" separator=",">
(#{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})
</foreach>
</insert>
<insert id="batchInsertSelective" parameterType="map">
@ -436,6 +451,9 @@
<if test="'deleted'.toString() == column.value">
#{item.deleted,jdbcType=BIT}
</if>
<if test="'cft_token'.toString() == column.value">
#{item.cftToken,jdbcType=VARCHAR}
</if>
</foreach>
)
</foreach>

View File

@ -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;

View File

@ -46,4 +46,5 @@ public interface ExtUserMapper {
*/
long gaInstalledTime();
void updateInstalled();
}

View File

@ -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'
</select>
<select id="updateInstalled">
update metersphere_version SET description ='ga'
WHERE version ='3.0.1.2' and description = 'ga ddl'
</select>
</mapper>