簡易個人部落格系統純後台開發(二資料庫設計)

2021-09-12 00:11:58 字數 3233 閱讀 3635

1、user

2、blog

3、class(blog分類)

4、user_class(user對應的blog分類)

建表語句如下:

/*

mysql backup

source server version: 8.0.15

source database: myblog

date: 2019/3/5 18:06:25

*/set foreign_key_checks=0;

-- ----------------------------

-- table structure for `blog`

-- ----------------------------

drop table if exists `blog`;

create table `blog` (

`blog_id` int(11) not null auto_increment,

`user_id` int(11) not null,

`class_id` int(11) not null,

`blog_title` varchar(50) character set utf8 collate utf8_general_ci default null,

`blog_content` text character set utf8 collate utf8_general_ci not null,

`blog_label` varchar(10) character set utf8 collate utf8_general_ci default null,

`view_times` int(11) default null,

`create_time` date default null,

primary key (`blog_id`),

key `blog_ibfk_1` (`user_id`),

key `blog_ibfk_2` (`class_id`),

constraint `blog_ibfk_1` foreign key (`user_id`) references `user` (`user_id`) on delete restrict on update restrict,

constraint `blog_ibfk_2` foreign key (`class_id`) references `class` (`class_id`) on delete restrict on update restrict

) engine=innodb auto_increment=15 default charset=utf8;

-- ----------------------------

-- table structure for `class`

-- ----------------------------

drop table if exists `class`;

create table `class` (

`class_id` int(11) not null,

`class_content` varchar(255) not null,

primary key (`class_id`)

) engine=innodb default charset=utf8;

-- ----------------------------

-- table structure for `user`

-- ----------------------------

drop table if exists `user`;

create table `user` (

`user_id` int(11) not null auto_increment,

`user_name` varchar(20) not null,

`password` varchar(20) not null,

primary key (`user_id`)

) engine=innodb auto_increment=7 default charset=latin1;

-- ----------------------------

-- table structure for `user_class`

-- ----------------------------

drop table if exists `user_class`;

create table `user_class` (

`user_id` int(11) not null,

`class_id` int(11) not null,

`number` int(11) default null,

primary key (`user_id`,`class_id`)

) engine=innodb default charset=utf8;

-- ----------------------------

-- records

-- ----------------------------

insert into `blog` values ('8','1','3','妯″潡嫻嬭瘯','寧屾湜鎴愬姛','鍔犳補',null,'2019-03-05'), ('9','1','3','qqq','鎴愮亴鐏岀亴鐏?,'iayou',null,null), ('10','2','4','鐨勬拻','鐖變笂錼︽嫮','钀ㄩ暱鐨?,null,null), ('13','1','4','嫻嬭瘯','緇堜簬鍐欏畬涓€涓簡','~',null,'2019-03-05'), ('14','1','4','嫻嬭瘯','緇堜簬鍐欏畬涓€涓簡','~',null,'2019-03-05');

insert into `class` values ('1','闅忕瑪'), ('2','鎬葷粨'), ('3','瀹炰範'), ('4','鍏朵粬');

insert into `user` values ('1','machao1','1'), ('2','machao2','2'), ('3','machao','2'), ('4','success','1'), ('5','machao44','1'), ('6','bao','1');

insert into `user_class` values ('1','3','2'), ('1','4','2'), ('2','4','1');

Springboot個人部落格系統 5 後台登入

首先,實現後台登入需要對前端接收的表單資料進行校驗,需要訪問資料庫,所以需要乙個userservice進行資料校驗,呼叫userrepository訪問資料庫,實現如下 userservice service public class userserviceimpl implements users...

個人部落格四 註冊登入退出功能後台開發

宣告 本部落格的註冊登入退出功能將使用django allauth,參考資源如下 django allaut 檔 django allauth教程 新增storm相關應用 storm 新增allauth相關應用 django.contrib.sites allauth allauth.account...

個人部落格四 註冊登入退出功能後台開發

宣告 本部落格的註冊登入退出功能將使用django allauth,參考資源如下 django allaut 檔 django allauth教程 新增storm相關應用 storm 新增allauth相關應用 django.contrib.sites allauth allauth.account...