refactor(功能用例): 增加功能用例模块回收站状态

This commit is contained in:
guoyuqi 2023-10-31 16:48:02 +08:00 committed by Craftsman
parent 4c1ec5d35b
commit c3601583c8
4 changed files with 107 additions and 20 deletions

View File

@ -1,16 +1,12 @@
package io.metersphere.functional.domain;
import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.metersphere.validation.groups.*;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import jakarta.validation.constraints.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import lombok.Data;
@Data
public class FunctionalCaseModule implements Serializable {
@ -54,6 +50,10 @@ public class FunctionalCaseModule implements Serializable {
@Schema(description = "更新人")
private String updateUser;
@Schema(description = "是否在回收站0-否1-是", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{functional_case_module.deleted.not_blank}", groups = {Created.class})
private Boolean deleted;
private static final long serialVersionUID = 1L;
public enum Column {
@ -66,7 +66,8 @@ public class FunctionalCaseModule implements Serializable {
updateTime("update_time", "updateTime", "BIGINT", false),
pos("pos", "pos", "BIGINT", false),
createUser("create_user", "createUser", "VARCHAR", false),
updateUser("update_user", "updateUser", "VARCHAR", false);
updateUser("update_user", "updateUser", "VARCHAR", false),
deleted("deleted", "deleted", "BIT", false);
private static final String BEGINNING_DELIMITER = "`";

View File

@ -763,6 +763,66 @@ public class FunctionalCaseModuleExample {
addCriterion("update_user not between", value1, value2, "updateUser");
return (Criteria) this;
}
public Criteria andDeletedIsNull() {
addCriterion("deleted is null");
return (Criteria) this;
}
public Criteria andDeletedIsNotNull() {
addCriterion("deleted is not null");
return (Criteria) this;
}
public Criteria andDeletedEqualTo(Boolean value) {
addCriterion("deleted =", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotEqualTo(Boolean value) {
addCriterion("deleted <>", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedGreaterThan(Boolean value) {
addCriterion("deleted >", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedGreaterThanOrEqualTo(Boolean value) {
addCriterion("deleted >=", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedLessThan(Boolean value) {
addCriterion("deleted <", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedLessThanOrEqualTo(Boolean value) {
addCriterion("deleted <=", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedIn(List<Boolean> values) {
addCriterion("deleted in", values, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotIn(List<Boolean> values) {
addCriterion("deleted not in", values, "deleted");
return (Criteria) this;
}
public Criteria andDeletedBetween(Boolean value1, Boolean value2) {
addCriterion("deleted between", value1, value2, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotBetween(Boolean value1, Boolean value2) {
addCriterion("deleted not between", value1, value2, "deleted");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -12,6 +12,7 @@
<result column="pos" jdbcType="BIGINT" property="pos" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="update_user" jdbcType="VARCHAR" property="updateUser" />
<result column="deleted" jdbcType="BIT" property="deleted" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -73,7 +74,7 @@
</sql>
<sql id="Base_Column_List">
id, project_id, `name`, parent_id, `level`, create_time, update_time, pos, create_user,
update_user
update_user, deleted
</sql>
<select id="selectByExample" parameterType="io.metersphere.functional.domain.FunctionalCaseModuleExample" resultMap="BaseResultMap">
select
@ -109,11 +110,11 @@
insert into functional_case_module (id, project_id, `name`,
parent_id, `level`, create_time,
update_time, pos, create_user,
update_user)
update_user, deleted)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{parentId,jdbcType=VARCHAR}, #{level,jdbcType=INTEGER}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT}, #{pos,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR},
#{updateUser,jdbcType=VARCHAR})
#{updateUser,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.functional.domain.FunctionalCaseModule">
insert into functional_case_module
@ -148,6 +149,9 @@
<if test="updateUser != null">
update_user,
</if>
<if test="deleted != null">
deleted,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -180,6 +184,9 @@
<if test="updateUser != null">
#{updateUser,jdbcType=VARCHAR},
</if>
<if test="deleted != null">
#{deleted,jdbcType=BIT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.functional.domain.FunctionalCaseModuleExample" resultType="java.lang.Long">
@ -221,6 +228,9 @@
<if test="record.updateUser != null">
update_user = #{record.updateUser,jdbcType=VARCHAR},
</if>
<if test="record.deleted != null">
deleted = #{record.deleted,jdbcType=BIT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -237,7 +247,8 @@
update_time = #{record.updateTime,jdbcType=BIGINT},
pos = #{record.pos,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR},
update_user = #{record.updateUser,jdbcType=VARCHAR}
update_user = #{record.updateUser,jdbcType=VARCHAR},
deleted = #{record.deleted,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -272,6 +283,9 @@
<if test="updateUser != null">
update_user = #{updateUser,jdbcType=VARCHAR},
</if>
<if test="deleted != null">
deleted = #{deleted,jdbcType=BIT},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -285,19 +299,20 @@
update_time = #{updateTime,jdbcType=BIGINT},
pos = #{pos,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR},
update_user = #{updateUser,jdbcType=VARCHAR}
update_user = #{updateUser,jdbcType=VARCHAR},
deleted = #{deleted,jdbcType=BIT}
where id = #{id,jdbcType=VARCHAR}
</update>
<insert id="batchInsert" parameterType="map">
insert into functional_case_module
(id, project_id, `name`, parent_id, `level`, create_time, update_time, pos, create_user,
update_user)
update_user, deleted)
values
<foreach collection="list" item="item" separator=",">
(#{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.updateTime,jdbcType=BIGINT}, #{item.pos,jdbcType=BIGINT}, #{item.createUser,jdbcType=VARCHAR},
#{item.updateUser,jdbcType=VARCHAR})
#{item.updateUser,jdbcType=VARCHAR}, #{item.deleted,jdbcType=BIT})
</foreach>
</insert>
<insert id="batchInsertSelective" parameterType="map">
@ -340,6 +355,9 @@
<if test="'update_user'.toString() == column.value">
#{item.updateUser,jdbcType=VARCHAR}
</if>
<if test="'deleted'.toString() == column.value">
#{item.deleted,jdbcType=BIT}
</if>
</foreach>
)
</foreach>

View File

@ -83,20 +83,28 @@ CREATE TABLE IF NOT EXISTS functional_case_module(
`id` VARCHAR(50) NOT NULL COMMENT 'ID' ,
`project_id` VARCHAR(50) NOT NULL COMMENT '项目ID' ,
`name` VARCHAR(100) NOT NULL COMMENT '名称' ,
`parent_id` VARCHAR(50) NOT NULL COMMENT '父节点ID' ,
`parent_id` VARCHAR(50) NOT NULL DEFAULT 'NONE' COMMENT '父节点ID' ,
`level` INT NOT NULL DEFAULT 1 COMMENT '节点的层级' ,
`create_time` BIGINT NOT NULL COMMENT '创建时间' ,
`update_time` BIGINT NOT NULL COMMENT '更新时间' ,
`pos` BIGINT(10) NOT NULL DEFAULT 0 COMMENT '同一节点下的顺序' ,
`pos` BIGINT NOT NULL DEFAULT 0 COMMENT '同一节点下的顺序' ,
`create_user` VARCHAR(50) NOT NULL COMMENT '创建人' ,
`update_user` VARCHAR(50) NOT NULL COMMENT '更新人' ,
`deleted` BIT NOT NULL DEFAULT 0 COMMENT '是否在回收站0-否1-是' ,
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '功能用例模块';
) COMMENT = '功能用例模块';
CREATE INDEX idx_project_id ON functional_case_module(project_id);
CREATE INDEX idx_name ON functional_case_module(name);
CREATE INDEX idx_pos ON functional_case_module(pos);
CREATE INDEX idx_parent_id ON functional_case_module(parent_id);
CREATE INDEX idx_level ON functional_case_module(level);
CREATE INDEX idx_create_user ON functional_case_module(create_user);
CREATE INDEX idx_update_user ON functional_case_module(update_user);
CREATE INDEX idx_create_time ON functional_case_module(create_time);
CREATE INDEX idx_update_time ON functional_case_module(update_time);
CREATE INDEX idx_delete ON functional_case_module(deleted);
CREATE TABLE IF NOT EXISTS functional_case_attachment(