diff --git "a/\346\261\237\346\231\272\346\235\260/20240912 \347\275\221\347\273\234\345\233\276\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237/\347\275\221\347\273\234\345\233\276\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237.md" "b/\346\261\237\346\231\272\346\235\260/20240912 \347\275\221\347\273\234\345\233\276\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237/\347\275\221\347\273\234\345\233\276\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237.md" new file mode 100644 index 0000000000000000000000000000000000000000..75245c6a52d9e92f6270ec1b198ded9d96e778a6 --- /dev/null +++ "b/\346\261\237\346\231\272\346\235\260/20240912 \347\275\221\347\273\234\345\233\276\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237/\347\275\221\347\273\234\345\233\276\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237.md" @@ -0,0 +1,54 @@ +# 网上书店管理系统的数据库设计 + +1. 实体: + + 1. 分类 + + 1. 分类编号 + 2. 分类名称 +2. 图书 + + 1. 图书编号 + 2. 价格 + 3. 书名 + 4. 作者 + 3. 作者 + + 1. 作者编号 + 2. 作者姓名 + 3. 性别 + 4. 生日 + 5. 图片 + 6. 作者简介 + 4. 书店 + + 1. 书店编号 + 2. 地址 + 3. 电话 + 5. 客户表 + + 1. 客户id + 2. 客户名 + 6. 订单 + + 1. 订单编号 + 2. 用户 + 3. 商品 + 4. 日期 + 5. 价格 +7. 库存 + + 1. 商品编号 + 2. 库存数量 + 8. 地址 + + 1. 地址编号 + 2. 详细地址 + + +## excel设计 + + + +![img](https://gitee.com/dhayyds/picture/raw/master/images/image-20240913090647902.png) + diff --git "a/\346\261\237\346\231\272\346\235\260/20240913 \347\275\221\347\273\234\345\233\276\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237pro/\347\275\221\347\273\234\345\233\276\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237pro.md" "b/\346\261\237\346\231\272\346\235\260/20240913 \347\275\221\347\273\234\345\233\276\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237pro/\347\275\221\347\273\234\345\233\276\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237pro.md" new file mode 100644 index 0000000000000000000000000000000000000000..f574d9b6e5f0fb3fec4d1ab63172420fc9d11f16 --- /dev/null +++ "b/\346\261\237\346\231\272\346\235\260/20240913 \347\275\221\347\273\234\345\233\276\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237pro/\347\275\221\347\273\234\345\233\276\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237pro.md" @@ -0,0 +1,290 @@ + + +# 网络图店管理系统pro + +## 一、初始表演示 + +### 分类表 + +| 分类编号 | 分类名称 | 上级分类 | +| -------- | -------- | -------- | +| Cate001 | 经济 | 0 | +| Cate002 | 艺术 | 0 | +| Cate003 | 计算机 | 0 | +| Cate004 | 程序设计 | Cate003 | +| Cate005 | Java | Cate004 | + +### 图书信息表 + +| 图书编号 | 分类 | 名称 | 封面(图片编号) | 作者 | 出版社 | +| -------- | ------- | ------------------------- | -------------- | -------- | -------------- | +| Book001 | Cate005 | Java从入门到精通(第7版) | Pic002 | 明日科技 | 清华大学出版社 | + +### 作者 + +| 作者编号 | 作者姓名 | 性别 | 头像(图片编号) | 简介 | +| --------- | -------- | ---- | ---------------- | ------------------ | +| Author001 | 游乙麟 | 男 | Pic001 | 玉面小飞龙 | +| Author002 | 林志万 | 女 | 002.jpg | 人称万人迷 | +| Author003 | 王旋 | 女 | 003.jpg | 你永远得不到的男人 | + +### 作者作品关系表 + +| 作者作品编号 | 作者编号 | 图书编号 | +| -------------- | --------- | -------- | +| Author_Book001 | Author001 | Book002 | +| Author_Book002 | Author002 | Book002 | +| Author_Book003 | Author002 | Book003 | +| Author_Book004 | Author003 | Book003 | +| Author_Book005 | Author002 | Book004 | + +### 图片 + +| 图片编号 | 图片名称 | 图片路径 | 上传者 | 上传日期 | +| -------- | -------- | --------------- | ------- | ---------- | +| Pic001 | 001.jpg | /books/user/pic | User001 | 2024-09-13 | +| Pic002 | 001.jpg | /books/book/pic | User001 | 2024-09-13 | +| Pic003 | 002.jpg | /books/user/pic | User001 | 2024-09-13 | +| Pic004 | 003.jpg | /books/user/pic | User002 | 2024-09-15 | + +### 出版社 + +| 出版社编号 | 出版社名称 | 地址 | 联系电话 | 电子邮箱 | +| ------------ | -------------- | ------------ | ----------- | ---------- | +| Publisher001 | 清华大学出版社 | 北京清华 | 010-1025646 | abc@qq.com | +| Publisher002 | 人民出版社 | 北京人民大学 | 010-5454554 | bad@re.com | +| Publisher003 | 团结里出版社 | 福建闽大 | 0597-666888 | qq@md.com | + +### 用户 + +| 用户编号 | 账号 | 密码 | 手机号 | 邮箱 | 头像 | +| -------- | ----- | -------- | ----------- | ------------- | ------ | +| User001 | jack | jack666 | 18650509999 | jack@qq.com | Pic003 | +| User002 | joker | joker888 | 18650506666 | xiaojj@qq.com | Pic004 | + +## 二、实际演示 + +### CDM + +![image-20240913134548740](https://gitee.com/dhayyds/picture/raw/master/images/202409131345063.png) + +### LDM + +![image-20240913134941087](https://gitee.com/dhayyds/picture/raw/master/images/202409131349421.png) + +### PDM + +![image-20240913135001055](https://gitee.com/dhayyds/picture/raw/master/images/202409131350267.png) + +### 生成的sql + +```sql +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2024/9/13 13:54:13 */ +/*==============================================================*/ + + +drop table if exists Relationship_5; + +drop table if exists actor; + +drop table if exists address; + +drop table if exists author; + +drop table if exists book; + +drop table if exists class; + +drop table if exists fenmian; + +drop table if exists "order"; + +drop table if exists people; + +drop table if exists press; + +drop table if exists quanli; + +/*==============================================================*/ +/* Table: Relationship_5 */ +/*==============================================================*/ +create table Relationship_5 +( + aid int not null, + bid int not null, + primary key (aid, bid) +); + +/*==============================================================*/ +/* Table: actor */ +/*==============================================================*/ +create table actor +( + j_id int not null, + p_pid int, + j_leixing varchar(10), + primary key (j_id) +); + +/*==============================================================*/ +/* Table: address */ +/*==============================================================*/ +create table address +( + add_id int not null, + sheng varchar(10), + shi varchar(10), + qu varchar(10), + add_name varchar(15), + primary key (add_id) +); + +/*==============================================================*/ +/* Table: author */ +/*==============================================================*/ +create table author +( + aid int not null, + aname varchar(10), + sex varchar(5), + touxiang varchar(20), + jianjie varchar(50), + primary key (aid) +); + +/*==============================================================*/ +/* Table: book */ +/*==============================================================*/ +create table book +( + bid int not null, + cid int, + pid int, + f_id int, + bname varchar(10), + bdate date, + state varchar(5), + ISBN varchar(50), + version varchar(50), + bsize int, + price int, + number int, + primary key (bid) +); + +/*==============================================================*/ +/* Table: class */ +/*==============================================================*/ +create table class +( + cid int not null, + cname varchar(10), + last_cname varchar(5), + primary key (cid) +); + +/*==============================================================*/ +/* Table: fenmian */ +/*==============================================================*/ +create table fenmian +( + f_id int not null, + f_name varchar(20), + f_add varchar(255), + f_ren varchar(20), + f_date date, + primary key (f_id) +); + +/*==============================================================*/ +/* Table: "order" */ +/*==============================================================*/ +create table "order" +( + o_id int not null, + bid int, + add_id int, + p_pid int, + o_no varchar(20), + o_name varchar(10), + o_time date, + primary key (o_id) +); + +/*==============================================================*/ +/* Table: people */ +/*==============================================================*/ +create table people +( + p_pid int not null, + j_id int, + p_acc varchar(20), + p_pwd varchar(20), + p_phone varchar(20), + p_email varchar(50), + p_price varchar(50), + primary key (p_pid) +); + +/*==============================================================*/ +/* Table: press */ +/*==============================================================*/ +create table press +( + pid int not null, + add_id int, + pname varchar(10), + pphone varchar(20), + pemile varchar(50), + primary key (pid) +); + +/*==============================================================*/ +/* Table: quanli */ +/*==============================================================*/ +create table quanli +( + j_id int not null, + q_id int not null, + q_name varchar(15), + primary key (j_id, q_id) +); + +alter table Relationship_5 add constraint FK_Relationship_5 foreign key (aid) + references author (aid) on delete restrict on update restrict; + +alter table Relationship_5 add constraint FK_Relationship_6 foreign key (bid) + references book (bid) on delete restrict on update restrict; + +alter table actor add constraint FK_Relationship_17 foreign key (p_pid) + references people (p_pid) on delete restrict on update restrict; + +alter table book add constraint FK_Relationship_1 foreign key (cid) + references class (cid) on delete restrict on update restrict; + +alter table book add constraint FK_Relationship_16 foreign key (f_id) + references fenmian (f_id) on delete restrict on update restrict; + +alter table book add constraint FK_Relationship_4 foreign key (pid) + references press (pid) on delete restrict on update restrict; + +alter table "order" add constraint FK_Relationship_13 foreign key (bid) + references book (bid) on delete restrict on update restrict; + +alter table "order" add constraint FK_Relationship_14 foreign key (p_pid) + references people (p_pid) on delete restrict on update restrict; + +alter table "order" add constraint FK_Relationship_9 foreign key (add_id) + references address (add_id) on delete restrict on update restrict; + +alter table people add constraint FK_Relationship_11 foreign key (j_id) + references actor (j_id) on delete restrict on update restrict; + +alter table press add constraint FK_Relationship_15 foreign key (add_id) + references address (add_id) on delete restrict on update restrict; + + +``` + diff --git "a/\346\261\237\346\231\272\346\235\260/20240914 \347\275\221\347\273\234\344\271\246\345\272\227\346\234\200\347\273\210\347\211\210/\347\275\221\347\273\234\344\271\246\345\272\227\346\234\200\347\273\210\347\211\210.md" "b/\346\261\237\346\231\272\346\235\260/20240914 \347\275\221\347\273\234\344\271\246\345\272\227\346\234\200\347\273\210\347\211\210/\347\275\221\347\273\234\344\271\246\345\272\227\346\234\200\347\273\210\347\211\210.md" new file mode 100644 index 0000000000000000000000000000000000000000..1137c42fb6b6586c139862de04577a090581e656 --- /dev/null +++ "b/\346\261\237\346\231\272\346\235\260/20240914 \347\275\221\347\273\234\344\271\246\345\272\227\346\234\200\347\273\210\347\211\210/\347\275\221\347\273\234\344\271\246\345\272\227\346\234\200\347\273\210\347\211\210.md" @@ -0,0 +1,319 @@ +# 网络书店最终版 + +## CDM + +![image-20240915150514949](https://gitee.com/dhayyds/picture/raw/master/images/202409151505093.png) + +## LDM + +![image-20240915150548126](https://gitee.com/dhayyds/picture/raw/master/images/202409151505437.png) + +## PDM + +![image-20240915150611621](https://gitee.com/dhayyds/picture/raw/master/images/202409151506867.png) + +## 生成sql + +```sql +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2024/9/15 15:08:07 */ +/*==============================================================*/ + + +drop table if exists Relationship_12; + +drop table if exists Relationship_5; + +drop table if exists actor; + +drop table if exists address; + +drop table if exists author; + +drop table if exists book; + +drop table if exists class; + +drop table if exists comments; + +drop table if exists fengmian; + +drop table if exists orders; + +drop table if exists people; + +drop table if exists press; + +drop table if exists quanli; + +/*==============================================================*/ +/* Table: Relationship_12 */ +/*==============================================================*/ +create table Relationship_12 +( + q_id int not null, + j_id int not null, + primary key (q_id, j_id) +); + +/*==============================================================*/ +/* Table: Relationship_5 */ +/*==============================================================*/ +create table Relationship_5 +( + aid int not null, + bid int not null, + primary key (aid, bid) +); + +/*==============================================================*/ +/* Table: actor */ +/*==============================================================*/ +create table actor +( + j_id int not null, + j_leixing varchar(10), + primary key (j_id) +); + +/*==============================================================*/ +/* Table: address */ +/*==============================================================*/ +create table address +( + add_id int not null, + sheng varchar(10), + shi varchar(10), + qu varchar(10), + add_name varchar(15), + primary key (add_id) +); + +/*==============================================================*/ +/* Table: author */ +/*==============================================================*/ +create table author +( + aid int not null, + aname varchar(10), + sex varchar(5), + touxiang varchar(20), + jianjie varchar(50), + primary key (aid) +); + +/*==============================================================*/ +/* Table: book */ +/*==============================================================*/ +create table book +( + bid int not null, + cid int, + pid int, + f_id int, + bname varchar(10), + bdate date, + state varchar(5), + ISBN varchar(50), + version varchar(50), + size int, + price int, + number int, + primary key (bid) +); + +/*==============================================================*/ +/* Table: class */ +/*==============================================================*/ +create table class +( + cid int not null, + cname varchar(10), + last_cname varchar(5), + primary key (cid) +); + +/*==============================================================*/ +/* Table: comments */ +/*==============================================================*/ +create table comments +( + co_id int not null, + bid int, + p_pid int, + co_info varchar(50), + co_no int, + primary key (co_id) +); + +/*==============================================================*/ +/* Table: fengmian */ +/*==============================================================*/ +create table fengmian +( + f_id int not null, + f_name varchar(20), + f_add varchar(255), + f_ren varchar(20), + f_date date, + primary key (f_id) +); + +/*==============================================================*/ +/* Table: orders */ +/*==============================================================*/ +create table orders +( + oid int not null, + bid int, + add_id int, + ono varchar(20), + opeople varchar(10), + primary key (oid) +); + +/*==============================================================*/ +/* Table: people */ +/*==============================================================*/ +create table people +( + p_pid int not null, + j_id int, + oid int, + p_acc varchar(20), + p_pwd varchar(20), + p_phone varchar(20), + p_email varchar(50), + p_price varchar(50), + primary key (p_pid) +); + +/*==============================================================*/ +/* Table: press */ +/*==============================================================*/ +create table press +( + pid int not null, + add_id int, + pname varchar(10), + pphone varchar(20), + pemile varchar(50), + primary key (pid) +); + +/*==============================================================*/ +/* Table: quanli */ +/*==============================================================*/ +create table quanli +( + q_id int not null, + q_name varchar(15), + primary key (q_id) +); + +alter table Relationship_12 add constraint FK_Relationship_12 foreign key (q_id) + references quanli (q_id) on delete restrict on update restrict; + +alter table Relationship_12 add constraint FK_Relationship_20 foreign key (j_id) + references actor (j_id) on delete restrict on update restrict; + +alter table Relationship_5 add constraint FK_Relationship_5 foreign key (aid) + references author (aid) on delete restrict on update restrict; + +alter table Relationship_5 add constraint FK_Relationship_6 foreign key (bid) + references book (bid) on delete restrict on update restrict; + +alter table book add constraint FK_Relationship_1 foreign key (cid) + references class (cid) on delete restrict on update restrict; + +alter table book add constraint FK_Relationship_18 foreign key (f_id) + references fengmian (f_id) on delete restrict on update restrict; + +alter table book add constraint FK_Relationship_4 foreign key (pid) + references press (pid) on delete restrict on update restrict; + +alter table comments add constraint FK_Relationship_15 foreign key (bid) + references book (bid) on delete restrict on update restrict; + +alter table comments add constraint FK_Relationship_16 foreign key (p_pid) + references people (p_pid) on delete restrict on update restrict; + +alter table orders add constraint FK_Relationship_13 foreign key (bid) + references book (bid) on delete restrict on update restrict; + +alter table orders add constraint FK_Relationship_9 foreign key (add_id) + references address (add_id) on delete restrict on update restrict; + +alter table people add constraint FK_Relationship_11 foreign key (j_id) + references actor (j_id) on delete restrict on update restrict; + +alter table people add constraint FK_Relationship_14 foreign key (oid) + references orders (oid) on delete restrict on update restrict; + +alter table press add constraint FK_Relationship_17 foreign key (add_id) + references address (add_id) on delete restrict on update restrict; + + +``` + +## 添加数据 + +```sql +INSERT INTO `actor` VALUES (1, '用户'); +INSERT INTO `actor` VALUES (2, '管理员'); + +INSERT INTO `address` VALUES (1, '福建省', '龙岩市', '新罗区', '闽大'); + +INSERT INTO `author` VALUES (1, '肖志华', '男', '1.jpg', '无'); +INSERT INTO `author` VALUES (2, '林志万', '男', '2.jpg', '无'); + +INSERT INTO `book` VALUES (1, 1, 1, 1, '书1', '2024-09-15', '已上架', '123456', '1.0', 20, 30, 40); + +INSERT INTO `class` VALUES (1, '教育', NULL); +INSERT INTO `class` VALUES (2, '文艺', NULL); +INSERT INTO `class` VALUES (3, '童书', NULL); + +INSERT INTO `comments` VALUES (1, 1, 1, '好', 5); +INSERT INTO `comments` VALUES (2, 1, 1, '好', 4); + +INSERT INTO `fengmian` VALUES (1, '1', ' 3.jpg', '肖志华', '2024-09-15'); +INSERT INTO `fengmian` VALUES (2, '2', '4.jpg', '林志万', '2024-09-15'); + +INSERT INTO `orders` VALUES (1, 1, 1, '123456789', '林志万', 1); + +INSERT INTO `people` VALUES (1, 1, '123456', '123456', '123456', '123456@qq.com', '20000'); + +INSERT INTO `press` VALUES (1, 1, '志华出版社', '111', '111@QQ.COM'); +INSERT INTO `press` VALUES (2, 1, '志万出版社', '222', '222@qq.com'); + +INSERT INTO `quanli` VALUES (1, '购买退货'); +INSERT INTO `quanli` VALUES (2, '上下架'); + +INSERT INTO `relationship_12` VALUES (1, 1); + +INSERT INTO `relationship_5` VALUES (1, 1) +``` + +## 查询 + +```sql + +SELECT b.bid 书id,cname 类型 ,bname 书名,au.aname 作者1,au1.aname 作者2,p.pname 出版社,bdate 上架日期,ISBN,version 版本,size 大小, price 价格 ,number 数量, COUNT(co.co_id) 评论数 ,AVG(co.co_no) 好评率(满分5) FROM book b +JOIN press p on p.pid=b.pid +JOIN class c on c.cid= b.cid + +join comments co on co.bid=b.bid + + +JOIN relationship_5 r5 on r5.bid=b.bid +JOIN author au on au.aid=r5.aid + +JOIN relationship_5 r51 on r51.bid=b.bid +JOIN author au1 on au1.aid=r51.aid + +WHERE au.aname ='肖志华' and au1.aname='林志万' and b.bid=1 + +``` + +![image-20240915162525931](https://gitee.com/dhayyds/picture/raw/master/images/202409151917889.png) \ No newline at end of file diff --git "a/\346\261\237\346\231\272\346\235\260/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/Snipaste_2024-09-10_17-30-47.png" "b/\346\261\237\346\231\272\346\235\260/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/Snipaste_2024-09-10_17-30-47.png" deleted file mode 100644 index 18166d8544044a38cc64d2efc97e9a717bd58cd5..0000000000000000000000000000000000000000 Binary files "a/\346\261\237\346\231\272\346\235\260/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/Snipaste_2024-09-10_17-30-47.png" and /dev/null differ diff --git "a/\346\261\237\346\231\272\346\235\260/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/Snipaste_2024-09-10_17-30-53.png" "b/\346\261\237\346\231\272\346\235\260/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/Snipaste_2024-09-10_17-30-53.png" deleted file mode 100644 index b2eeffd93e5809473a99f4b4555db2032f6cf368..0000000000000000000000000000000000000000 Binary files "a/\346\261\237\346\231\272\346\235\260/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/Snipaste_2024-09-10_17-30-53.png" and /dev/null differ diff --git "a/\346\261\237\346\231\272\346\235\260/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/Snipaste_2024-09-10_17-30-58.png" "b/\346\261\237\346\231\272\346\235\260/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/Snipaste_2024-09-10_17-30-58.png" deleted file mode 100644 index bcf602e3864347fcb5d7760c9e961b22145f303d..0000000000000000000000000000000000000000 Binary files "a/\346\261\237\346\231\272\346\235\260/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/Snipaste_2024-09-10_17-30-58.png" and /dev/null differ diff --git "a/\346\261\237\346\231\272\346\235\260/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/crebas.sql" "b/\346\261\237\346\231\272\346\235\260/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/crebas.sql" deleted file mode 100644 index d8e650381785f2e258c49ed6a646743e2f3ace2f..0000000000000000000000000000000000000000 --- "a/\346\261\237\346\231\272\346\235\260/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/crebas.sql" +++ /dev/null @@ -1,83 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2024-09-10 17:31:05 */ -/*==============================================================*/ - - -drop table if exists Relationship_3; - -drop table if exists SKU; - -drop table if exists goods; - -drop table if exists shuxing; - -drop table if exists zhi; - -/*==============================================================*/ -/* Table: Relationship_3 */ -/*==============================================================*/ -create table Relationship_3 -( - sku_id int not null, - zid int not null, - primary key (sku_id, zid) -); - -/*==============================================================*/ -/* Table: SKU */ -/*==============================================================*/ -create table SKU -( - sku_id int not null, - gid int, - price int, - weight int, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: goods */ -/*==============================================================*/ -create table goods -( - gid int not null, - brand default '春风精灵' varchar(10), - gname default '肖华华' varchar(10), - primary key (gid) -); - -/*==============================================================*/ -/* Table: shuxing */ -/*==============================================================*/ -create table shuxing -( - id int not null, - liexing varchar(5), - primary key (id) -); - -/*==============================================================*/ -/* Table: zhi */ -/*==============================================================*/ -create table zhi -( - zid int not null, - id int, - size varchar(3), - thick int, - primary key (zid) -); - -alter table Relationship_3 add constraint FK_Relationship_3 foreign key (sku_id) - references SKU (sku_id) on delete restrict on update restrict; - -alter table Relationship_3 add constraint FK_Relationship_4 foreign key (zid) - references zhi (zid) on delete restrict on update restrict; - -alter table SKU add constraint FK_Relationship_1 foreign key (gid) - references goods (gid) on delete restrict on update restrict; - -alter table zhi add constraint FK_Relationship_2 foreign key (id) - references shuxing (id) on delete restrict on update restrict; -