diff --git a/backend/framework/domain/src/main/java/io/metersphere/project/domain/MessageTask.java b/backend/framework/domain/src/main/java/io/metersphere/project/domain/MessageTask.java index fbca61d983..0f9578d5b8 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/project/domain/MessageTask.java +++ b/backend/framework/domain/src/main/java/io/metersphere/project/domain/MessageTask.java @@ -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 = "`"; diff --git a/backend/framework/domain/src/main/java/io/metersphere/project/domain/MessageTaskExample.java b/backend/framework/domain/src/main/java/io/metersphere/project/domain/MessageTaskExample.java index a651694817..5cddacc247 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/project/domain/MessageTaskExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/project/domain/MessageTaskExample.java @@ -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 values) { + addCriterion("`enable` in", values, "enable"); + return (Criteria) this; + } + + public Criteria andEnableNotIn(List 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 { diff --git a/backend/framework/domain/src/main/java/io/metersphere/project/mapper/MessageTaskMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/project/mapper/MessageTaskMapper.xml index ea961026f6..1ccc002239 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/project/mapper/MessageTaskMapper.xml +++ b/backend/framework/domain/src/main/java/io/metersphere/project/mapper/MessageTaskMapper.xml @@ -11,6 +11,7 @@ + @@ -71,7 +72,8 @@ - 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` @@ -210,6 +218,9 @@ project_id = #{record.projectId,jdbcType=VARCHAR}, + + `enable` = #{record.enable,jdbcType=BIT}, + @@ -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} @@ -257,6 +269,9 @@ project_id = #{projectId,jdbcType=VARCHAR}, + + `enable` = #{enable,jdbcType=BIT}, + where id = #{id,jdbcType=VARCHAR} @@ -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} 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 (#{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}) @@ -321,6 +337,9 @@ #{item.projectId,jdbcType=VARCHAR} + + #{item.enable,jdbcType=BIT} + ) diff --git a/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_4__project_management.sql b/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_4__project_management.sql index c1a5b052cd..2e39ad14f8 100644 --- a/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_4__project_management.sql +++ b/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_4__project_management.sql @@ -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