diff --git "a/\345\271\262\347\272\257\346\254\243/2024.0913 \347\275\221\344\270\212\344\271\246\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237\347\232\204\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241(2).md" "b/\345\271\262\347\272\257\346\254\243/2024.0913 \347\275\221\344\270\212\344\271\246\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237\347\232\204\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241(2).md" new file mode 100644 index 0000000000000000000000000000000000000000..023ceb713ecf78048bd667cc6fd7004b75353309 --- /dev/null +++ "b/\345\271\262\347\272\257\346\254\243/2024.0913 \347\275\221\344\270\212\344\271\246\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237\347\232\204\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241(2).md" @@ -0,0 +1,324 @@ +# 20240913网上书店管理系统的数据库设计(2) + +## 一、数据库设计 + +**1、分类表** + +- 分类编号 + +- 分类名称 + + +**2、图书信息表** + +- 图书编号 +- 图书名称 +- 图书封面 +- 图书价格 +- 作者 +- 出版日期 +- 定价 +- 库存 +- 状态(订单上下架) +- ISBN +- 图书简介 +- 销量 + +**3、作者信息表** + +- 作者编号 +- 作者姓名 +- 性别 +- 头像 +- 简介 + +**4、图库** + +图片编号 + +图片 + +图片路径 + +上传日期 + +**5、出版社** + +- 出版社编号 +- 出版社名称 +- 出版社地址 +- 联系电话 +- 电子邮箱 + +**6、用户** + +- 用户编号 +- 用户姓名 +- 账号 +- 密码 +- 角色 +- 手机号码 +- 收货地址 + +**7、用户收货地址** + +- 收货地址编号 +- 用户编号 +- 收货地址 + +**8、图书简介表** + +- 图书简介编号 +- 图书简介 + +PD思路图 + +CDM + +![image-20240914112232968](https://gitee.com/gcxxl/note-sheet-bed/raw/master/images/202409141122083.png) + +LDM + +![image-20240914112313167](https://gitee.com/gcxxl/note-sheet-bed/raw/master/images/202409141123330.png) + +PDM + +![image-20240914112412452](https://gitee.com/gcxxl/note-sheet-bed/raw/master/images/202409141124584.png) + +SQL语句 + +```sql +create database book1_online; + use book1_online; +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2024/9/14 9:53:42 */ +/*==============================================================*/ + + +drop table if exists address; + +drop table if exists author; + +drop table if exists book_info; + +drop table if exists book_intro; + +drop table if exists category; + +drop table if exists gallery; + +drop table if exists orders; + +drop table if exists publisher; + +drop table if exists user; + +/*==============================================================*/ +/* Table: address */ +/*==============================================================*/ +create table address +( + address_id int not null auto_increment, + user_id int not null, + pub_id int not null, + address varchar(255), + primary key (address_id) +); + +/*==============================================================*/ +/* Table: author */ +/*==============================================================*/ +create table author +( + author_id int not null auto_increment, + author_name varchar(10), + gender varchar(2), + heart int, + author_intro varchar(255), + primary key (author_id) +); + +/*==============================================================*/ +/* Table: book_info */ +/*==============================================================*/ +create table book_info +( + book_id int not null auto_increment, + pub_id int not null, + author_id int not null, + cate_id int not null, + cate int not null, + book_name varchar(25), + boook_cover int, + author varchar(25), + pub_time varchar(255), + price decimal, + stock int, + state varchar(255), + ISBN longtext, + book_intro longtext, + sale int, + primary key (book_id) +); + +/*==============================================================*/ +/* Table: book_intro */ +/*==============================================================*/ +create table book_intro +( + intro_id int not null auto_increment, + book_id int not null, + book_intro longtext, + primary key (intro_id) +); + +/*==============================================================*/ +/* Table: category */ +/*==============================================================*/ +create table category +( + cate_id int not null auto_increment, + cate_name varchar(10), + primary key (cate_id) +); + +/*==============================================================*/ +/* Table: gallery */ +/*==============================================================*/ +create table gallery +( + picture_id varchar(255) not null , + book_id int not null, + picture varchar(255), + path varchar(255), + pic_data varchar(255), + primary key (picture_id) +); + +/*==============================================================*/ +/* Table: orders */ +/*==============================================================*/ +create table orders +( + order_id int not null auto_increment, + user_id int not null, + order_time varchar(255), + order_money decimal, + order_state varchar(255), + primary key (order_id) +); + +/*==============================================================*/ +/* Table: publisher */ +/*==============================================================*/ +create table publisher +( + pub_id int not null auto_increment, + address_id int not null, + pub_name varchar(25), + pub_phone int, + pub_email varchar(255), + primary key (pub_id) +); + +/*==============================================================*/ +/* Table: user */ +/*==============================================================*/ +create table user +( + user_id int not null auto_increment, + user_name varchar(25), + admin varchar(255), + password int, + role varchar(25), + user_phone int, + user_address varchar(255), + primary key (user_id) +); + +alter table address add constraint FK_user_address foreign key (user_id) + references user (user_id) on delete restrict on update restrict; + +alter table book_info add constraint FK_bookinfo_author foreign key (author_id) + references author (author_id) on delete restrict on update restrict; + +alter table book_info add constraint FK_bookinfo_cate foreign key (cate_id) + references category (cate_id) on delete restrict on update restrict; + +alter table book_info add constraint FK_publisher_bookinfo foreign key (pub_id) + references publisher (pub_id) on delete restrict on update restrict; + +alter table book_intro add constraint FK_bookintro_bookinfo foreign key (book_id) + references book_info (book_id) on delete restrict on update restrict; + +alter table gallery add constraint FK_gallery_bookinfo foreign key (book_id) + references book_info (book_id) on delete restrict on update restrict; + +alter table orders add constraint FK_user_order foreign key (user_id) + references user (user_id) on delete restrict on update restrict; +``` + +添加数据 + +```sql +INSERT INTO `address` VALUES (1, 1, 1, '中国'); +INSERT INTO `address` VALUES (2, 2, 2, '北京'); +INSERT INTO `address` VALUES (3, 3, 3, '沈阳'); +INSERT INTO `address` VALUES (4, 4, 4, '北京'); +INSERT INTO `address` VALUES (5, 5, 1, '广西'); +INSERT INTO `address` VALUES (6, 6, 3, '福建'); +INSERT INTO `address` VALUES (7, 7, 2, '安徽'); + + +INSERT INTO `author` VALUES (1, '马特·弗里斯比', '男', 5, '好'); +INSERT INTO `author` VALUES (2, '明日科技', '男', 6, '好'); +INSERT INTO `author` VALUES (3, '约翰·冯·诺依曼', '男', 7, '好'); +INSERT INTO `author` VALUES (4, '余华', '男', 8, '好'); + + +INSERT INTO `book_info` VALUES (1, 1, 1, 1, 1, 'javascript', 1, '马特·弗里斯比', '2020-09-01', 1, 5852, '上架', '9787115545381', '讲解很详细', 568); +INSERT INTO `book_info` VALUES (2, 2, 2, 1, 1, 'Java从入门到精通(第7版)', 2, '明日科技', '2023-06', 56, 5456, '上架', '9787302632627', '很好', 852); +INSERT INTO `book_info` VALUES (3, 3, 3, 2, 2, ' 博弈论(精装版)', 3, '约翰·冯·诺依曼', '2020-07-13', 20, 25555, '未上架', '9787544181846', '很好', 0); +INSERT INTO `book_info` VALUES (4, 4, 4, 3, 3, '余华:我们生活在巨大的差距里', 4, '余华', '2018-04-27', 56, 55218, '上架', '147258369', '经典', 5555); + + +INSERT INTO `book_intro` VALUES (1, 1, '好'); +INSERT INTO `book_intro` VALUES (2, 2, '很好'); +INSERT INTO `book_intro` VALUES (3, 3, '非常好'); +INSERT INTO `book_intro` VALUES (4, 4, '经典'); + + +INSERT INTO `category` VALUES (1, '计算机'); +INSERT INTO `category` VALUES (2, '经济'); +INSERT INTO `category` VALUES (3, '文学'); + + +INSERT INTO `gallery` VALUES (1, 1, '1', 'path1', '2020-09-01'); +INSERT INTO `gallery` VALUES (2, 2, '2', 'path2', '2006-05-30'); +INSERT INTO `gallery` VALUES (3, 3, '3', 'path3', '2020-07-13'); +INSERT INTO `gallery` VALUES (4, 4, '4', 'path4', '2018-04-27'); + + +INSERT INTO `orders` VALUES (1, 5, '2024-9-14', 129, '未发货'); +INSERT INTO `orders` VALUES (2, 6, '2024-8-12', 50, '已发货'); +INSERT INTO `orders` VALUES (3, 7, '2024-6-16', 56, '已发货'); + + +INSERT INTO `publisher` VALUES (1, 1, '人民邮电出版社', 21562, 'renmin@qq.com'); +INSERT INTO `publisher` VALUES (2, 2, '清华大学出版社', 542365, 'qinhua@qq.com'); +INSERT INTO `publisher` VALUES (3, 3, '沈阳出版社', 147258, 'shenyang@qq.com'); +INSERT INTO `publisher` VALUES (4, 4, '北京出版集团', 258369, 'beijin@qq.com'); + + +INSERT INTO `user` VALUES (1, '人民邮电出版社会', 'renminyoudian', 123456, '出版社', 21562, '中国'); +INSERT INTO `user` VALUES (2, '清华大学出版社', 'qinhua', 542365, '出版社', 12345, '北京'); +INSERT INTO `user` VALUES (3, '沈阳出版社', 'shenyang', 147258, '出版社', 147258, '沈阳'); +INSERT INTO `user` VALUES (4, '北京出版集团', 'beijin', 258369, '出版社', 258369, '北京'); +INSERT INTO `user` VALUES (5, '韦大力', 'yahu', 66666, '购买者', 1885654, '广西'); +INSERT INTO `user` VALUES (6, '张三', 'zhangsan', 88888, '购买者', 1884952, '福建'); +INSERT INTO `user` VALUES (7, '李四', 'lisi', 8515632, '购买者', 5555694, '安徽'); + + +``` + diff --git "a/\345\271\262\347\272\257\346\254\243/2024.0914 \347\275\221\344\270\212\344\271\246\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237\347\232\204\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241(3).md" "b/\345\271\262\347\272\257\346\254\243/2024.0914 \347\275\221\344\270\212\344\271\246\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237\347\232\204\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241(3).md" new file mode 100644 index 0000000000000000000000000000000000000000..023ceb713ecf78048bd667cc6fd7004b75353309 --- /dev/null +++ "b/\345\271\262\347\272\257\346\254\243/2024.0914 \347\275\221\344\270\212\344\271\246\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237\347\232\204\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241(3).md" @@ -0,0 +1,324 @@ +# 20240913网上书店管理系统的数据库设计(2) + +## 一、数据库设计 + +**1、分类表** + +- 分类编号 + +- 分类名称 + + +**2、图书信息表** + +- 图书编号 +- 图书名称 +- 图书封面 +- 图书价格 +- 作者 +- 出版日期 +- 定价 +- 库存 +- 状态(订单上下架) +- ISBN +- 图书简介 +- 销量 + +**3、作者信息表** + +- 作者编号 +- 作者姓名 +- 性别 +- 头像 +- 简介 + +**4、图库** + +图片编号 + +图片 + +图片路径 + +上传日期 + +**5、出版社** + +- 出版社编号 +- 出版社名称 +- 出版社地址 +- 联系电话 +- 电子邮箱 + +**6、用户** + +- 用户编号 +- 用户姓名 +- 账号 +- 密码 +- 角色 +- 手机号码 +- 收货地址 + +**7、用户收货地址** + +- 收货地址编号 +- 用户编号 +- 收货地址 + +**8、图书简介表** + +- 图书简介编号 +- 图书简介 + +PD思路图 + +CDM + +![image-20240914112232968](https://gitee.com/gcxxl/note-sheet-bed/raw/master/images/202409141122083.png) + +LDM + +![image-20240914112313167](https://gitee.com/gcxxl/note-sheet-bed/raw/master/images/202409141123330.png) + +PDM + +![image-20240914112412452](https://gitee.com/gcxxl/note-sheet-bed/raw/master/images/202409141124584.png) + +SQL语句 + +```sql +create database book1_online; + use book1_online; +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2024/9/14 9:53:42 */ +/*==============================================================*/ + + +drop table if exists address; + +drop table if exists author; + +drop table if exists book_info; + +drop table if exists book_intro; + +drop table if exists category; + +drop table if exists gallery; + +drop table if exists orders; + +drop table if exists publisher; + +drop table if exists user; + +/*==============================================================*/ +/* Table: address */ +/*==============================================================*/ +create table address +( + address_id int not null auto_increment, + user_id int not null, + pub_id int not null, + address varchar(255), + primary key (address_id) +); + +/*==============================================================*/ +/* Table: author */ +/*==============================================================*/ +create table author +( + author_id int not null auto_increment, + author_name varchar(10), + gender varchar(2), + heart int, + author_intro varchar(255), + primary key (author_id) +); + +/*==============================================================*/ +/* Table: book_info */ +/*==============================================================*/ +create table book_info +( + book_id int not null auto_increment, + pub_id int not null, + author_id int not null, + cate_id int not null, + cate int not null, + book_name varchar(25), + boook_cover int, + author varchar(25), + pub_time varchar(255), + price decimal, + stock int, + state varchar(255), + ISBN longtext, + book_intro longtext, + sale int, + primary key (book_id) +); + +/*==============================================================*/ +/* Table: book_intro */ +/*==============================================================*/ +create table book_intro +( + intro_id int not null auto_increment, + book_id int not null, + book_intro longtext, + primary key (intro_id) +); + +/*==============================================================*/ +/* Table: category */ +/*==============================================================*/ +create table category +( + cate_id int not null auto_increment, + cate_name varchar(10), + primary key (cate_id) +); + +/*==============================================================*/ +/* Table: gallery */ +/*==============================================================*/ +create table gallery +( + picture_id varchar(255) not null , + book_id int not null, + picture varchar(255), + path varchar(255), + pic_data varchar(255), + primary key (picture_id) +); + +/*==============================================================*/ +/* Table: orders */ +/*==============================================================*/ +create table orders +( + order_id int not null auto_increment, + user_id int not null, + order_time varchar(255), + order_money decimal, + order_state varchar(255), + primary key (order_id) +); + +/*==============================================================*/ +/* Table: publisher */ +/*==============================================================*/ +create table publisher +( + pub_id int not null auto_increment, + address_id int not null, + pub_name varchar(25), + pub_phone int, + pub_email varchar(255), + primary key (pub_id) +); + +/*==============================================================*/ +/* Table: user */ +/*==============================================================*/ +create table user +( + user_id int not null auto_increment, + user_name varchar(25), + admin varchar(255), + password int, + role varchar(25), + user_phone int, + user_address varchar(255), + primary key (user_id) +); + +alter table address add constraint FK_user_address foreign key (user_id) + references user (user_id) on delete restrict on update restrict; + +alter table book_info add constraint FK_bookinfo_author foreign key (author_id) + references author (author_id) on delete restrict on update restrict; + +alter table book_info add constraint FK_bookinfo_cate foreign key (cate_id) + references category (cate_id) on delete restrict on update restrict; + +alter table book_info add constraint FK_publisher_bookinfo foreign key (pub_id) + references publisher (pub_id) on delete restrict on update restrict; + +alter table book_intro add constraint FK_bookintro_bookinfo foreign key (book_id) + references book_info (book_id) on delete restrict on update restrict; + +alter table gallery add constraint FK_gallery_bookinfo foreign key (book_id) + references book_info (book_id) on delete restrict on update restrict; + +alter table orders add constraint FK_user_order foreign key (user_id) + references user (user_id) on delete restrict on update restrict; +``` + +添加数据 + +```sql +INSERT INTO `address` VALUES (1, 1, 1, '中国'); +INSERT INTO `address` VALUES (2, 2, 2, '北京'); +INSERT INTO `address` VALUES (3, 3, 3, '沈阳'); +INSERT INTO `address` VALUES (4, 4, 4, '北京'); +INSERT INTO `address` VALUES (5, 5, 1, '广西'); +INSERT INTO `address` VALUES (6, 6, 3, '福建'); +INSERT INTO `address` VALUES (7, 7, 2, '安徽'); + + +INSERT INTO `author` VALUES (1, '马特·弗里斯比', '男', 5, '好'); +INSERT INTO `author` VALUES (2, '明日科技', '男', 6, '好'); +INSERT INTO `author` VALUES (3, '约翰·冯·诺依曼', '男', 7, '好'); +INSERT INTO `author` VALUES (4, '余华', '男', 8, '好'); + + +INSERT INTO `book_info` VALUES (1, 1, 1, 1, 1, 'javascript', 1, '马特·弗里斯比', '2020-09-01', 1, 5852, '上架', '9787115545381', '讲解很详细', 568); +INSERT INTO `book_info` VALUES (2, 2, 2, 1, 1, 'Java从入门到精通(第7版)', 2, '明日科技', '2023-06', 56, 5456, '上架', '9787302632627', '很好', 852); +INSERT INTO `book_info` VALUES (3, 3, 3, 2, 2, ' 博弈论(精装版)', 3, '约翰·冯·诺依曼', '2020-07-13', 20, 25555, '未上架', '9787544181846', '很好', 0); +INSERT INTO `book_info` VALUES (4, 4, 4, 3, 3, '余华:我们生活在巨大的差距里', 4, '余华', '2018-04-27', 56, 55218, '上架', '147258369', '经典', 5555); + + +INSERT INTO `book_intro` VALUES (1, 1, '好'); +INSERT INTO `book_intro` VALUES (2, 2, '很好'); +INSERT INTO `book_intro` VALUES (3, 3, '非常好'); +INSERT INTO `book_intro` VALUES (4, 4, '经典'); + + +INSERT INTO `category` VALUES (1, '计算机'); +INSERT INTO `category` VALUES (2, '经济'); +INSERT INTO `category` VALUES (3, '文学'); + + +INSERT INTO `gallery` VALUES (1, 1, '1', 'path1', '2020-09-01'); +INSERT INTO `gallery` VALUES (2, 2, '2', 'path2', '2006-05-30'); +INSERT INTO `gallery` VALUES (3, 3, '3', 'path3', '2020-07-13'); +INSERT INTO `gallery` VALUES (4, 4, '4', 'path4', '2018-04-27'); + + +INSERT INTO `orders` VALUES (1, 5, '2024-9-14', 129, '未发货'); +INSERT INTO `orders` VALUES (2, 6, '2024-8-12', 50, '已发货'); +INSERT INTO `orders` VALUES (3, 7, '2024-6-16', 56, '已发货'); + + +INSERT INTO `publisher` VALUES (1, 1, '人民邮电出版社', 21562, 'renmin@qq.com'); +INSERT INTO `publisher` VALUES (2, 2, '清华大学出版社', 542365, 'qinhua@qq.com'); +INSERT INTO `publisher` VALUES (3, 3, '沈阳出版社', 147258, 'shenyang@qq.com'); +INSERT INTO `publisher` VALUES (4, 4, '北京出版集团', 258369, 'beijin@qq.com'); + + +INSERT INTO `user` VALUES (1, '人民邮电出版社会', 'renminyoudian', 123456, '出版社', 21562, '中国'); +INSERT INTO `user` VALUES (2, '清华大学出版社', 'qinhua', 542365, '出版社', 12345, '北京'); +INSERT INTO `user` VALUES (3, '沈阳出版社', 'shenyang', 147258, '出版社', 147258, '沈阳'); +INSERT INTO `user` VALUES (4, '北京出版集团', 'beijin', 258369, '出版社', 258369, '北京'); +INSERT INTO `user` VALUES (5, '韦大力', 'yahu', 66666, '购买者', 1885654, '广西'); +INSERT INTO `user` VALUES (6, '张三', 'zhangsan', 88888, '购买者', 1884952, '福建'); +INSERT INTO `user` VALUES (7, '李四', 'lisi', 8515632, '购买者', 5555694, '安徽'); + + +``` +