SpringBoot+Vue前后端分离的博客系统——数据库建表

# 文章详情表
drop table article_info;

create table article_info(
    aid int not null auto_increment comment '文章ID',
    authorId int(11) not null comment '作者ID',
    categoryId int(11) comment '分类ID',
    title varchar(50) not null comment '文章标题',
    cover varchar(255) comment '封面图',
    content longtext not null comment '内容',
    publishTime datetime comment '发布时间',
    updateTime datetime comment '修改时间',
    isTop tinyint(1) comment '是否置顶,0否1是',
    isDraft tinyint(1) comment '是否为草稿,0否1是',
    idDelete tinyint(1) comment '是否删除,0否1是',
    primary key(aid) using btree,
    foreign key(categoryId) references article_category(cid),
    foreign key(authorId) references sys_admin_info(id)
);

# 文章分类表
create table article_category(
    cid int(11) not null auto_increment comment '分类ID',
    name varchar(30) not null comment '分类名称',
    createTime datetime comment '创建时间',
    primary key(cid) using btree
);

drop table sys_admin_info;
# 管理员信息表
create table sys_admin_info(
    id int(11) not null auto_increment comment '管理员ID',
    account varchar(30) comment '账号,root,admin,test',
    nickname varchar(32) default '橘子爱哭' comment '昵称,自定义',
    username varchar(50) comment '用户名,root,test,visitor',
    password varchar(100) comment '密码',
    email varchar(50) comment '邮箱',
    avatar varchar(255) comment '管理员头像',
    introduce varchar(255) comment '管理员个人介绍',
    site varchar(255) comment '个人网站',
    address varchar(50) comment '登录地址',
    position varchar(100) comment '登录地理位置',
    createTime datetime comment '创建时间',
    lastLoginTime datetime comment '上次登录时间',
    enabled tinyint(1) comment '是否禁用,0否1是',
    primary key(id) using btree
);

# 文章标签表
create table article_tag(
    tid int(11) not null auto_increment comment '标签ID',
    name varchar(20) not null comment '标签名称',
    createTime datetime comment '创建时间',
    primary key(tid) using btree
);

drop table article_blog_tag;
# 文章标签表
create table article_blog_tag(
  id int(11) not null auto_increment comment '标签关联ID',
  articleId int(11) not null comment '文章ID',
  tagId int(11) not null comment '标签ID',
  primary key(id) using btree,
  foreign key(articleId) references article_info(aid),
  foreign key(tagId) references article_tag(tid)
);


drop table sys_role;
# 角色表
create table sys_role(
    id int(11) not null auto_increment comment '角色ID',
    name varchar(20) comment '角色名称,超级管理员,普通管理员,游客',
    roleName varchar(20) comment '角色英文名称',
    createTime datetime comment '创建时间',
    updateTime datetime comment '更新时间',
    enabled tinyint(1) comment '是否禁用,0否1是',
    primary key(id) using btree
);

drop table sys_admin_role;
# 管理员角色关联表
create table sys_admin_role(
    id int(11) not null auto_increment comment '表ID',
    adminId int(11) comment '管理员ID',
    roleId int(11) comment '角色ID',
    primary key(id) using btree,
    foreign key(adminId) references sys_admin_info(id),
    foreign key(roleId) references sys_role(id)
);

drop table sys_log;
# 操作日志
create table sys_log(
    id int(11) not null auto_increment comment '操作ID',
    username varchar(50) comment '用户名',
    method varchar(20) comment '请求方式',
    address varchar(50) comment '登录地址',
    position varchar(100) comment '登录地理位置',
    createTime datetime comment '创建时间',
    primary key(id) using btree
);

drop table sys_user_info;
# 普通用户表
create table sys_user_info(
    id int(11) not null auto_increment comment '用户ID',
    account varchar(20) default 'orange' comment '账号,rich,orange,banana,apple',
    nickname varchar(50) comment '昵称,普通用户',
    username varchar(50) comment '用户名,consumer',
    password varchar(100) comment '密码',
    email varchar(50) comment '邮箱',
    avatar varchar(255) comment '用户头像',
    address varchar(50) comment '登录地址',
    position varchar(100) comment '登录地理位置',
    createTime datetime comment '创建时间',
    lastLoginTime datetime comment '上次登录时间',
    enabled tinyint(1) comment '是否禁用,0否1是',
    primary key(id) using btree
);

