refactor(消息管理): 修改MessageTask的sql

This commit is contained in:
guoyuqi 2023-09-08 10:45:28 +08:00 committed by fit2-zhao
parent 29b610e3e6
commit 20a58ec4f1
2 changed files with 34 additions and 22 deletions

View File

@ -16,32 +16,32 @@ public class MessageTask implements Serializable {
private String id;
@Schema(description = "通知事件类型", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{message_task.event.not_blank}", groups = {Created.class})
@NotBlank(message = "{message_task.event.not_blank}", groups = {Created.class, Updated.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)
@NotBlank(message = "{message_task.receiver.not_blank}", groups = {Created.class})
@NotBlank(message = "{message_task.receiver.not_blank}", groups = {Created.class, Updated.class})
@Size(min = 1, max = 50, message = "{message_task.receiver.length_range}", groups = {Created.class, Updated.class})
private String receiver;
@Schema(description = "机器人id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{message_task.project_robot_id.not_blank}", groups = {Created.class})
@NotBlank(message = "{message_task.project_robot_id.not_blank}", groups = {Created.class, Updated.class})
@Size(min = 1, max = 50, message = "{message_task.project_robot_id.length_range}", groups = {Created.class, Updated.class})
private String projectRobotId;
@Schema(description = "任务类型", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{message_task.task_type.not_blank}", groups = {Created.class})
@NotBlank(message = "{message_task.task_type.not_blank}", groups = {Created.class, Updated.class})
@Size(min = 1, max = 64, message = "{message_task.task_type.length_range}", groups = {Created.class, Updated.class})
private String taskType;
@Schema(description = "具体测试的ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{message_task.test_id.not_blank}", groups = {Created.class})
@NotBlank(message = "{message_task.test_id.not_blank}", groups = {Created.class, Updated.class})
@Size(min = 1, max = 50, message = "{message_task.test_id.length_range}", groups = {Created.class, Updated.class})
private String testId;
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{message_task.project_id.not_blank}", groups = {Created.class})
@NotBlank(message = "{message_task.project_id.not_blank}", groups = {Created.class, Updated.class})
@Size(min = 1, max = 50, message = "{message_task.project_id.length_range}", groups = {Created.class, Updated.class})
private String projectId;
@ -50,15 +50,19 @@ public class MessageTask implements Serializable {
private Boolean enable;
@Schema(description = "创建人")
@NotNull(message = "{message_task.createUser.not_blank}", groups = {Created.class, Updated.class})
private String createUser;
@Schema(description = "创建时间")
@NotNull(message = "{message_task.createTime.not_blank}", groups = {Created.class, Updated.class})
private Long createTime;
@Schema(description = "修改人")
@NotNull(message = "{message_task.updateUser.not_blank}", groups = {Created.class, Updated.class})
private String updateUser;
@Schema(description = "更新时间")
@NotNull(message = "{message_task.updateTime.not_blank}", groups = {Created.class, Updated.class})
private Long updateTime;
private static final long serialVersionUID = 1L;

View File

@ -225,25 +225,33 @@ CREATE TABLE IF NOT EXISTS file_metadata_blob
CREATE TABLE IF NOT EXISTS message_task
(
`id` VARCHAR(50) NOT NULL COMMENT '',
`type` VARCHAR(50) NOT NULL COMMENT '消息类型',
`event` VARCHAR(255) NOT NULL COMMENT '通知事件类型',
`receiver` VARCHAR(50) NOT NULL COMMENT '接收人id',
`task_type` VARCHAR(64) NOT NULL COMMENT '任务类型',
`webhook` VARCHAR(255) COMMENT 'webhook地址',
`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',
`id` VARCHAR(50) NOT NULL COMMENT '' ,
`event` VARCHAR(255) NOT NULL COMMENT '通知事件类型' ,
`receiver` VARCHAR(50) NOT NULL COMMENT '接收人id' ,
`project_robot_id` VARCHAR(50) NOT NULL DEFAULT 'NONE' COMMENT '机器人id' ,
`task_type` VARCHAR(64) NOT NULL COMMENT '任务类型' ,
`test_id` VARCHAR(50) NOT NULL DEFAULT 'NONE' COMMENT '具体测试的ID' ,
`project_id` VARCHAR(50) NOT NULL COMMENT '项目ID' ,
`enable` BIT NOT NULL DEFAULT 0 COMMENT '是否启用' ,
`create_user` VARCHAR(50) NOT NULL COMMENT '创建人' ,
`create_time` BIGINT NOT NULL DEFAULT 0 COMMENT '创建时间' ,
`update_user` VARCHAR(50) NOT NULL COMMENT '修改人' ,
`update_time` BIGINT NOT NULL COMMENT '更新时间' ,
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '消息通知任务';
COLLATE = utf8mb4_general_ci
COMMENT = '消息通知任务';
CREATE INDEX idx_project_id ON message_task (`project_id`);
CREATE INDEX idx_create_time ON message_task (`create_time`);
CREATE INDEX idx_receiver ON message_task (`receiver`);
CREATE INDEX idx_test_id ON message_task (`test_id`);
CREATE INDEX idx_project_id ON message_task(project_id);
CREATE INDEX idx_create_time ON message_task(create_time);
CREATE INDEX idx_test_id ON message_task(test_id);
CREATE INDEX idx_receiver ON message_task(receiver);
CREATE INDEX idx_task_type ON message_task(task_type);
CREATE INDEX idx_project_robot_id ON message_task(project_robot_id);
CREATE INDEX idx_event ON message_task(event);
CREATE INDEX idx_enable ON message_task(enable);
CREATE TABLE IF NOT EXISTS message_task_blob
(