refactor(功能用例): 调整功能用例模块表结构

This commit is contained in:
guoyuqi 2023-10-31 09:46:40 +08:00 committed by Craftsman
parent de45b6cd6f
commit ec7645bf97
3 changed files with 137 additions and 48 deletions

View File

@ -1,10 +1,8 @@
package io.metersphere.functional.domain; package io.metersphere.functional.domain;
import io.metersphere.validation.groups.Created; import io.metersphere.validation.groups.*;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.*;
import jakarta.validation.constraints.Size;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -12,45 +10,46 @@ import lombok.Data;
@Data @Data
public class FunctionalCaseModule implements Serializable { public class FunctionalCaseModule implements Serializable {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{functional_case_module.id.not_blank}", groups = {Updated.class}) @NotBlank(message = "{functional_case_module.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{functional_case_module.id.length_range}", groups = {Created.class, Updated.class}) @Size(min = 1, max = 50, message = "{functional_case_module.id.length_range}", groups = {Created.class, Updated.class})
private String id; private String id;
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{functional_case_module.project_id.not_blank}", groups = {Created.class}) @NotBlank(message = "{functional_case_module.project_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{functional_case_module.project_id.length_range}", groups = {Created.class, Updated.class}) @Size(min = 1, max = 50, message = "{functional_case_module.project_id.length_range}", groups = {Created.class, Updated.class})
private String projectId; private String projectId;
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{functional_case_module.name.not_blank}", groups = {Created.class}) @NotBlank(message = "{functional_case_module.name.not_blank}", groups = {Created.class})
@Size(min = 1, max = 100, message = "{functional_case_module.name.length_range}", groups = {Created.class, Updated.class}) @Size(min = 1, max = 100, message = "{functional_case_module.name.length_range}", groups = {Created.class, Updated.class})
private String name; private String name;
@Schema(description = "父节点ID", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "父节点ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{functional_case_module.parent_id.not_blank}", groups = {Created.class}) @NotBlank(message = "{functional_case_module.parent_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{functional_case_module.parent_id.length_range}", groups = {Created.class, Updated.class}) @Size(min = 1, max = 50, message = "{functional_case_module.parent_id.length_range}", groups = {Created.class, Updated.class})
private String parentId; private String parentId;
@Schema(description = "节点的层级", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "节点的层级", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{functional_case_module.level.not_blank}", groups = {Created.class}) @NotNull(message = "{functional_case_module.level.not_blank}", groups = {Created.class})
@Size(min = 1, max = 10, message = "{functional_case_module.level.length_range}", groups = {Created.class, Updated.class})
private Integer level; private Integer level;
@Schema(description = "创建时间") @Schema(description = "创建时间")
private Long createTime; private Long createTime;
@Schema(description = "更新时间") @Schema(description = "更新时间")
private Long updateTime; private Long updateTime;
@Schema(description = "同一节点下的顺序", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "同一节点下的顺序", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{functional_case_module.pos.not_blank}", groups = {Created.class}) @NotNull(message = "{functional_case_module.pos.not_blank}", groups = {Created.class})
@Size(min = 1, max = 19, message = "{functional_case_module.pos.length_range}", groups = {Created.class, Updated.class}) private Integer pos;
private Long pos;
@Schema(description = "创建人") @Schema(description = "创建人")
private String createUser; private String createUser;
@Schema(description = "更新人")
private String updateUser;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public enum Column { public enum Column {
@ -61,8 +60,9 @@ public class FunctionalCaseModule implements Serializable {
level("level", "level", "INTEGER", true), level("level", "level", "INTEGER", true),
createTime("create_time", "createTime", "BIGINT", false), createTime("create_time", "createTime", "BIGINT", false),
updateTime("update_time", "updateTime", "BIGINT", false), updateTime("update_time", "updateTime", "BIGINT", false),
pos("pos", "pos", "BIGINT", false), pos("pos", "pos", "INTEGER", false),
createUser("create_user", "createUser", "VARCHAR", false); createUser("create_user", "createUser", "VARCHAR", false),
updateUser("update_user", "updateUser", "VARCHAR", false);
private static final String BEGINNING_DELIMITER = "`"; private static final String BEGINNING_DELIMITER = "`";

View File

@ -574,52 +574,52 @@ public class FunctionalCaseModuleExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPosEqualTo(Long value) { public Criteria andPosEqualTo(Integer value) {
addCriterion("pos =", value, "pos"); addCriterion("pos =", value, "pos");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPosNotEqualTo(Long value) { public Criteria andPosNotEqualTo(Integer value) {
addCriterion("pos <>", value, "pos"); addCriterion("pos <>", value, "pos");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPosGreaterThan(Long value) { public Criteria andPosGreaterThan(Integer value) {
addCriterion("pos >", value, "pos"); addCriterion("pos >", value, "pos");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPosGreaterThanOrEqualTo(Long value) { public Criteria andPosGreaterThanOrEqualTo(Integer value) {
addCriterion("pos >=", value, "pos"); addCriterion("pos >=", value, "pos");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPosLessThan(Long value) { public Criteria andPosLessThan(Integer value) {
addCriterion("pos <", value, "pos"); addCriterion("pos <", value, "pos");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPosLessThanOrEqualTo(Long value) { public Criteria andPosLessThanOrEqualTo(Integer value) {
addCriterion("pos <=", value, "pos"); addCriterion("pos <=", value, "pos");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPosIn(List<Long> values) { public Criteria andPosIn(List<Integer> values) {
addCriterion("pos in", values, "pos"); addCriterion("pos in", values, "pos");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPosNotIn(List<Long> values) { public Criteria andPosNotIn(List<Integer> values) {
addCriterion("pos not in", values, "pos"); addCriterion("pos not in", values, "pos");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPosBetween(Long value1, Long value2) { public Criteria andPosBetween(Integer value1, Integer value2) {
addCriterion("pos between", value1, value2, "pos"); addCriterion("pos between", value1, value2, "pos");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPosNotBetween(Long value1, Long value2) { public Criteria andPosNotBetween(Integer value1, Integer value2) {
addCriterion("pos not between", value1, value2, "pos"); addCriterion("pos not between", value1, value2, "pos");
return (Criteria) this; return (Criteria) this;
} }
@ -693,6 +693,76 @@ public class FunctionalCaseModuleExample {
addCriterion("create_user not between", value1, value2, "createUser"); addCriterion("create_user not between", value1, value2, "createUser");
return (Criteria) this; 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<String> values) {
addCriterion("update_user in", values, "updateUser");
return (Criteria) this;
}
public Criteria andUpdateUserNotIn(List<String> 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 static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

View File

@ -9,8 +9,9 @@
<result column="level" jdbcType="INTEGER" property="level" /> <result column="level" jdbcType="INTEGER" property="level" />
<result column="create_time" jdbcType="BIGINT" property="createTime" /> <result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" /> <result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="pos" jdbcType="BIGINT" property="pos" /> <result column="pos" jdbcType="INTEGER" property="pos" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" /> <result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="update_user" jdbcType="VARCHAR" property="updateUser" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -71,7 +72,8 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, project_id, `name`, parent_id, `level`, create_time, update_time, pos, create_user id, project_id, `name`, parent_id, `level`, create_time, update_time, pos, create_user,
update_user
</sql> </sql>
<select id="selectByExample" parameterType="io.metersphere.functional.domain.FunctionalCaseModuleExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="io.metersphere.functional.domain.FunctionalCaseModuleExample" resultMap="BaseResultMap">
select select
@ -106,12 +108,12 @@
<insert id="insert" parameterType="io.metersphere.functional.domain.FunctionalCaseModule"> <insert id="insert" parameterType="io.metersphere.functional.domain.FunctionalCaseModule">
insert into functional_case_module (id, project_id, `name`, insert into functional_case_module (id, project_id, `name`,
parent_id, `level`, create_time, parent_id, `level`, create_time,
update_time, pos, create_user update_time, pos, create_user,
) update_user)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{parentId,jdbcType=VARCHAR}, #{level,jdbcType=INTEGER}, #{createTime,jdbcType=BIGINT}, #{parentId,jdbcType=VARCHAR}, #{level,jdbcType=INTEGER}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT}, #{pos,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR} #{updateTime,jdbcType=BIGINT}, #{pos,jdbcType=INTEGER}, #{createUser,jdbcType=VARCHAR},
) #{updateUser,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.functional.domain.FunctionalCaseModule"> <insert id="insertSelective" parameterType="io.metersphere.functional.domain.FunctionalCaseModule">
insert into functional_case_module insert into functional_case_module
@ -143,6 +145,9 @@
<if test="createUser != null"> <if test="createUser != null">
create_user, create_user,
</if> </if>
<if test="updateUser != null">
update_user,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@ -167,11 +172,14 @@
#{updateTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
</if> </if>
<if test="pos != null"> <if test="pos != null">
#{pos,jdbcType=BIGINT}, #{pos,jdbcType=INTEGER},
</if> </if>
<if test="createUser != null"> <if test="createUser != null">
#{createUser,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR},
</if> </if>
<if test="updateUser != null">
#{updateUser,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="io.metersphere.functional.domain.FunctionalCaseModuleExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="io.metersphere.functional.domain.FunctionalCaseModuleExample" resultType="java.lang.Long">
@ -205,11 +213,14 @@
update_time = #{record.updateTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT},
</if> </if>
<if test="record.pos != null"> <if test="record.pos != null">
pos = #{record.pos,jdbcType=BIGINT}, pos = #{record.pos,jdbcType=INTEGER},
</if> </if>
<if test="record.createUser != null"> <if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR}, create_user = #{record.createUser,jdbcType=VARCHAR},
</if> </if>
<if test="record.updateUser != null">
update_user = #{record.updateUser,jdbcType=VARCHAR},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
@ -224,8 +235,9 @@
`level` = #{record.level,jdbcType=INTEGER}, `level` = #{record.level,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=BIGINT}, create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT},
pos = #{record.pos,jdbcType=BIGINT}, pos = #{record.pos,jdbcType=INTEGER},
create_user = #{record.createUser,jdbcType=VARCHAR} create_user = #{record.createUser,jdbcType=VARCHAR},
update_user = #{record.updateUser,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -252,11 +264,14 @@
update_time = #{updateTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT},
</if> </if>
<if test="pos != null"> <if test="pos != null">
pos = #{pos,jdbcType=BIGINT}, pos = #{pos,jdbcType=INTEGER},
</if> </if>
<if test="createUser != null"> <if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR}, create_user = #{createUser,jdbcType=VARCHAR},
</if> </if>
<if test="updateUser != null">
update_user = #{updateUser,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
@ -268,20 +283,21 @@
`level` = #{level,jdbcType=INTEGER}, `level` = #{level,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT},
pos = #{pos,jdbcType=BIGINT}, pos = #{pos,jdbcType=INTEGER},
create_user = #{createUser,jdbcType=VARCHAR} create_user = #{createUser,jdbcType=VARCHAR},
update_user = #{updateUser,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
<insert id="batchInsert" parameterType="map"> <insert id="batchInsert" parameterType="map">
insert into functional_case_module insert into functional_case_module
(id, project_id, `name`, parent_id, `level`, create_time, update_time, pos, create_user (id, project_id, `name`, parent_id, `level`, create_time, update_time, pos, create_user,
) update_user)
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.projectId,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, (#{item.id,jdbcType=VARCHAR}, #{item.projectId,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR},
#{item.parentId,jdbcType=VARCHAR}, #{item.level,jdbcType=INTEGER}, #{item.createTime,jdbcType=BIGINT}, #{item.parentId,jdbcType=VARCHAR}, #{item.level,jdbcType=INTEGER}, #{item.createTime,jdbcType=BIGINT},
#{item.updateTime,jdbcType=BIGINT}, #{item.pos,jdbcType=BIGINT}, #{item.createUser,jdbcType=VARCHAR} #{item.updateTime,jdbcType=BIGINT}, #{item.pos,jdbcType=INTEGER}, #{item.createUser,jdbcType=VARCHAR},
) #{item.updateUser,jdbcType=VARCHAR})
</foreach> </foreach>
</insert> </insert>
<insert id="batchInsertSelective" parameterType="map"> <insert id="batchInsertSelective" parameterType="map">
@ -316,11 +332,14 @@
#{item.updateTime,jdbcType=BIGINT} #{item.updateTime,jdbcType=BIGINT}
</if> </if>
<if test="'pos'.toString() == column.value"> <if test="'pos'.toString() == column.value">
#{item.pos,jdbcType=BIGINT} #{item.pos,jdbcType=INTEGER}
</if> </if>
<if test="'create_user'.toString() == column.value"> <if test="'create_user'.toString() == column.value">
#{item.createUser,jdbcType=VARCHAR} #{item.createUser,jdbcType=VARCHAR}
</if> </if>
<if test="'update_user'.toString() == column.value">
#{item.updateUser,jdbcType=VARCHAR}
</if>
</foreach> </foreach>
) )
</foreach> </foreach>