diff --git "a/\347\216\213\346\227\213/20240907 picgo\347\232\204\344\275\277\347\224\250.md" "b/\347\216\213\346\227\213/20240907 picgo\347\232\204\344\275\277\347\224\250.md" new file mode 100644 index 0000000000000000000000000000000000000000..994d80ef6607c2510dccfaa9ae1f027c82e0e716 --- /dev/null +++ "b/\347\216\213\346\227\213/20240907 picgo\347\232\204\344\275\277\347\224\250.md" @@ -0,0 +1,36 @@ +# picgo的使用 + +1.下载前置文件node.js + +![image-20240907214934102](https://gitee.com/wang-xuan2005217/gallery/raw/master/202409072149275.png) + +2. 下载picgo + + ![image-20240907215040259](https://gitee.com/wang-xuan2005217/gallery/raw/master/202409072150454.png) + + 3. 建立仓库 + + ![image-20240907215248690](https://gitee.com/wang-xuan2005217/gallery/raw/master/202409072152874.png) + + 4.获取仓库url + + ![image-20240907215413856](https://gitee.com/wang-xuan2005217/gallery/raw/master/202409072154886.png) + + 5.设置私人名牌 + + ![image-20240907215542590](https://gitee.com/wang-xuan2005217/gallery/raw/master/202409072155699.png) + + 6.配置picgo + + ![image-20240907215651537](https://gitee.com/wang-xuan2005217/gallery/raw/master/202409072156568.png) + + 7.设置picgo + + 1. 关闭其他图床 + + ![image-20240907215837656](https://gitee.com/wang-xuan2005217/gallery/raw/master/202409072158678.png) + + 2. 开启开机启动,时间戳重复 + + ![image-20240907220015547](https://gitee.com/wang-xuan2005217/gallery/raw/master/202409072200576.png) + diff --git "a/\347\216\213\346\227\213/20240908 \345\210\235\350\257\206rbac.md" "b/\347\216\213\346\227\213/20240908 \345\210\235\350\257\206rbac.md" new file mode 100644 index 0000000000000000000000000000000000000000..91664d6fb2a941c3b4de2c65f5c98622a10cff20 --- /dev/null +++ "b/\347\216\213\346\227\213/20240908 \345\210\235\350\257\206rbac.md" @@ -0,0 +1,303 @@ +# RBAC + +1.RBAC(Role-Based Access Control):基于角色的访问控制。这是一种广泛使用的访问控制方法,用于管理系统中用户对资源的访问权限。 + +个人理解:rbac是把资源先分配给角色,再由角色把资源分配给用户 + + + +# 校园管理系统需求分析 + +1. 角色:学生,老师,班主任 + +2. 功能:通用个人信息修改,修改密码 + + 学生:查看成绩 + + 老师:添加成绩,修改成绩,查看成绩 + + 班主任:管理学生信息管理,和本班考试信息管理 + + + + # 三个模型 + + ## cdm + + ![81a9940dce34db949e0aae669f738fe](https://gitee.com/wang-xuan2005217/gallery/raw/master/202409081421916.png) + + + + ## ldm + + ![0623d3c756377f8ec8c15f5b80dc17b](https://gitee.com/wang-xuan2005217/gallery/raw/master/202409081422859.png) + + ## pdm + + ![a2cf63d58aa7d8778a16a5a51a4c191](https://gitee.com/wang-xuan2005217/gallery/raw/master/202409081422416.png) + + ## sql语句 + + 1. 初始化 + + ```sql + /*==============================================================*/ + /* DBMS name: MySQL 5.0 */ + /* Created on: 2024/9/8 13:48:27 */ + /*==============================================================*/ + + + drop table if exists Headteacher; + + drop table if exists Personal; + + drop table if exists Teacher; + + drop table if exists class; + + drop table if exists decision; + + drop table if exists grades; + + drop table if exists lesson; + + drop table if exists manage; + + drop table if exists permission; + + drop table if exists role; + + drop table if exists student; + + /*==============================================================*/ + /* Table: Headteacher */ + /*==============================================================*/ + create table Headteacher + ( + hid int not null, + peid int, + rid int, + hname varchar(255), + primary key (hid) + ); + + /*==============================================================*/ + /* Table: Personal */ + /*==============================================================*/ + create table Personal + ( + peid int not null, + sid int, + tid int, + hid int, + pename varchar(255), + pesex int, + peage int, + pebirthday date, + primary key (peid) + ); + + /*==============================================================*/ + /* Table: Teacher */ + /*==============================================================*/ + create table Teacher + ( + tid int not null, + peid int, + rid int, + tname varchar(255), + primary key (tid) + ); + + /*==============================================================*/ + /* Table: class */ + /*==============================================================*/ + create table class + ( + cid int not null, + tid int, + cname varchar(255), + primary key (cid) + ); + + /*==============================================================*/ + /* Table: decision */ + /*==============================================================*/ + create table decision + ( + pid int not null, + rid int not null, + primary key (pid, rid) + ); + + /*==============================================================*/ + /* Table: grades */ + /*==============================================================*/ + create table grades + ( + lid int not null, + sid int not null, + grades int, + primary key (lid, sid) + ); + + /*==============================================================*/ + /* Table: lesson */ + /*==============================================================*/ + create table lesson + ( + lid int not null, + lname varchar(255), + primary key (lid) + ); + + /*==============================================================*/ + /* Table: manage */ + /*==============================================================*/ + create table manage + ( + cid int not null, + hid int not null, + primary key (cid, hid) + ); + + /*==============================================================*/ + /* Table: permission */ + /*==============================================================*/ + create table permission + ( + pid int not null, + pname varchar(255), + primary key (pid) + ); + + /*==============================================================*/ + /* Table: role */ + /*==============================================================*/ + create table role + ( + rid int not null, + rname varchar(255), + primary key (rid) + ); + + /*==============================================================*/ + /* Table: student */ + /*==============================================================*/ + create table student + ( + sid int not null, + cid int, + peid int, + rid int, + sname varchar(255), + primary key (sid) + ); + + alter table Headteacher add constraint FK_correspondingtwo2 foreign key (peid) + references Personal (peid) on delete restrict on update restrict; + + alter table Headteacher add constraint FK_indicateone foreign key (rid) + references role (rid) on delete restrict on update restrict; + + alter table Personal add constraint FK_corresponding2 foreign key (tid) + references Teacher (tid) on delete restrict on update restrict; + + alter table Personal add constraint FK_correspondingone2 foreign key (sid) + references student (sid) on delete restrict on update restrict; + + alter table Personal add constraint FK_correspondingtwo foreign key (hid) + references Headteacher (hid) on delete restrict on update restrict; + + alter table Teacher add constraint FK_corresponding foreign key (peid) + references Personal (peid) on delete restrict on update restrict; + + alter table Teacher add constraint FK_indicatetwo foreign key (rid) + references role (rid) on delete restrict on update restrict; + + alter table class add constraint FK_attendclass foreign key (tid) + references Teacher (tid) on delete restrict on update restrict; + + alter table decision add constraint FK_decision foreign key (pid) + references permission (pid) on delete restrict on update restrict; + + alter table decision add constraint FK_decision2 foreign key (rid) + references role (rid) on delete restrict on update restrict; + + alter table grades add constraint FK_grades foreign key (lid) + references lesson (lid) on delete restrict on update restrict; + + alter table grades add constraint FK_grades2 foreign key (sid) + references student (sid) on delete restrict on update restrict; + + alter table manage add constraint FK_manage foreign key (cid) + references class (cid) on delete restrict on update restrict; + + alter table manage add constraint FK_manage2 foreign key (hid) + references Headteacher (hid) on delete restrict on update restrict; + + alter table student add constraint FK_correspondingone foreign key (peid) + references Personal (peid) on delete restrict on update restrict; + + alter table student add constraint FK_have foreign key (cid) + references class (cid) on delete restrict on update restrict; + + alter table student add constraint FK_indicate foreign key (rid) + references role (rid) on delete restrict on update restrict; + + + ``` + + + + 2. 添加测试的数据 + + ```sql + + INSERT INTO role (rid, rname) VALUES + (1, '学生'), + (2, '教师'), + (3, '班主任'); + + + INSERT INTO permission (pid, pname) VALUES + (1, '添加成绩'), + (2, '修改成绩'), + (3, '查看成绩'); + + + INSERT INTO Personal (peid, pename, pesex, peage, pebirthday) VALUES (101, '李老师', 1, 40, '1984-04-12'); + INSERT INTO Teacher (tid, peid, tname) VALUES (201, 101, '李老师'); + INSERT INTO decision (pid, rid) VALUES (2, 2); + + + INSERT INTO Personal (peid, pename, pesex, peage, pebirthday) VALUES (102, '张三', 0, 18, '2006-09-22'); + INSERT INTO student (sid, peid, sname, cid, rid) VALUES (301, 102, '张三', 401, 1); + INSERT INTO class (cid, cname) VALUES (401, '高一1班'); + + + INSERT INTO Personal (peid, pename, pesex, peage, pebirthday) VALUES (103, '王老师', 0, 35, '1989-07-16'); + INSERT INTO Teacher (tid, peid, tname) VALUES (202, 103, '王老师'); + INSERT INTO Headteacher (hid, peid, hname) VALUES (301, 103, '王老师'); + INSERT INTO decision (pid, rid) VALUES (3, 3); + INSERT INTO manage (cid, hid) VALUES (401, 301); + + + INSERT INTO lesson (lid, lname) VALUES (1, '数学'); + INSERT INTO grades (lid, sid, grades) VALUES (1, 301, 85); + ``` + + 3.查询sql语句 + + ```SQL + SELECT s.sid, s.sname, p.pename, p.pesex, p.peage, p.pebirthday + FROM student s + JOIN Personal p ON s.peid = p.peid; + ``` + + + + + + +