refactor: 去掉message_task中的username字段,字段名以下划线分割

This commit is contained in:
Captain.B 2020-10-19 13:17:31 +08:00
parent ff5a52d966
commit d2b1473c71
5 changed files with 286 additions and 378 deletions

View File

@ -12,11 +12,9 @@ public class MessageTask implements Serializable {
private String event; private String event;
private String userid; private String userId;
private String username; private String taskType;
private String tasktype;
private String webhook; private String webhook;

View File

@ -314,213 +314,143 @@ public class MessageTaskExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUseridIsNull() { public Criteria andUserIdIsNull() {
addCriterion("userId is null"); addCriterion("user_id is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUseridIsNotNull() { public Criteria andUserIdIsNotNull() {
addCriterion("userId is not null"); addCriterion("user_id is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUseridEqualTo(String value) { public Criteria andUserIdEqualTo(String value) {
addCriterion("userId =", value, "userid"); addCriterion("user_id =", value, "userId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUseridNotEqualTo(String value) { public Criteria andUserIdNotEqualTo(String value) {
addCriterion("userId <>", value, "userid"); addCriterion("user_id <>", value, "userId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUseridGreaterThan(String value) { public Criteria andUserIdGreaterThan(String value) {
addCriterion("userId >", value, "userid"); addCriterion("user_id >", value, "userId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUseridGreaterThanOrEqualTo(String value) { public Criteria andUserIdGreaterThanOrEqualTo(String value) {
addCriterion("userId >=", value, "userid"); addCriterion("user_id >=", value, "userId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUseridLessThan(String value) { public Criteria andUserIdLessThan(String value) {
addCriterion("userId <", value, "userid"); addCriterion("user_id <", value, "userId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUseridLessThanOrEqualTo(String value) { public Criteria andUserIdLessThanOrEqualTo(String value) {
addCriterion("userId <=", value, "userid"); addCriterion("user_id <=", value, "userId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUseridLike(String value) { public Criteria andUserIdLike(String value) {
addCriterion("userId like", value, "userid"); addCriterion("user_id like", value, "userId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUseridNotLike(String value) { public Criteria andUserIdNotLike(String value) {
addCriterion("userId not like", value, "userid"); addCriterion("user_id not like", value, "userId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUseridIn(List<String> values) { public Criteria andUserIdIn(List<String> values) {
addCriterion("userId in", values, "userid"); addCriterion("user_id in", values, "userId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUseridNotIn(List<String> values) { public Criteria andUserIdNotIn(List<String> values) {
addCriterion("userId not in", values, "userid"); addCriterion("user_id not in", values, "userId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUseridBetween(String value1, String value2) { public Criteria andUserIdBetween(String value1, String value2) {
addCriterion("userId between", value1, value2, "userid"); addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUseridNotBetween(String value1, String value2) { public Criteria andUserIdNotBetween(String value1, String value2) {
addCriterion("userId not between", value1, value2, "userid"); addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUsernameIsNull() { public Criteria andTaskTypeIsNull() {
addCriterion("userName is null"); addCriterion("task_type is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUsernameIsNotNull() { public Criteria andTaskTypeIsNotNull() {
addCriterion("userName is not null"); addCriterion("task_type is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUsernameEqualTo(String value) { public Criteria andTaskTypeEqualTo(String value) {
addCriterion("userName =", value, "username"); addCriterion("task_type =", value, "taskType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUsernameNotEqualTo(String value) { public Criteria andTaskTypeNotEqualTo(String value) {
addCriterion("userName <>", value, "username"); addCriterion("task_type <>", value, "taskType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUsernameGreaterThan(String value) { public Criteria andTaskTypeGreaterThan(String value) {
addCriterion("userName >", value, "username"); addCriterion("task_type >", value, "taskType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUsernameGreaterThanOrEqualTo(String value) { public Criteria andTaskTypeGreaterThanOrEqualTo(String value) {
addCriterion("userName >=", value, "username"); addCriterion("task_type >=", value, "taskType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUsernameLessThan(String value) { public Criteria andTaskTypeLessThan(String value) {
addCriterion("userName <", value, "username"); addCriterion("task_type <", value, "taskType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUsernameLessThanOrEqualTo(String value) { public Criteria andTaskTypeLessThanOrEqualTo(String value) {
addCriterion("userName <=", value, "username"); addCriterion("task_type <=", value, "taskType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUsernameLike(String value) { public Criteria andTaskTypeLike(String value) {
addCriterion("userName like", value, "username"); addCriterion("task_type like", value, "taskType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUsernameNotLike(String value) { public Criteria andTaskTypeNotLike(String value) {
addCriterion("userName not like", value, "username"); addCriterion("task_type not like", value, "taskType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUsernameIn(List<String> values) { public Criteria andTaskTypeIn(List<String> values) {
addCriterion("userName in", values, "username"); addCriterion("task_type in", values, "taskType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUsernameNotIn(List<String> values) { public Criteria andTaskTypeNotIn(List<String> values) {
addCriterion("userName not in", values, "username"); addCriterion("task_type not in", values, "taskType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUsernameBetween(String value1, String value2) { public Criteria andTaskTypeBetween(String value1, String value2) {
addCriterion("userName between", value1, value2, "username"); addCriterion("task_type between", value1, value2, "taskType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUsernameNotBetween(String value1, String value2) { public Criteria andTaskTypeNotBetween(String value1, String value2) {
addCriterion("userName not between", value1, value2, "username"); addCriterion("task_type not between", value1, value2, "taskType");
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<String> values) {
addCriterion("taskType in", values, "tasktype");
return (Criteria) this;
}
public Criteria andTasktypeNotIn(List<String> 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");
return (Criteria) this; return (Criteria) this;
} }

View File

@ -2,13 +2,12 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.MessageTaskMapper"> <mapper namespace="io.metersphere.base.mapper.MessageTaskMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.MessageTask"> <resultMap id="BaseResultMap" type="io.metersphere.base.domain.MessageTask">
<id column="id" jdbcType="VARCHAR" property="id"/> <id column="id" jdbcType="VARCHAR" property="id" />
<result column="type" jdbcType="VARCHAR" property="type"/> <result column="type" jdbcType="VARCHAR" property="type" />
<result column="event" jdbcType="VARCHAR" property="event"/> <result column="event" jdbcType="VARCHAR" property="event" />
<result column="userId" jdbcType="VARCHAR" property="userid"/> <result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="userName" jdbcType="VARCHAR" property="username"/> <result column="task_type" jdbcType="VARCHAR" property="taskType" />
<result column="taskType" jdbcType="VARCHAR" property="tasktype"/> <result column="webhook" jdbcType="VARCHAR" property="webhook" />
<result column="webhook" jdbcType="VARCHAR" property="webhook"/>
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -21,15 +20,14 @@
and ${criterion.condition} and ${criterion.condition}
</when> </when>
<when test="criterion.singleValue"> <when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value} AND ${criterion.condition} #{criterion.value}
</when> </when>
<when test="criterion.betweenValue"> <when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} AND ${criterion.condition} #{criterion.value} AND #{criterion.secondValue}
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} AND ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
@ -51,15 +49,14 @@
and ${criterion.condition} and ${criterion.condition}
</when> </when>
<when test="criterion.singleValue"> <when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value} AND ${criterion.condition} #{criterion.value}
</when> </when>
<when test="criterion.betweenValue"> <when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} AND ${criterion.condition} #{criterion.value} AND #{criterion.secondValue}
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} AND ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
@ -71,49 +68,48 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, `type`, event, userId, userName, taskType, webhook id, `type`, event, user_id, task_type, webhook
</sql> </sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" <select id="selectByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" resultMap="BaseResultMap">
resultMap="BaseResultMap"> SELECT
select
<if test="distinct"> <if test="distinct">
distinct DISTINCT
</if> </if>
<include refid="Base_Column_List"/> <include refid="Base_Column_List" />
from message_task FROM message_task
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause" />
</if> </if>
<if test="orderByClause != null"> <if test="orderByClause != null">
order by ${orderByClause} ORDER BY ${orderByClause}
</if> </if>
</select> </select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List" />
from message_task FROM message_task
where id = #{id,jdbcType=VARCHAR} WHERE id = #{id,jdbcType=VARCHAR}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String"> <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from message_task DELETE FROM message_task
where id = #{id,jdbcType=VARCHAR} WHERE id = #{id,jdbcType=VARCHAR}
</delete> </delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.MessageTaskExample"> <delete id="deleteByExample" parameterType="io.metersphere.base.domain.MessageTaskExample">
delete from message_task DELETE FROM message_task
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause" />
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.base.domain.MessageTask"> <insert id="insert" parameterType="io.metersphere.base.domain.MessageTask">
insert into message_task (id, `type`, event, INSERT INTO message_task (id, `type`, event,
userId, userName, taskType, user_id, task_type, webhook
webhook) )
values (#{id,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR}, VALUES (#{id,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR},
#{userid,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, #{tasktype,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}, #{webhook,jdbcType=VARCHAR}
#{webhook,jdbcType=VARCHAR}) )
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.MessageTask"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.MessageTask">
insert into message_task INSERT INTO message_task
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
id, id,
@ -124,14 +120,11 @@
<if test="event != null"> <if test="event != null">
event, event,
</if> </if>
<if test="userid != null"> <if test="userId != null">
userId, user_id,
</if> </if>
<if test="username != null"> <if test="taskType != null">
userName, task_type,
</if>
<if test="tasktype != null">
taskType,
</if> </if>
<if test="webhook != null"> <if test="webhook != null">
webhook, webhook,
@ -147,29 +140,25 @@
<if test="event != null"> <if test="event != null">
#{event,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR},
</if> </if>
<if test="userid != null"> <if test="userId != null">
#{userid,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
</if> </if>
<if test="username != null"> <if test="taskType != null">
#{username,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR},
</if>
<if test="tasktype != null">
#{tasktype,jdbcType=VARCHAR},
</if> </if>
<if test="webhook != null"> <if test="webhook != null">
#{webhook,jdbcType=VARCHAR}, #{webhook,jdbcType=VARCHAR},
</if> </if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" <select id="countByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" resultType="java.lang.Long">
resultType="java.lang.Long"> SELECT count(*) FROM message_task
select count(*) from message_task
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause" />
</if> </if>
</select> </select>
<update id="updateByExampleSelective" parameterType="map"> <update id="updateByExampleSelective" parameterType="map">
update message_task UPDATE message_task
<set> <set>
<if test="record.id != null"> <if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR}, id = #{record.id,jdbcType=VARCHAR},
@ -180,38 +169,34 @@
<if test="record.event != null"> <if test="record.event != null">
event = #{record.event,jdbcType=VARCHAR}, event = #{record.event,jdbcType=VARCHAR},
</if> </if>
<if test="record.userid != null"> <if test="record.userId != null">
userId = #{record.userid,jdbcType=VARCHAR}, user_id = #{record.userId,jdbcType=VARCHAR},
</if> </if>
<if test="record.username != null"> <if test="record.taskType != null">
userName = #{record.username,jdbcType=VARCHAR}, task_type = #{record.taskType,jdbcType=VARCHAR},
</if>
<if test="record.tasktype != null">
taskType = #{record.tasktype,jdbcType=VARCHAR},
</if> </if>
<if test="record.webhook != null"> <if test="record.webhook != null">
webhook = #{record.webhook,jdbcType=VARCHAR}, webhook = #{record.webhook,jdbcType=VARCHAR},
</if> </if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
update message_task UPDATE message_task
set id = #{record.id,jdbcType=VARCHAR}, SET id = #{record.id,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR}, `type` = #{record.type,jdbcType=VARCHAR},
event = #{record.event,jdbcType=VARCHAR}, event = #{record.event,jdbcType=VARCHAR},
userId = #{record.userid,jdbcType=VARCHAR}, user_id = #{record.userId,jdbcType=VARCHAR},
userName = #{record.username,jdbcType=VARCHAR}, task_type = #{record.taskType,jdbcType=VARCHAR},
taskType = #{record.tasktype,jdbcType=VARCHAR},
webhook = #{record.webhook,jdbcType=VARCHAR} webhook = #{record.webhook,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.MessageTask"> <update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.MessageTask">
update message_task UPDATE message_task
<set> <set>
<if test="type != null"> <if test="type != null">
`type` = #{type,jdbcType=VARCHAR}, `type` = #{type,jdbcType=VARCHAR},
@ -219,29 +204,25 @@
<if test="event != null"> <if test="event != null">
event = #{event,jdbcType=VARCHAR}, event = #{event,jdbcType=VARCHAR},
</if> </if>
<if test="userid != null"> <if test="userId != null">
userId = #{userid,jdbcType=VARCHAR}, user_id = #{userId,jdbcType=VARCHAR},
</if> </if>
<if test="username != null"> <if test="taskType != null">
userName = #{username,jdbcType=VARCHAR}, task_type = #{taskType,jdbcType=VARCHAR},
</if>
<if test="tasktype != null">
taskType = #{tasktype,jdbcType=VARCHAR},
</if> </if>
<if test="webhook != null"> <if test="webhook != null">
webhook = #{webhook,jdbcType=VARCHAR}, webhook = #{webhook,jdbcType=VARCHAR},
</if> </if>
</set> </set>
where id = #{id,jdbcType=VARCHAR} WHERE id = #{id,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.MessageTask"> <update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.MessageTask">
update message_task UPDATE message_task
set `type` = #{type,jdbcType=VARCHAR}, SET `type` = #{type,jdbcType=VARCHAR},
event = #{event,jdbcType=VARCHAR}, event = #{event,jdbcType=VARCHAR},
userId = #{userid,jdbcType=VARCHAR}, user_id = #{userId,jdbcType=VARCHAR},
userName = #{username,jdbcType=VARCHAR}, task_type = #{taskType,jdbcType=VARCHAR},
taskType = #{tasktype,jdbcType=VARCHAR},
webhook = #{webhook,jdbcType=VARCHAR} webhook = #{webhook,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR} WHERE id = #{id,jdbcType=VARCHAR}
</update> </update>
</mapper> </mapper>

View File

@ -92,10 +92,9 @@ public class NoticeService {
MessageTask message = new MessageTask(); MessageTask message = new MessageTask();
message.setId(UUID.randomUUID().toString()); message.setId(UUID.randomUUID().toString());
message.setEvent(n); message.setEvent(n);
message.setTasktype(list.getTaskType()); message.setTaskType(list.getTaskType());
message.setUserid(m); message.setUserId(m);
message.setType(list.getType()); message.setType(list.getType());
message.setUsername("a");
message.setWebhook(list.getWebhook()); message.setWebhook(list.getWebhook());
messageTaskMapper.insert(message); messageTaskMapper.insert(message);
}); });

View File

@ -1,12 +1,12 @@
create table message_task CREATE TABLE IF NOT EXISTS message_task (
( id varchar(50) NOT NULL,
id varchar(255) not null, type varchar(50) NOT NULL COMMENT '消息类型',
type varchar(255) not null comment '消息类型', event varchar(255) NOT NULL COMMENT '通知事件类型',
event varchar(255) not null comment '通知事件类型', user_id varchar(50) NOT NULL COMMENT '接收人id',
userId varchar(500) not null comment '接收人id', task_type varchar(64) NOT NULL,
userName varchar(500) not null comment '接收人姓名', webhook varchar(255) NOT NULL COMMENT 'webhook地址',
taskType varchar(255) not null, CONSTRAINT message_manage_pk
webhook varchar(255) not null comment 'webhook地址', PRIMARY KEY (id)
constraint message_manage_pk )
primary key (id) ENGINE = InnoDB
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; DEFAULT CHARSET = utf8mb4;