数据库字段新增

1、数据库新增 source、extra 两个字段分别用来标识信息来源和额外附带的信息
2、调整因上述原因导致的必要的Java代码
This commit is contained in:
巴拉迪维 2021-09-09 13:04:55 +08:00
parent e2f859dd8e
commit 8d5b23c433
7 changed files with 72 additions and 4 deletions

View File

@ -1,4 +1,7 @@
USE gitlink_notification;
DROP TABLE IF EXISTS `gns_platform_info`;
CREATE TABLE `gns_platform_info` (
`id` INT NOT NULL AUTO_INCREMENT,
@ -28,5 +31,8 @@ CREATE TABLE `gitlink_sys_notification` (
) ENGINE=INNODB DEFAULT CHARSET=utf8mb3;
-- 2021-09-07 区分系统消息类型
ALTER TABLE gitlink_sys_notification ADD COLUMN
( `type` TINYINT(4) NOT NULL DEFAULT 1 COMMENT '消息类型: 1系统消息2@我');
ALTER TABLE gitlink_sys_notification ADD COLUMN (`type` TINYINT(4) NOT NULL DEFAULT 1 COMMENT '消息类型: 1系统消息2@我');
-- 2021-09-09 新增 source 字段区分消息来源、新增 extra 字段保存额外信息
ALTER TABLE gitlink_sys_notification ADD source varchar(250) NULL COMMENT '消息来源';
ALTER TABLE gitlink_sys_notification ADD extra TEXT NULL COMMENT '额外信息(备用字段)';

View File

@ -0,0 +1,2 @@
docker-compose -f services.yml down
docker volume prune -f

View File

@ -13,6 +13,7 @@ services:
- ${DOCKER_DATA_PATH}/mysql:/var/lib/mysql
- ${SQL_SCRIPT_PATH}/xxl-job-structure.sql:/docker-entrypoint-initdb.d/0000.sql
- ${SQL_SCRIPT_PATH}/gns-notification.sql:/docker-entrypoint-initdb.d/0001.sql
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
ports:
- ${MYSQL_LOCAL_PORT}:3306
networks:

View File

@ -0,0 +1 @@
docker-compose -f services.yml up

View File

@ -32,6 +32,26 @@ public class SysNotification {
@JsonIgnore
private Integer isDelete;
private String source;
private String extra;
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getExtra() {
return extra;
}
public void setExtra(String extra) {
this.extra = extra;
}
public Integer getId() {
return id;
}

View File

@ -30,6 +30,28 @@ public class NewSysNotificationVo {
@NotNull
private Integer type;
@ApiModelProperty(value = "消息来源")
private String source;
@ApiModelProperty(value = "额外信息")
private String extra;
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getExtra() {
return extra;
}
public void setExtra(String extra) {
this.extra = extra;
}
public String getPlatform() {
return platform;
}

View File

@ -13,7 +13,7 @@
<result column="is_delete" property="isDelete" jdbcType="BIT"/>
</resultMap>
<sql id="Base_Column_List">
id, sender, receiver, content, notification_url, created_at, status, type, is_delete
id, sender, receiver, content, notification_url, created_at, status, type, is_delete, status, extra
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select
@ -32,6 +32,7 @@
values (#{record.id,jdbcType=INTEGER}, #{record.sender,jdbcType=INTEGER}, #{record.receiver,jdbcType=INTEGER},
#{record.content,jdbcType=VARCHAR}, #{record.notificationUrl,jdbcType=VARCHAR},
#{record.status,jdbcType=TINYINT}, #{record.type,jdbcType=TINYINT})
#{record.source,jdbcType=VARCHAR}, #{record.extra,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="cn.org.gitlink.notification.model.dao.entity.SysNotification">
insert into ${platform}_sys_notification
@ -92,6 +93,12 @@
<if test="record.isDelete != null">
#{record.isDelete,jdbcType=BIT},
</if>
<if test="record.source != null">
#{record.source,jdbcType=VARCHAR},
</if>
<if test="record.extra != null">
#{record.extra,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective"
@ -122,6 +129,12 @@
<if test="record.isDelete != null">
is_delete = #{record.isDelete,jdbcType=BIT},
</if>
<if test="record.source != null">
source = #{record.source,jdbcType=VARCHAR},
</if>
<if test="record.extra != null">
extra = #{record.extra,jdbcType=VARCHAR},
</if>
</set>
where id = #{record.id,jdbcType=INTEGER}
</update>
@ -134,8 +147,11 @@
created_at = #{createdAt,jdbcType=TIMESTAMP},
status = #{status,jdbcType=TINYINT},
type = #{type,jdbcType=TINYINT},
is_delete = #{isDelete,jdbcType=BIT}
is_delete = #{isDelete,jdbcType=BIT},
source = #{source,jdbcType=VARCHAR}
extra = #{extra,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateStatusByNotificationId">
update ${platform}_sys_notification set status = #{status} where id in (${notificationIds})