feat: add message enable
This commit is contained in:
parent
8627f7b68f
commit
4f27990b2c
|
@ -10,45 +10,51 @@ import lombok.Data;
|
|||
|
||||
@Data
|
||||
public class MessageTask implements Serializable {
|
||||
@Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(title = "", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{message_task.id.not_blank}", groups = {Updated.class})
|
||||
@Size(min = 1, max = 50, message = "{message_task.id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String id;
|
||||
|
||||
@Schema(description = "消息类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(title = "消息类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{message_task.type.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 50, message = "{message_task.type.length_range}", groups = {Created.class, Updated.class})
|
||||
private String type;
|
||||
|
||||
@Schema(description = "通知事件类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(title = "通知事件类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{message_task.event.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 255, message = "{message_task.event.length_range}", groups = {Created.class, Updated.class})
|
||||
private String event;
|
||||
|
||||
@Schema(description = "接收人id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(title = "接收人id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{message_task.receiver.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 50, message = "{message_task.receiver.length_range}", groups = {Created.class, Updated.class})
|
||||
private String receiver;
|
||||
|
||||
@Schema(description = "任务类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(title = "任务类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{message_task.task_type.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 64, message = "{message_task.task_type.length_range}", groups = {Created.class, Updated.class})
|
||||
private String taskType;
|
||||
|
||||
@Schema(description = "webhook地址")
|
||||
@Schema(title = "webhook地址")
|
||||
private String webhook;
|
||||
|
||||
@Schema(description = "具体测试的ID")
|
||||
@Schema(title = "具体测试的ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{message_task.test_id.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 50, message = "{message_task.test_id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String testId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@Schema(title = "创建时间")
|
||||
private Long createTime;
|
||||
|
||||
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(title = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{message_task.project_id.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 50, message = "{message_task.project_id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String projectId;
|
||||
|
||||
@Schema(title = "是否启用")
|
||||
@NotNull(message = "{message_task.enable.not_blank}", groups = {Created.class, Updated.class})
|
||||
private Boolean enable;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public enum Column {
|
||||
|
@ -60,7 +66,8 @@ public class MessageTask implements Serializable {
|
|||
webhook("webhook", "webhook", "VARCHAR", false),
|
||||
testId("test_id", "testId", "VARCHAR", false),
|
||||
createTime("create_time", "createTime", "BIGINT", false),
|
||||
projectId("project_id", "projectId", "VARCHAR", false);
|
||||
projectId("project_id", "projectId", "VARCHAR", false),
|
||||
enable("enable", "enable", "BIT", true);
|
||||
|
||||
private static final String BEGINNING_DELIMITER = "`";
|
||||
|
||||
|
|
|
@ -723,6 +723,66 @@ public class MessageTaskExample {
|
|||
addCriterion("project_id not between", value1, value2, "projectId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableIsNull() {
|
||||
addCriterion("`enable` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableIsNotNull() {
|
||||
addCriterion("`enable` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableEqualTo(Boolean value) {
|
||||
addCriterion("`enable` =", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableNotEqualTo(Boolean value) {
|
||||
addCriterion("`enable` <>", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableGreaterThan(Boolean value) {
|
||||
addCriterion("`enable` >", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableGreaterThanOrEqualTo(Boolean value) {
|
||||
addCriterion("`enable` >=", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableLessThan(Boolean value) {
|
||||
addCriterion("`enable` <", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableLessThanOrEqualTo(Boolean value) {
|
||||
addCriterion("`enable` <=", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableIn(List<Boolean> values) {
|
||||
addCriterion("`enable` in", values, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableNotIn(List<Boolean> values) {
|
||||
addCriterion("`enable` not in", values, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("`enable` between", value1, value2, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableNotBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("`enable` not between", value1, value2, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<result column="test_id" jdbcType="VARCHAR" property="testId" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
|
||||
<result column="enable" jdbcType="BIT" property="enable" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
|
@ -71,7 +72,8 @@
|
|||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, `type`, event, receiver, task_type, webhook, test_id, create_time, project_id
|
||||
id, `type`, event, receiver, task_type, webhook, test_id, create_time, project_id,
|
||||
`enable`
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.metersphere.project.domain.MessageTaskExample" resultMap="BaseResultMap">
|
||||
select
|
||||
|
@ -106,12 +108,12 @@
|
|||
<insert id="insert" parameterType="io.metersphere.project.domain.MessageTask">
|
||||
insert into message_task (id, `type`, event,
|
||||
receiver, task_type, webhook,
|
||||
test_id, create_time, project_id
|
||||
)
|
||||
test_id, create_time, project_id,
|
||||
`enable`)
|
||||
values (#{id,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR},
|
||||
#{receiver,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}, #{webhook,jdbcType=VARCHAR},
|
||||
#{testId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{projectId,jdbcType=VARCHAR}
|
||||
)
|
||||
#{testId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{projectId,jdbcType=VARCHAR},
|
||||
#{enable,jdbcType=BIT})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.project.domain.MessageTask">
|
||||
insert into message_task
|
||||
|
@ -143,6 +145,9 @@
|
|||
<if test="projectId != null">
|
||||
project_id,
|
||||
</if>
|
||||
<if test="enable != null">
|
||||
`enable`,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
|
@ -172,6 +177,9 @@
|
|||
<if test="projectId != null">
|
||||
#{projectId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="enable != null">
|
||||
#{enable,jdbcType=BIT},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.project.domain.MessageTaskExample" resultType="java.lang.Long">
|
||||
|
@ -210,6 +218,9 @@
|
|||
<if test="record.projectId != null">
|
||||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.enable != null">
|
||||
`enable` = #{record.enable,jdbcType=BIT},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
|
@ -225,7 +236,8 @@
|
|||
webhook = #{record.webhook,jdbcType=VARCHAR},
|
||||
test_id = #{record.testId,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
project_id = #{record.projectId,jdbcType=VARCHAR}
|
||||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||
`enable` = #{record.enable,jdbcType=BIT}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -257,6 +269,9 @@
|
|||
<if test="projectId != null">
|
||||
project_id = #{projectId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="enable != null">
|
||||
`enable` = #{enable,jdbcType=BIT},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
@ -269,19 +284,20 @@
|
|||
webhook = #{webhook,jdbcType=VARCHAR},
|
||||
test_id = #{testId,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
project_id = #{projectId,jdbcType=VARCHAR}
|
||||
project_id = #{projectId,jdbcType=VARCHAR},
|
||||
`enable` = #{enable,jdbcType=BIT}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<insert id="batchInsert" parameterType="map">
|
||||
insert into message_task
|
||||
(id, `type`, event, receiver, task_type, webhook, test_id, create_time, project_id
|
||||
)
|
||||
(id, `type`, event, receiver, task_type, webhook, test_id, create_time, project_id,
|
||||
`enable`)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.id,jdbcType=VARCHAR}, #{item.type,jdbcType=VARCHAR}, #{item.event,jdbcType=VARCHAR},
|
||||
#{item.receiver,jdbcType=VARCHAR}, #{item.taskType,jdbcType=VARCHAR}, #{item.webhook,jdbcType=VARCHAR},
|
||||
#{item.testId,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT}, #{item.projectId,jdbcType=VARCHAR}
|
||||
)
|
||||
#{item.testId,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT}, #{item.projectId,jdbcType=VARCHAR},
|
||||
#{item.enable,jdbcType=BIT})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="batchInsertSelective" parameterType="map">
|
||||
|
@ -321,6 +337,9 @@
|
|||
<if test="'project_id'.toString() == column.value">
|
||||
#{item.projectId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="'enable'.toString() == column.value">
|
||||
#{item.enable,jdbcType=BIT}
|
||||
</if>
|
||||
</foreach>
|
||||
)
|
||||
</foreach>
|
||||
|
|
|
@ -696,6 +696,7 @@ CREATE TABLE IF NOT EXISTS message_task
|
|||
`test_id` VARCHAR(50) NOT NULL DEFAULT 'none' COMMENT '具体测试的ID',
|
||||
`create_time` BIGINT NOT NULL DEFAULT 0 COMMENT '创建时间',
|
||||
`project_id` VARCHAR(50) NOT NULL COMMENT '项目ID',
|
||||
`enable` BIT NOT NULL DEFAULT 1 COMMENT '是否启用' ,
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
|
|
Loading…
Reference in New Issue