diff --git a/backend/src/main/java/io/metersphere/base/domain/MessageTask.java b/backend/src/main/java/io/metersphere/base/domain/MessageTask.java index 8399db0f6f..4b4a851d24 100644 --- a/backend/src/main/java/io/metersphere/base/domain/MessageTask.java +++ b/backend/src/main/java/io/metersphere/base/domain/MessageTask.java @@ -12,11 +12,9 @@ public class MessageTask implements Serializable { private String event; - private String userid; + private String userId; - private String username; - - private String tasktype; + private String taskType; private String webhook; diff --git a/backend/src/main/java/io/metersphere/base/domain/MessageTaskExample.java b/backend/src/main/java/io/metersphere/base/domain/MessageTaskExample.java index d596efbfd3..0fae8ffd12 100644 --- a/backend/src/main/java/io/metersphere/base/domain/MessageTaskExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/MessageTaskExample.java @@ -314,213 +314,143 @@ public class MessageTaskExample { return (Criteria) this; } - public Criteria andUseridIsNull() { - addCriterion("userId is null"); + public Criteria andUserIdIsNull() { + addCriterion("user_id is null"); return (Criteria) this; } - public Criteria andUseridIsNotNull() { - addCriterion("userId is not null"); + public Criteria andUserIdIsNotNull() { + addCriterion("user_id is not null"); return (Criteria) this; } - public Criteria andUseridEqualTo(String value) { - addCriterion("userId =", value, "userid"); + public Criteria andUserIdEqualTo(String value) { + addCriterion("user_id =", value, "userId"); return (Criteria) this; } - public Criteria andUseridNotEqualTo(String value) { - addCriterion("userId <>", value, "userid"); + public Criteria andUserIdNotEqualTo(String value) { + addCriterion("user_id <>", value, "userId"); return (Criteria) this; } - public Criteria andUseridGreaterThan(String value) { - addCriterion("userId >", value, "userid"); + public Criteria andUserIdGreaterThan(String value) { + addCriterion("user_id >", value, "userId"); return (Criteria) this; } - public Criteria andUseridGreaterThanOrEqualTo(String value) { - addCriterion("userId >=", value, "userid"); + public Criteria andUserIdGreaterThanOrEqualTo(String value) { + addCriterion("user_id >=", value, "userId"); return (Criteria) this; } - public Criteria andUseridLessThan(String value) { - addCriterion("userId <", value, "userid"); + public Criteria andUserIdLessThan(String value) { + addCriterion("user_id <", value, "userId"); return (Criteria) this; } - public Criteria andUseridLessThanOrEqualTo(String value) { - addCriterion("userId <=", value, "userid"); + public Criteria andUserIdLessThanOrEqualTo(String value) { + addCriterion("user_id <=", value, "userId"); return (Criteria) this; } - public Criteria andUseridLike(String value) { - addCriterion("userId like", value, "userid"); + public Criteria andUserIdLike(String value) { + addCriterion("user_id like", value, "userId"); return (Criteria) this; } - public Criteria andUseridNotLike(String value) { - addCriterion("userId not like", value, "userid"); + public Criteria andUserIdNotLike(String value) { + addCriterion("user_id not like", value, "userId"); return (Criteria) this; } - public Criteria andUseridIn(List values) { - addCriterion("userId in", values, "userid"); + public Criteria andUserIdIn(List values) { + addCriterion("user_id in", values, "userId"); return (Criteria) this; } - public Criteria andUseridNotIn(List values) { - addCriterion("userId not in", values, "userid"); + public Criteria andUserIdNotIn(List values) { + addCriterion("user_id not in", values, "userId"); return (Criteria) this; } - public Criteria andUseridBetween(String value1, String value2) { - addCriterion("userId between", value1, value2, "userid"); + public Criteria andUserIdBetween(String value1, String value2) { + addCriterion("user_id between", value1, value2, "userId"); return (Criteria) this; } - public Criteria andUseridNotBetween(String value1, String value2) { - addCriterion("userId not between", value1, value2, "userid"); + public Criteria andUserIdNotBetween(String value1, String value2) { + addCriterion("user_id not between", value1, value2, "userId"); return (Criteria) this; } - public Criteria andUsernameIsNull() { - addCriterion("userName is null"); + public Criteria andTaskTypeIsNull() { + addCriterion("task_type is null"); return (Criteria) this; } - public Criteria andUsernameIsNotNull() { - addCriterion("userName is not null"); + public Criteria andTaskTypeIsNotNull() { + addCriterion("task_type is not null"); return (Criteria) this; } - public Criteria andUsernameEqualTo(String value) { - addCriterion("userName =", value, "username"); + public Criteria andTaskTypeEqualTo(String value) { + addCriterion("task_type =", value, "taskType"); return (Criteria) this; } - public Criteria andUsernameNotEqualTo(String value) { - addCriterion("userName <>", value, "username"); + public Criteria andTaskTypeNotEqualTo(String value) { + addCriterion("task_type <>", value, "taskType"); return (Criteria) this; } - public Criteria andUsernameGreaterThan(String value) { - addCriterion("userName >", value, "username"); + public Criteria andTaskTypeGreaterThan(String value) { + addCriterion("task_type >", value, "taskType"); return (Criteria) this; } - public Criteria andUsernameGreaterThanOrEqualTo(String value) { - addCriterion("userName >=", value, "username"); + public Criteria andTaskTypeGreaterThanOrEqualTo(String value) { + addCriterion("task_type >=", value, "taskType"); return (Criteria) this; } - public Criteria andUsernameLessThan(String value) { - addCriterion("userName <", value, "username"); + public Criteria andTaskTypeLessThan(String value) { + addCriterion("task_type <", value, "taskType"); return (Criteria) this; } - public Criteria andUsernameLessThanOrEqualTo(String value) { - addCriterion("userName <=", value, "username"); + public Criteria andTaskTypeLessThanOrEqualTo(String value) { + addCriterion("task_type <=", value, "taskType"); return (Criteria) this; } - public Criteria andUsernameLike(String value) { - addCriterion("userName like", value, "username"); + public Criteria andTaskTypeLike(String value) { + addCriterion("task_type like", value, "taskType"); return (Criteria) this; } - public Criteria andUsernameNotLike(String value) { - addCriterion("userName not like", value, "username"); + public Criteria andTaskTypeNotLike(String value) { + addCriterion("task_type not like", value, "taskType"); return (Criteria) this; } - public Criteria andUsernameIn(List values) { - addCriterion("userName in", values, "username"); + public Criteria andTaskTypeIn(List values) { + addCriterion("task_type in", values, "taskType"); return (Criteria) this; } - public Criteria andUsernameNotIn(List values) { - addCriterion("userName not in", values, "username"); + public Criteria andTaskTypeNotIn(List values) { + addCriterion("task_type not in", values, "taskType"); return (Criteria) this; } - public Criteria andUsernameBetween(String value1, String value2) { - addCriterion("userName between", value1, value2, "username"); + public Criteria andTaskTypeBetween(String value1, String value2) { + addCriterion("task_type between", value1, value2, "taskType"); return (Criteria) this; } - public Criteria andUsernameNotBetween(String value1, String value2) { - addCriterion("userName not between", value1, value2, "username"); - return (Criteria) this; - } - - public Criteria andTasktypeIsNull() { - addCriterion("taskType is null"); - return (Criteria) this; - } - - public Criteria andTasktypeIsNotNull() { - addCriterion("taskType is not null"); - return (Criteria) this; - } - - public Criteria andTasktypeEqualTo(String value) { - addCriterion("taskType =", value, "tasktype"); - return (Criteria) this; - } - - public Criteria andTasktypeNotEqualTo(String value) { - addCriterion("taskType <>", value, "tasktype"); - return (Criteria) this; - } - - public Criteria andTasktypeGreaterThan(String value) { - addCriterion("taskType >", value, "tasktype"); - return (Criteria) this; - } - - public Criteria andTasktypeGreaterThanOrEqualTo(String value) { - addCriterion("taskType >=", value, "tasktype"); - return (Criteria) this; - } - - public Criteria andTasktypeLessThan(String value) { - addCriterion("taskType <", value, "tasktype"); - return (Criteria) this; - } - - public Criteria andTasktypeLessThanOrEqualTo(String value) { - addCriterion("taskType <=", value, "tasktype"); - return (Criteria) this; - } - - public Criteria andTasktypeLike(String value) { - addCriterion("taskType like", value, "tasktype"); - return (Criteria) this; - } - - public Criteria andTasktypeNotLike(String value) { - addCriterion("taskType not like", value, "tasktype"); - return (Criteria) this; - } - - public Criteria andTasktypeIn(List values) { - addCriterion("taskType in", values, "tasktype"); - return (Criteria) this; - } - - public Criteria andTasktypeNotIn(List values) { - addCriterion("taskType not in", values, "tasktype"); - return (Criteria) this; - } - - public Criteria andTasktypeBetween(String value1, String value2) { - addCriterion("taskType between", value1, value2, "tasktype"); - return (Criteria) this; - } - - public Criteria andTasktypeNotBetween(String value1, String value2) { - addCriterion("taskType not between", value1, value2, "tasktype"); + public Criteria andTaskTypeNotBetween(String value1, String value2) { + addCriterion("task_type not between", value1, value2, "taskType"); return (Criteria) this; } diff --git a/backend/src/main/java/io/metersphere/base/mapper/MessageTaskMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/MessageTaskMapper.xml index 7a6fe747af..84e78a37bf 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/MessageTaskMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/MessageTaskMapper.xml @@ -1,247 +1,228 @@ - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + AND ${criterion.condition} #{criterion.value} + + + AND ${criterion.condition} #{criterion.value} AND #{criterion.secondValue} + + + AND ${criterion.condition} + + #{listItem} + + + - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - id, `type`, event, userId, userName, taskType, webhook + + + + - - - - delete from message_task - where id = #{id,jdbcType=VARCHAR} + + + + + id, `type`, event, user_id, task_type, webhook + + + + + DELETE FROM message_task + WHERE id = #{id,jdbcType=VARCHAR} - - delete from message_task - - - - - - insert into message_task (id, `type`, event, - userId, userName, taskType, - webhook) - values (#{id,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR}, - #{userid,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, #{tasktype,jdbcType=VARCHAR}, - #{webhook,jdbcType=VARCHAR}) + + DELETE FROM message_task + + + + + + INSERT INTO message_task (id, `type`, event, + user_id, task_type, webhook + ) + VALUES (#{id,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR}, + #{userId,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}, #{webhook,jdbcType=VARCHAR} + ) - - insert into message_task - - - id, - - - `type`, - - - event, - - - userId, - - - userName, - - - taskType, - - - webhook, - - - - - #{id,jdbcType=VARCHAR}, - - - #{type,jdbcType=VARCHAR}, - - - #{event,jdbcType=VARCHAR}, - - - #{userid,jdbcType=VARCHAR}, - - - #{username,jdbcType=VARCHAR}, - - - #{tasktype,jdbcType=VARCHAR}, - - - #{webhook,jdbcType=VARCHAR}, - - - - - - update message_task - - - id = #{record.id,jdbcType=VARCHAR}, - - - `type` = #{record.type,jdbcType=VARCHAR}, - - - event = #{record.event,jdbcType=VARCHAR}, - - - userId = #{record.userid,jdbcType=VARCHAR}, - - - userName = #{record.username,jdbcType=VARCHAR}, - - - taskType = #{record.tasktype,jdbcType=VARCHAR}, - - - webhook = #{record.webhook,jdbcType=VARCHAR}, - - - - - - - - update message_task - set id = #{record.id,jdbcType=VARCHAR}, + + INSERT INTO message_task + + + id, + + + `type`, + + + event, + + + user_id, + + + task_type, + + + webhook, + + + + + #{id,jdbcType=VARCHAR}, + + + #{type,jdbcType=VARCHAR}, + + + #{event,jdbcType=VARCHAR}, + + + #{userId,jdbcType=VARCHAR}, + + + #{taskType,jdbcType=VARCHAR}, + + + #{webhook,jdbcType=VARCHAR}, + + + + + + UPDATE message_task + + + id = #{record.id,jdbcType=VARCHAR}, + + `type` = #{record.type,jdbcType=VARCHAR}, + + event = #{record.event,jdbcType=VARCHAR}, - userId = #{record.userid,jdbcType=VARCHAR}, - userName = #{record.username,jdbcType=VARCHAR}, - taskType = #{record.tasktype,jdbcType=VARCHAR}, - webhook = #{record.webhook,jdbcType=VARCHAR} - - - - - - update message_task - - - `type` = #{type,jdbcType=VARCHAR}, - - - event = #{event,jdbcType=VARCHAR}, - - - userId = #{userid,jdbcType=VARCHAR}, - - - userName = #{username,jdbcType=VARCHAR}, - - - taskType = #{tasktype,jdbcType=VARCHAR}, - - - webhook = #{webhook,jdbcType=VARCHAR}, - - - where id = #{id,jdbcType=VARCHAR} - - - update message_task - set `type` = #{type,jdbcType=VARCHAR}, + + + user_id = #{record.userId,jdbcType=VARCHAR}, + + + task_type = #{record.taskType,jdbcType=VARCHAR}, + + + webhook = #{record.webhook,jdbcType=VARCHAR}, + + + + + + + + UPDATE message_task + SET id = #{record.id,jdbcType=VARCHAR}, + `type` = #{record.type,jdbcType=VARCHAR}, + event = #{record.event,jdbcType=VARCHAR}, + user_id = #{record.userId,jdbcType=VARCHAR}, + task_type = #{record.taskType,jdbcType=VARCHAR}, + webhook = #{record.webhook,jdbcType=VARCHAR} + + + + + + UPDATE message_task + + + `type` = #{type,jdbcType=VARCHAR}, + + + event = #{event,jdbcType=VARCHAR}, + + + user_id = #{userId,jdbcType=VARCHAR}, + + + task_type = #{taskType,jdbcType=VARCHAR}, + + + webhook = #{webhook,jdbcType=VARCHAR}, + + + WHERE id = #{id,jdbcType=VARCHAR} + + + UPDATE message_task + SET `type` = #{type,jdbcType=VARCHAR}, event = #{event,jdbcType=VARCHAR}, - userId = #{userid,jdbcType=VARCHAR}, - userName = #{username,jdbcType=VARCHAR}, - taskType = #{tasktype,jdbcType=VARCHAR}, + user_id = #{userId,jdbcType=VARCHAR}, + task_type = #{taskType,jdbcType=VARCHAR}, webhook = #{webhook,jdbcType=VARCHAR} - where id = #{id,jdbcType=VARCHAR} + WHERE id = #{id,jdbcType=VARCHAR} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/notice/service/NoticeService.java b/backend/src/main/java/io/metersphere/notice/service/NoticeService.java index 4871143549..dd59718b8e 100644 --- a/backend/src/main/java/io/metersphere/notice/service/NoticeService.java +++ b/backend/src/main/java/io/metersphere/notice/service/NoticeService.java @@ -92,10 +92,9 @@ public class NoticeService { MessageTask message = new MessageTask(); message.setId(UUID.randomUUID().toString()); message.setEvent(n); - message.setTasktype(list.getTaskType()); - message.setUserid(m); + message.setTaskType(list.getTaskType()); + message.setUserId(m); message.setType(list.getType()); - message.setUsername("a"); message.setWebhook(list.getWebhook()); messageTaskMapper.insert(message); }); diff --git a/backend/src/main/resources/db/migration/V31__message_task.sql b/backend/src/main/resources/db/migration/V31__message_task.sql index bc4e7a3bad..e7c6e59c7a 100644 --- a/backend/src/main/resources/db/migration/V31__message_task.sql +++ b/backend/src/main/resources/db/migration/V31__message_task.sql @@ -1,12 +1,12 @@ -create table message_task -( - id varchar(255) not null, - type varchar(255) not null comment '消息类型', - event varchar(255) not null comment '通知事件类型', - userId varchar(500) not null comment '接收人id', - userName varchar(500) not null comment '接收人姓名', - taskType varchar(255) not null, - webhook varchar(255) not null comment 'webhook地址', - constraint message_manage_pk - primary key (id) -)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; \ No newline at end of file +CREATE TABLE IF NOT EXISTS message_task ( + id varchar(50) NOT NULL, + type varchar(50) NOT NULL COMMENT '消息类型', + event varchar(255) NOT NULL COMMENT '通知事件类型', + user_id varchar(50) NOT NULL COMMENT '接收人id', + task_type varchar(64) NOT NULL, + webhook varchar(255) NOT NULL COMMENT 'webhook地址', + CONSTRAINT message_manage_pk + PRIMARY KEY (id) +) + ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4; \ No newline at end of file