drop table tb_comment;
# 评论表
create table tb_comment(
    id int(11) not null auto_increment comment '评论ID',
    userId int(11) not null comment '评论用户ID',
    articleId int(11) comment '评论文章ID',
    comment text not null comment '评论内容',
    createTime datetime not null comment '评论时间',
    replyId int(11) comment '回复用户ID',
    parentId int(11) comment '父评论ID',
    isDelete tinyint(1) comment '是否删除,0否1是',
    primary key(id) using btree
);

# 留言表
create table tb_message(
    id int(11) not null comment '主键ID',
    address varchar(50) not null comment '用户IP地址',
    position varchar(255) not null comment '用户地理位置',
    nickname varchar(50) not null comment '用户昵称',
    avatar varchar(255) not null comment '用户头像',
    content varchar(255) not null comment '评论内容',
    createTime datetime not null comment '评论创建时间',
    primary key(id) using btree
);

drop table tb_friendlink;
# 友情链接表
create table tb_friendLink(
    id int(11) not null auto_increment comment '表ID',
    name varchar(20) not null comment '链接名称',
    avatar varchar(255) not null comment '头像地址',
    address varchar(50) not null comment '链接地址',
    introduce varchar(255) not null comment '网站简介',
    createTime datetime not null comment '创建时间',
    primary key(id) using btree
);


# 插入数据
INSERT INTO `sys_admin_role` VALUES (1,1,1);
INSERT INTO `sys_admin_role` VALUES (2,1,2);


INSERT INTO `article_blog_tag` VALUES (1,1,2);
INSERT INTO `article_blog_tag` VALUES (2,1,1);

INSERT INTO `article_info` VALUES (1,1,1,'SpringBoot整合Vue实践',null ,'一个简易的SpringBoot整合Vue的Demo,手把手教你从入门到实践','2021-08-01 23:21:41',null,1,0,0);


INSERT INTO `article_tag` VALUES (1,'SpringBoot','2021-08-01 23:07:23');
INSERT INTO `article_tag` VALUES (2,'Vue','2021-08-01 23:08:10');


INSERT INTO `sys_admin_info` VALUES (1,'orange','橘子爱哭','root','12334567','501049950@qq.com','https://cdn.jsdelivr.net/gh/OriginalCoder0/gallery@master/images/1627829488989-favicon.png','一入 IT 深似海,从此学习无绝期!求知若饥,虚心若愚,只谈技术,莫问前程!注重细节,用心写好文!','www.xwrich.cn','127.0.0.1','中国湖北省武汉市','2021-08-01 22:23:01','2021-08-01 22:23:14',1);
INSERT INTO `sys_admin_info` VALUES (2,'banana','白山环绕黑水','admin','123666','1720929001@qq.com','https://cdn.jsdelivr.net/gh/OriginalCoder0/gallery@master/images/1627829488989-favicon.png','一入 IT 深似海,从此学习无绝期!求知若饥,虚心若愚,只谈技术,莫问前程!注重细节,用心写好文!','www.xwrich.cn','127.0.0.1','中国湖北省武汉市','2021-08-01 22:23:01','2021-08-01 22:23:14',1);


INSERT INTO `sys_role` VALUES (1,'超级管理员','root','2021-08-01 22:55:44',null,1);
INSERT INTO `sys_role` VALUES (2,'普通管理员','admin','2021-08-01 22:56:21',null,1);


INSERT INTO `article_category` VALUES (1, 'C/C++', '2021-03-20 22:02:43');
INSERT INTO `article_category` VALUES (2, 'Mybatis/MyBatis-Plus', '2021-07-10 22:05:03');
INSERT INTO `article_category` VALUES (3, 'SpringBoot', '2021-07-10 22:05:13');
INSERT INTO `article_category` VALUES (4, 'Linux', '2021-07-10 22:05:22');
INSERT INTO `article_category` VALUES (5, 'MySQL', '2021-07-10 10:25:42');
INSERT INTO `article_category` VALUES (6, 'Oracle', '2021-07-10 16:05:18');
INSERT INTO `article_category` VALUES (7, 'JavaSE基础', '2021-07-10 22:05:38');
INSERT INTO `article_category` VALUES (8, 'Docker', '2021-07-10 14:06:14');
INSERT INTO `article_category` VALUES (9, 'SSM', '2021-07-13 01:29:04');
INSERT INTO `article_category` VALUES (10, 'Vue', '2021-07-13 01:31:17');

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

王菜鸟

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值