From 575e05d3d4396723c969f5c1867bbffdf780e1a5 Mon Sep 17 00:00:00 2001 From: 12693 <462709894@qq.com> Date: Thu, 19 Sep 2024 22:04:45 +0800 Subject: [PATCH 1/3] text --- ...6\345\272\223\350\256\276\350\256\2413.md" | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git "a/\345\275\255\346\260\270\347\233\233/20240914 \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\2413.md" "b/\345\275\255\346\260\270\347\233\233/20240914 \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\2413.md" index ef0e795..0445b1e 100644 --- "a/\345\275\255\346\260\270\347\233\233/20240914 \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\2413.md" +++ "b/\345\275\255\346\260\270\347\233\233/20240914 \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\2413.md" @@ -69,8 +69,6 @@ ## sql语句 ```sql - - DROP DATABASE if EXISTS dj; CREATE DATABASE dj; USE dj; @@ -244,22 +242,22 @@ alter table pic add constraint FK_link7 foreign key (u_id) -INSERT INTO `bookstores` (`bt_ID`, `bt_name`, `bt_email`) VALUES (1, '志峰书店', 'zf@qq.com'); -INSERT INTO `bookstores` (`bt_ID`, `bt_name`, `bt_email`) VALUES (2, '兴华书店', 'xh@qq.com'); +INSERT INTO `bookstores` (`bt_ID`, `bt_name`, `bt_email`) VALUES (1, '背带书店', 'zf@qq.com'); +INSERT INTO `bookstores` (`bt_ID`, `bt_name`, `bt_email`) VALUES (2, '黑子书店', 'xh@qq.com'); INSERT INTO `category` (`cg_id`, `bt_ID`, `cg_name`) VALUES (1, 1, '计算机'); INSERT INTO `category` (`cg_id`, `bt_ID`, `cg_name`) VALUES (2, 2, '武侠'); -INSERT INTO `goods` (`gs_id`, `cg_id`, `book`, `ISBN`, `publisher`, `gs_date`, `price`, `stock`, `image`) VALUES (1, 1, 'msyql', '978-7-302-55417-2', '志峰出版社', '2024-09-11', 59, 500, '96785'); -INSERT INTO `goods` (`gs_id`, `cg_id`, `book`, `ISBN`, `publisher`, `gs_date`, `price`, `stock`, `image`) VALUES (2, 2, '两只老虎爱跳舞', '987-8-303-55418', '兴华出版社', '2024-08-15', 30, 500, '4859191'); +INSERT INTO `goods` (`gs_id`, `cg_id`, `book`, `ISBN`, `publisher`, `gs_date`, `price`, `stock`, `image`) VALUES (1, 1, 'msyql', '978-7-302-55417-2', '背带出版社', '2024-09-11', 59, 500, '96785'); +INSERT INTO `goods` (`gs_id`, `cg_id`, `book`, `ISBN`, `publisher`, `gs_date`, `price`, `stock`, `image`) VALUES (2, 2, '两只老鼠爱跳舞', '987-8-303-55418', '黑子出版社', '2024-08-15', 30, 500, '4859191'); INSERT INTO `order` (`od_id`, `gs_id`, `od_date`, `od_price`, `status`) VALUES (1, 2, '2024-09-18', 30, 1); INSERT INTO `order` (`od_id`, `gs_id`, `od_date`, `od_price`, `status`) VALUES (2, 1, '2024-09-20', 59, 1); -INSERT INTO `user` (`u_id`, `u_name`, `email`, `address`, `u_phone`, `u_address`) VALUES (1, '张三', 'zs@qq.com', '福建省龙岩市新罗区99号', 13398, '福建省三明市宁化县99号'); -INSERT INTO `user` (`u_id`, `u_name`, `email`, `address`, `u_phone`, `u_address`) VALUES (2, '李四', 'ls@qq.com', '福建省福州市99号', 18944, '福建省泉州市99号'); +INSERT INTO `user` (`u_id`, `u_name`, `email`, `address`, `u_phone`, `u_address`) VALUES (1, '张三', 'zs@qq.com', '翻斗花园翻斗小区99号', 13398, '幸福花园幸福小区99号'); +INSERT INTO `user` (`u_id`, `u_name`, `email`, `address`, `u_phone`, `u_address`) VALUES (2, '李四', 'ls@qq.com', '幸福花园幸福小区99号', 18944, '翻斗花园翻斗小区99号'); INSERT INTO `detail` (`dt_id`, `od_id`, `u_id`, `quantity`, `unit`) VALUES (1, 1, 1, 1, 30); @@ -291,13 +289,10 @@ join `user` u on u.u_id = dt.u_id join link3 l on l.gs_id = gs.gs_id join author ah on ah.at_id = l.at_id WHERE cg.cg_name = '计算机' - - - ``` -![image-20240919122454926](https://gitee.com/pys6/jian-yu/raw/master/image/202409191224551.png) \ No newline at end of file +![image-20240919220403801](https://gitee.com/pys6/jian-yu/raw/master/image/202409192204180.png) \ No newline at end of file -- Gitee From 8b52b6b8c2ecd58a3c1e675100eb5836c3b67325 Mon Sep 17 00:00:00 2001 From: 12693 <462709894@qq.com> Date: Thu, 19 Sep 2024 22:34:43 +0800 Subject: [PATCH 2/3] tex --- ...1\344\270\212\344\271\246\345\272\2274.md" | 277 ++++++++++++++++++ 1 file changed, 277 insertions(+) create mode 100644 "\345\275\255\346\260\270\347\233\233/20240919 \347\275\221\344\270\212\344\271\246\345\272\2274.md" diff --git "a/\345\275\255\346\260\270\347\233\233/20240919 \347\275\221\344\270\212\344\271\246\345\272\2274.md" "b/\345\275\255\346\260\270\347\233\233/20240919 \347\275\221\344\270\212\344\271\246\345\272\2274.md" new file mode 100644 index 0000000..e1cc444 --- /dev/null +++ "b/\345\275\255\346\260\270\347\233\233/20240919 \347\275\221\344\270\212\344\271\246\345\272\2274.md" @@ -0,0 +1,277 @@ +## 概念 + +![image-20240919223110599](https://gitee.com/pys6/jian-yu/raw/master/image/202409192231777.png) + + + +## 逻辑 + + + +![image-20240919223131669](https://gitee.com/pys6/jian-yu/raw/master/image/202409192231882.png) + + + +## 物理 + + + +![image-20240919223149151](https://gitee.com/pys6/jian-yu/raw/master/image/202409192231344.png) + + + + + +```sql + +DROP DATABASE if EXISTS dj; +CREATE DATABASE dj; +USE dj; + +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2024/9/19 22:14:59 */ +/*==============================================================*/ + + +drop table if exists author; + +drop table if exists bookstores; + +drop table if exists category; + +drop table if exists comments; + +drop table if exists detail; + +drop table if exists goods; + +drop table if exists link3; + +drop table if exists `order`; + +drop table if exists pic; + +drop table if exists user; + +/*==============================================================*/ +/* Table: author */ +/*==============================================================*/ +create table author +( + at_id int not null, + at_name varchar(10), + sex int, + birthday date, + pic varchar(20), + primary key (at_id) +); + +/*==============================================================*/ +/* Table: bookstores */ +/*==============================================================*/ +create table bookstores +( + bt_ID int not null, + bt_name varchar(20), + bt_email varchar(20), + primary key (bt_ID) +); + +/*==============================================================*/ +/* Table: category */ +/*==============================================================*/ +create table category +( + cg_id int not null, + bt_ID int not null, + cg_name varchar(10), + primary key (cg_id) +); + +/*==============================================================*/ +/* Table: comments */ +/*==============================================================*/ +create table comments +( + cm_id int not null, + gs_id int not null, + u_id int not null, + content varchar(255), + primary key (cm_id) +); + +/*==============================================================*/ +/* Table: detail */ +/*==============================================================*/ +create table detail +( + dt_id int not null, + od_id int not null, + u_id int not null, + quantity int, + unit int, + primary key (dt_id) +); + +/*==============================================================*/ +/* Table: goods */ +/*==============================================================*/ +create table goods +( + gs_id int not null, + cg_id int not null, + book varchar(20), + ISBN varchar(25), + publisher varchar(255), + gs_date date, + price int, + stock int, + image varchar(255), + primary key (gs_id) +); + +/*==============================================================*/ +/* Table: link3 */ +/*==============================================================*/ +create table link3 +( + at_id int not null, + gs_id int not null, + primary key (at_id, gs_id) +); + +/*==============================================================*/ +/* Table: "order" */ +/*==============================================================*/ +create table `order` +( + od_id int not null, + gs_id int not null, + od_date date, + od_price int, + status int, + primary key (od_id) +); + +/*==============================================================*/ +/* Table: pic */ +/*==============================================================*/ +create table pic +( + pc_id int not null, + at_id int not null, + u_id int not null, + pc_name varchar(20), + path varchar(255), + uploader varchar(20), + primary key (pc_id) +); + +/*==============================================================*/ +/* Table: user */ +/*==============================================================*/ +create table user +( + u_id int not null, + u_name varchar(20), + email varchar(20), + address varchar(20), + u_phone int, + u_address varchar(50), + primary key (u_id) +); + +alter table category add constraint FK_link1 foreign key (bt_ID) + references bookstores (bt_ID) on delete restrict on update restrict; + +alter table comments add constraint FK_link10 foreign key (u_id) + references user (u_id) on delete restrict on update restrict; + +alter table comments add constraint FK_link9 foreign key (gs_id) + references goods (gs_id) on delete restrict on update restrict; + +alter table detail add constraint FK_link5 foreign key (od_id) + references `order` (od_id) on delete restrict on update restrict; + +alter table detail add constraint FK_link8 foreign key (u_id) + references user (u_id) on delete restrict on update restrict; + +alter table goods add constraint FK_link2 foreign key (cg_id) + references category (cg_id) on delete restrict on update restrict; + +alter table link3 add constraint FK_link11 foreign key (gs_id) + references goods (gs_id) on delete restrict on update restrict; + +alter table link3 add constraint FK_link3 foreign key (at_id) + references author (at_id) on delete restrict on update restrict; + +alter table `order` add constraint FK_link4 foreign key (gs_id) + references goods (gs_id) on delete restrict on update restrict; + +alter table pic add constraint FK_link6 foreign key (at_id) + references author (at_id) on delete restrict on update restrict; + +alter table pic add constraint FK_link7 foreign key (u_id) + references user (u_id) on delete restrict on update restrict; + +INSERT INTO `bookstores` (`bt_ID`, `bt_name`, `bt_email`) VALUES (1, '背带书店', 'zf@qq.com'); +INSERT INTO `bookstores` (`bt_ID`, `bt_name`, `bt_email`) VALUES (2, '黑子书店', 'xh@qq.com'); + +INSERT INTO `category` (`cg_id`, `bt_ID`, `cg_name`) VALUES (1, 1, '计算机'); +INSERT INTO `category` (`cg_id`, `bt_ID`, `cg_name`) VALUES (2, 2, '武侠'); + +INSERT INTO `goods` (`gs_id`, `cg_id`, `book`, `ISBN`, `publisher`, `gs_date`, `price`, `stock`, `image`) VALUES (1, 1, 'msyql', '978-7-302-55417-2', '背带出版社', '2024-09-11', 59, 500, '96785'); +INSERT INTO `goods` (`gs_id`, `cg_id`, `book`, `ISBN`, `publisher`, `gs_date`, `price`, `stock`, `image`) VALUES (2, 2, '两只老鼠爱跳舞', '987-8-303-55418', '黑子出版社', '2024-08-15', 30, 500, '4859191'); + + +INSERT INTO `order` (`od_id`, `gs_id`, `od_date`, `od_price`, `status`) VALUES (1, 2, '2024-09-18', 30, 1); +INSERT INTO `order` (`od_id`, `gs_id`, `od_date`, `od_price`, `status`) VALUES (2, 1, '2024-09-20', 59, 1); + + +INSERT INTO `user` (`u_id`, `u_name`, `email`, `address`, `u_phone`, `u_address`) VALUES (1, '张三', 'zs@qq.com', '翻斗花园翻斗小区99号', 13398, '幸福花园幸福小区99号'); +INSERT INTO `user` (`u_id`, `u_name`, `email`, `address`, `u_phone`, `u_address`) VALUES (2, '李四', 'ls@qq.com', '幸福花园幸福小区99号', 18944, '翻斗花园翻斗小区99号'); + + +INSERT INTO `detail` (`dt_id`, `od_id`, `u_id`, `quantity`, `unit`) VALUES (1, 1, 1, 1, 30); +INSERT INTO `detail` (`dt_id`, `od_id`, `u_id`, `quantity`, `unit`) VALUES (2, 2, 2, 1, 59); + + +INSERT INTO `author` (`at_id`, `at_name`, `sex`, `birthday`, `pic`) VALUES (1, '小峰', 1, '2024-09-19', '111.jpg'); +INSERT INTO `author` (`at_id`, `at_name`, `sex`, `birthday`, `pic`) VALUES (2, '小智', 1, '2023-08-01', '222.jpg'); + + +INSERT INTO `link3` (`at_id`, `gs_id`) VALUES (2, 1); +INSERT INTO `link3` (`at_id`, `gs_id`) VALUES (1, 2); + + + +INSERT INTO `pic` (`pc_id`, `at_id`, `u_id`, `pc_name`, `path`, `uploader`) VALUES (1, 1, 1, '111.jpg', '\\img', '小峰'); +INSERT INTO `pic` (`pc_id`, `at_id`, `u_id`, `pc_name`, `path`, `uploader`) VALUES (2, 2, 2, '222.jpg', '\\image', '张三'); + +INSERT INTO `comments` (`cm_id`, `gs_id`, `u_id`, `content`) VALUES (1, 2, 1, '有趣的一本书'); + + +SELECT +cg.cg_name '类别' , bt.bt_name '书店', bt.bt_email '邮箱',gs.book '书名' ,gs.publisher '出版社' , gs.price '价格', +u.u_name '名称', u.address '地址' ,ah.at_name +from category cg +JOIN bookstores bt ON cg.bt_ID = bt.bt_ID +join goods gs on cg.cg_id = gs.cg_id +join `order` od on od.gs_id = gs.gs_id +join detail dt on dt.od_id = od.od_id +join `user` u on u.u_id = dt.u_id +join link3 l on l.gs_id = gs.gs_id +join author ah on ah.at_id = l.at_id +WHERE cg.cg_name = '计算机'; + + + + +``` + + + + + +![image-20240919223326369](https://gitee.com/pys6/jian-yu/raw/master/image/202409192233541.png) -- Gitee From d4a20a68eaf3dcae0a3dffc22a2ecd26e89c6510 Mon Sep 17 00:00:00 2001 From: 12693 <462709894@qq.com> Date: Thu, 19 Sep 2024 22:37:34 +0800 Subject: [PATCH 3/3] text --- ...1\344\270\212\344\271\246\345\272\2274.md" | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git "a/\345\275\255\346\260\270\347\233\233/20240919 \347\275\221\344\270\212\344\271\246\345\272\2274.md" "b/\345\275\255\346\260\270\347\233\233/20240919 \347\275\221\344\270\212\344\271\246\345\272\2274.md" index e1cc444..f96ae38 100644 --- "a/\345\275\255\346\260\270\347\233\233/20240919 \347\275\221\344\270\212\344\271\246\345\272\2274.md" +++ "b/\345\275\255\346\260\270\347\233\233/20240919 \347\275\221\344\270\212\344\271\246\345\272\2274.md" @@ -1,3 +1,56 @@ +## 需求分析 + +1. 分类 + 1. 分类编号 + 2. 分类名称 +2. 图书: + 1. 图书编号 + 2. 图书名称 + 3. 图书价格 + 4. ISBN + 5. 出版社 + 6. 出版日期 + 7. 简介 + 8. 封面图片 + 9. 库存 + 10. 分类编号 +3. 作者 + 1. 作者编号 + 2. 作者姓名 + 3. 性别 + 4. 生日 +4. 用户 + 1. 用户编号 + 2. 用户名称 + 3. 用户地址 + 4. 电话 + 5. 邮箱 +5. 图片 + 1. 图片编号 + 2. 图片名称 + 3. 路径 + 4. 上传者 +6. 书店 + 1. 书店编号 + 2. 书店名称 +7. 订单表 + 1. 订单编号 + 2. 订单日期 + 3. 订单金额 + 4. 订单状态 +8. 订单详情表 + 1. 订单详情编号 + 2. 商品编号 + 3. 数量 + 4. 单价 +9. 评论 + 1. 评论编号 + 2. 评论内容 + + + + + ## 概念 ![image-20240919223110599](https://gitee.com/pys6/jian-yu/raw/master/image/202409192231777.png) -- Gitee