1 Star 0 Fork 0

kakaxiiii/结束吧

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
xnjsrt.sql 18.49 KB
一键复制 编辑 原始数据 按行查看 历史
/*
Navicat Premium Data Transfer
Source Server : xuniji
Source Server Type : MySQL
Source Server Version : 80027
Source Host : localhost:3306
Source Schema : xnjsrt
Target Server Type : MySQL
Target Server Version : 80027
File Encoding : 65001
Date: 13/01/2022 21:18:07
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for administrator
-- ----------------------------
DROP TABLE IF EXISTS `administrator`;
CREATE TABLE `administrator` (
`aid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`aname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`apwd` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`aphone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
PRIMARY KEY (`aid`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of administrator
-- ----------------------------
INSERT INTO `administrator` VALUES ('000001', '张伟', '111111', '13029870063');
INSERT INTO `administrator` VALUES ('000002', '刘小刚', '111111', '18708963345');
INSERT INTO `administrator` VALUES ('000003', '周彤', '111111', '13859202239');
-- ----------------------------
-- Table structure for book
-- ----------------------------
DROP TABLE IF EXISTS `book`;
CREATE TABLE `book` (
`bid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`bname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`bpicture` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`bowner` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`borigin` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`brank` enum('A','B','C') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`btext` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
PRIMARY KEY (`bid`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of book
-- ----------------------------
INSERT INTO `book` VALUES ('GT-GSH-122/GT-024-197(36)', '民國年間龍令宏/呈軍隧圜長吴侯病假报告', 'https://wx3.sinaimg.cn/bmiddle/006JTilCgy1gxyhj5w1q1j30am0gxq7f.jpg', '羅仙花', '高釀镇上花村十一组', 'A', NULL);
INSERT INTO `book` VALUES ('GT-GSH-122/GT-024-197(37)', '民國年間龍令宏/呈軍隧圜長吴侯病假績假条', 'https://wx1.sinaimg.cn/bmiddle/006JTilCgy1gxyhj6ajipj30ck0gtaf3.jpg', '羅仙花', '高釀镇上花村十一组', 'C', NULL);
INSERT INTO `book` VALUES ('GT-GTB-001/GT-042-003', '民國十年九月十五日楊氏引芝田契', 'https://wx2.sinaimg.cn/bmiddle/006JTilCgy1gxyhosedogj30b50ggaep.jpg', '刘荣化', '高楊镇豋保村十一组', 'B', NULL);
-- ----------------------------
-- Table structure for book_log
-- ----------------------------
DROP TABLE IF EXISTS `book_log`;
CREATE TABLE `book_log` (
`id` int(0) NOT NULL AUTO_INCREMENT,
`new_bid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`old_bid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`new_bname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`old_bname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`new_bpicture` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`old_bpicture` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`new_bowner` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`old_bowner` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`new_borigin` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`old_borigin` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`new_brank` enum('A','B','C') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`old_brank` enum('A','B','C') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`new_btext` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
`old_btext` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
`modify_time` timestamp(0) NULL DEFAULT NULL,
`modify_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of book_log
-- ----------------------------
INSERT INTO `book_log` VALUES (1, 'GT-GSH-122/GT-024-197(37)', 'GT-GSH-122/GT-024-197(37)', '民國年間龍令宏/呈軍隧圜長吴侯病假績假条', '民國年間龍令宏/呈軍隧圜長吴侯病假績假条', NULL, NULL, '羅仙花', '羅仙花', '高釀镇上花村十一组', '高釀镇上花村十一组', 'C', 'A', NULL, NULL, '2022-01-13 19:52:38', 'root@localhost');
INSERT INTO `book_log` VALUES (2, 'GT-GSH-122/GT-024-197(36)', 'GT-GSH-122/GT-024-197(36)', '民國年間龍令宏/呈軍隧圜長吴侯病假报告', '民國年間龍令宏/呈軍隧圜長吴侯病假报告', 'https://wx3.sinaimg.cn/bmiddle/006JTilCgy1gxyhj5w1q1j30am0gxq7f.jpg', NULL, '羅仙花', '羅仙花', '高釀镇上花村十一组', '高釀镇上花村十一组', 'A', 'A', NULL, NULL, '2022-01-13 19:55:43', 'root@localhost');
INSERT INTO `book_log` VALUES (3, 'GT-GSH-122/GT-024-197(37)', 'GT-GSH-122/GT-024-197(37)', '民國年間龍令宏/呈軍隧圜長吴侯病假績假条', '民國年間龍令宏/呈軍隧圜長吴侯病假績假条', 'https://wx1.sinaimg.cn/bmiddle/006JTilCgy1gxyhj6ajipj30ck0gtaf3.jpg', NULL, '羅仙花', '羅仙花', '高釀镇上花村十一组', '高釀镇上花村十一组', 'C', 'C', NULL, NULL, '2022-01-13 19:55:45', 'root@localhost');
INSERT INTO `book_log` VALUES (4, 'GT-GTB-001/GT-042-003', 'GT-GTB-001/GT-042-003', '民國十年九月十五日楊氏引芝田契', '民國十年九月十五日楊氏引芝田契', 'https://wx2.sinaimg.cn/bmiddle/006JTilCgy1gxyhosedogj30b50ggaep.jpg', NULL, '刘荣化', '刘荣化', '高楊镇豋保村十一组', '高楊镇豋保村十一组', 'B', 'B', NULL, NULL, '2022-01-13 19:56:00', 'root@localhost');
-- ----------------------------
-- Table structure for book_work
-- ----------------------------
DROP TABLE IF EXISTS `book_work`;
CREATE TABLE `book_work` (
`bid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`wid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
PRIMARY KEY (`bid`, `wid`) USING BTREE,
INDEX `FK_book_work2`(`wid`) USING BTREE,
CONSTRAINT `FK_book_work` FOREIGN KEY (`bid`) REFERENCES `book` (`bid`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_book_work2` FOREIGN KEY (`wid`) REFERENCES `works` (`wid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of book_work
-- ----------------------------
INSERT INTO `book_work` VALUES ('GT-GTB-001/GT-042-003', '000001');
INSERT INTO `book_work` VALUES ('GT-GTB-001/GT-042-003', '000002');
-- ----------------------------
-- Table structure for classg
-- ----------------------------
DROP TABLE IF EXISTS `classg`;
CREATE TABLE `classg` (
`cid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`tid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`cname` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`cnum` int(0) NULL DEFAULT NULL,
PRIMARY KEY (`cid`) USING BTREE,
INDEX `FK_class_teacher`(`tid`) USING BTREE,
CONSTRAINT `FK_class_teacher` FOREIGN KEY (`tid`) REFERENCES `teacher` (`tid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of classg
-- ----------------------------
INSERT INTO `classg` VALUES ('191', '000001', '历史191', 5);
INSERT INTO `classg` VALUES ('192', '000001', '历史192', 1);
-- ----------------------------
-- Table structure for finishwork
-- ----------------------------
DROP TABLE IF EXISTS `finishwork`;
CREATE TABLE `finishwork` (
`tid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`wid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`sid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`fwtext` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
`fwgrade` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`fwcomment` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`fwstate` enum('未提交','等待批改','已批改') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
PRIMARY KEY (`tid`, `wid`, `sid`) USING BTREE,
INDEX `FK_finishwork2`(`wid`) USING BTREE,
INDEX `FK_finishwork3`(`sid`) USING BTREE,
CONSTRAINT `FK_finishwork` FOREIGN KEY (`tid`) REFERENCES `teacher` (`tid`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_finishwork2` FOREIGN KEY (`wid`) REFERENCES `works` (`wid`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_finishwork3` FOREIGN KEY (`sid`) REFERENCES `student` (`sid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of finishwork
-- ----------------------------
INSERT INTO `finishwork` VALUES ('000001', '000001', '2019001', NULL, NULL, NULL, '未提交');
INSERT INTO `finishwork` VALUES ('000001', '000001', '2019002', NULL, NULL, NULL, '未提交');
INSERT INTO `finishwork` VALUES ('000001', '000001', '2019003', NULL, NULL, NULL, '未提交');
INSERT INTO `finishwork` VALUES ('000001', '000001', '2019004', NULL, NULL, NULL, '未提交');
INSERT INTO `finishwork` VALUES ('000001', '000001', '2019005', NULL, NULL, NULL, '未提交');
INSERT INTO `finishwork` VALUES ('000001', '000002', '2019001', NULL, NULL, NULL, '未提交');
INSERT INTO `finishwork` VALUES ('000001', '000002', '2019002', NULL, NULL, NULL, '未提交');
INSERT INTO `finishwork` VALUES ('000001', '000002', '2019003', NULL, NULL, NULL, '未提交');
INSERT INTO `finishwork` VALUES ('000001', '000002', '2019004', NULL, NULL, NULL, '未提交');
INSERT INTO `finishwork` VALUES ('000001', '000002', '2019005', NULL, NULL, NULL, '未提交');
-- ----------------------------
-- Table structure for student
-- ----------------------------
DROP TABLE IF EXISTS `student`;
CREATE TABLE `student` (
`sid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`cid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`sname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`spwd` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
PRIMARY KEY (`sid`) USING BTREE,
INDEX `FK_class_student`(`cid`) USING BTREE,
CONSTRAINT `FK_class_student` FOREIGN KEY (`cid`) REFERENCES `classg` (`cid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of student
-- ----------------------------
INSERT INTO `student` VALUES ('1815000426', '192', '龙哥', '123456');
INSERT INTO `student` VALUES ('2019001', '191', '邓然然', '111111');
INSERT INTO `student` VALUES ('2019002', '191', '方果', '111111');
INSERT INTO `student` VALUES ('2019003', '191', '欧以衎', '111111');
INSERT INTO `student` VALUES ('2019004', '191', '潘云禅', '111111');
INSERT INTO `student` VALUES ('2019005', '191', '周东隅', '111111');
-- ----------------------------
-- Table structure for teacher
-- ----------------------------
DROP TABLE IF EXISTS `teacher`;
CREATE TABLE `teacher` (
`tid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`tname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`tpwd` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`tphone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
PRIMARY KEY (`tid`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of teacher
-- ----------------------------
INSERT INTO `teacher` VALUES ('000001', '刘芳', '111111', '13107986634');
INSERT INTO `teacher` VALUES ('000002', '周可', '111111', '13911920987');
INSERT INTO `teacher` VALUES ('000003', '楚天阔', '111111', '13107986634');
-- ----------------------------
-- Table structure for works
-- ----------------------------
DROP TABLE IF EXISTS `works`;
CREATE TABLE `works` (
`wid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`cid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`wtitle` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`wcontent` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`wbtime` datetime(0) NULL DEFAULT NULL,
`wetime` datetime(0) NULL DEFAULT NULL,
PRIMARY KEY (`wid`) USING BTREE,
INDEX `FK_class_work`(`cid`) USING BTREE,
CONSTRAINT `FK_class_work` FOREIGN KEY (`cid`) REFERENCES `classg` (`cid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of works
-- ----------------------------
INSERT INTO `works` VALUES ('000001', '191', '校对作业1', '根据文书图片内容进行翻译,注意截至日期', '2022-01-13 19:13:23', '2022-01-16 19:13:23');
INSERT INTO `works` VALUES ('000002', '191', '校对作业2', '根据文书图片内容进行翻译,注意截至日期', '2022-01-13 19:13:23', '2022-01-16 19:13:23');
-- ----------------------------
-- View structure for bcbook
-- ----------------------------
DROP VIEW IF EXISTS `bcbook`;
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `bcbook` AS select `book`.`bid` AS `bid`,`book`.`bname` AS `bname`,`book`.`bpicture` AS `bpicture`,`book`.`bowner` AS `bowner`,`book`.`borigin` AS `borigin`,`book`.`brank` AS `brank`,`book`.`btext` AS `btext` from `book` where ((`book`.`brank` = 'C') or (`book`.`brank` = 'B'));
-- ----------------------------
-- View structure for cbook
-- ----------------------------
DROP VIEW IF EXISTS `cbook`;
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `cbook` AS select `book`.`bid` AS `bid`,`book`.`bname` AS `bname`,`book`.`bpicture` AS `bpicture`,`book`.`bowner` AS `bowner`,`book`.`borigin` AS `borigin`,`book`.`brank` AS `brank`,`book`.`btext` AS `btext` from `book` where (`book`.`brank` = 'C');
-- ----------------------------
-- View structure for seehomework
-- ----------------------------
DROP VIEW IF EXISTS `seehomework`;
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `seehomework` AS select `w`.`wid` AS `wid`,`w`.`wtitle` AS `wtitle`,`w`.`wcontent` AS `wcontent`,`b`.`bpicture` AS `bpicture`,`w`.`wbtime` AS `wbtime`,`w`.`wetime` AS `wetime`,`fs`.`fwtext` AS `fwtext`,`fs`.`fwgrade` AS `fwgrade`,`fs`.`fwcomment` AS `fwcomment`,`fs`.`fwstate` AS `fwstate`,`s`.`sname` AS `sname`,`s`.`spwd` AS `spwd`,`t`.`tname` AS `tname`,`t`.`tpwd` AS `tpwd` from (((((`student` `s` join `teacher` `t`) join `finishwork` `fs`) join `book` `b`) join `book_work` `bw`) join `works` `w`) where ((`s`.`sid` = `fs`.`sid`) and (`fs`.`tid` = `t`.`tid`) and (`w`.`wid` = `fs`.`wid`) and (`b`.`bid` = `bw`.`bid`) and (`bw`.`wid` = `fs`.`wid`));
-- ----------------------------
-- Procedure structure for sUPDATE_fw
-- ----------------------------
DROP PROCEDURE IF EXISTS `sUPDATE_fw`;
delimiter ;;
CREATE PROCEDURE `sUPDATE_fw`(in n_wid varchar(255),
in n_sid varchar(255),
in n_fwtext text)
BEGIN
update finishwork
set fwstate='等待批改',fwtext=n_fwtext
WHERE wid=n_wid and sid=n_sid;
END
;;
delimiter ;
-- ----------------------------
-- Procedure structure for tUPDATE_fw
-- ----------------------------
DROP PROCEDURE IF EXISTS `tUPDATE_fw`;
delimiter ;;
CREATE PROCEDURE `tUPDATE_fw`(in n_wid varchar(255),
in n_sid varchar(255),
in n_fwcomment varchar(1024),
in n_fwgrade VARCHAR(255))
BEGIN
update finishwork
set fwstate='已批改',fwcomment=n_fwcomment,fwgrade=n_fwgrade
WHERE wid=n_wid and sid=n_sid;
END
;;
delimiter ;
-- ----------------------------
-- Triggers structure for table book
-- ----------------------------
DROP TRIGGER IF EXISTS `book_update`;
delimiter ;;
CREATE TRIGGER `book_update` BEFORE UPDATE ON `book` FOR EACH ROW begin
insert into book_log
values(null,new.bid,old.bid,new.bname,old.bname,new.bpicture,old.bpicture,new.bowner,old.bowner,new.borigin,old.borigin,new.brank,old.brank,new.btext,old.btext,current_time,current_user);
end
;;
delimiter ;
-- ----------------------------
-- Triggers structure for table student
-- ----------------------------
DROP TRIGGER IF EXISTS `student_insert`;
delimiter ;;
CREATE TRIGGER `student_insert` BEFORE INSERT ON `student` FOR EACH ROW begin
update classg
set cnum=cnum+1
where classg.cid=new.cid;
end
;;
delimiter ;
-- ----------------------------
-- Triggers structure for table student
-- ----------------------------
DROP TRIGGER IF EXISTS `student_delete`;
delimiter ;;
CREATE TRIGGER `student_delete` BEFORE DELETE ON `student` FOR EACH ROW begin
update classg
set cnum=cnum-1
where classg.cid=old.cid;
end
;;
delimiter ;
-- ----------------------------
-- Triggers structure for table student
-- ----------------------------
DROP TRIGGER IF EXISTS `student_update`;
delimiter ;;
CREATE TRIGGER `student_update` BEFORE UPDATE ON `student` FOR EACH ROW if new.cid!=old.cid then
update classg
set cnum=cnum-1
where classg.cid=old.cid;
update classg
set cnum=cnum+1
where classg.cid=new.cid;
end if
;;
delimiter ;
-- ----------------------------
-- Triggers structure for table works
-- ----------------------------
DROP TRIGGER IF EXISTS `work_insert`;
delimiter ;;
CREATE TRIGGER `work_insert` AFTER INSERT ON `works` FOR EACH ROW begin
insert into finishwork(wid,tid,sid,fwtext,fwgrade,fwstate,fwcomment)
select works.wid,classg.tid,student.sid,null,null,'未提交',null
from works,classg,student
where works.wid=new.wid and classg.cid=works.cid and student.cid=classg.cid;
end
;;
delimiter ;
SET FOREIGN_KEY_CHECKS = 1;
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kakaxiiii/its-over.git
git@gitee.com:kakaxiiii/its-over.git
kakaxiiii
its-over
结束吧
master

搜索帮助