refactor: flyway

This commit is contained in:
shiziyuan9527 2020-12-09 10:55:33 +08:00
parent 41290ee516
commit 1ff77583a4
4 changed files with 95 additions and 7 deletions

View File

@ -29,5 +29,7 @@ public class User implements Serializable {
private String source;
private String lastProjectId;
private static final long serialVersionUID = 1L;
}

View File

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

View File

@ -14,6 +14,7 @@
<result column="last_organization_id" jdbcType="VARCHAR" property="lastOrganizationId" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="source" jdbcType="VARCHAR" property="source" />
<result column="last_project_id" jdbcType="VARCHAR" property="lastProjectId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -75,7 +76,7 @@
</sql>
<sql id="Base_Column_List">
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
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.UserExample" resultMap="BaseResultMap">
select
@ -111,13 +112,13 @@
insert into user (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)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT}, #{language,jdbcType=VARCHAR}, #{lastWorkspaceId,jdbcType=VARCHAR},
#{lastOrganizationId,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR}
)
#{lastOrganizationId,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR},
#{lastProjectId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.User">
insert into user
@ -158,6 +159,9 @@
<if test="source != null">
`source`,
</if>
<if test="lastProjectId != null">
last_project_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -196,6 +200,9 @@
<if test="source != null">
#{source,jdbcType=VARCHAR},
</if>
<if test="lastProjectId != null">
#{lastProjectId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.UserExample" resultType="java.lang.Long">
@ -243,6 +250,9 @@
<if test="record.source != null">
`source` = #{record.source,jdbcType=VARCHAR},
</if>
<if test="record.lastProjectId != null">
last_project_id = #{record.lastProjectId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -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}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -302,6 +313,9 @@
<if test="source != null">
`source` = #{source,jdbcType=VARCHAR},
</if>
<if test="lastProjectId != null">
last_project_id = #{lastProjectId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -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}
</update>
</mapper>

View File

@ -0,0 +1 @@
alter table user add last_project_id varchar(50) null;