我的任务是完成数据库、留言板和老师登陆模块的代码。数据库是用mysql做的,为了保存好数据库,将做好的数据库转化为了代码。代码如下:
/*
SQLyog 企业版 - MySQL GUI v8.14
MySQL - 5.0.22-community-nt-log : Database - jxpt
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`jxpt` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `jxpt`;
/*Table structure for table `admin` */
DROP TABLE IF EXISTS `admin`;
CREATE TABLE `admin` (
`AdminId` int(8) NOT NULL COMMENT '管理员ID主键',
`AdminRole` varchar(20) NOT NULL COMMENT '角色',
`AdminName` varchar(20) NOT NULL COMMENT '姓名',
PRIMARY KEY (`AdminId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*Data for the table `admin` */
/*Table structure for table `answer` */
DROP TABLE IF EXISTS `answer`;
CREATE TABLE `answer` (
`Aid` int(8) NOT NULL COMMENT '试题题号id主键',
`Pid` varchar(50) NOT NULL COMMENT '试卷id',
`Anwer` int(50) NOT NULL COMMENT '题目答案',
`Point` int(8) NOT NULL COMMENT '试题分数',
`Atype` varchar(50) NOT NULL COMMENT '试题类型',
PRIMARY KEY (`Aid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*Data for the table `answer` */
/*Table structure for table `course` */
DROP TABLE IF EXISTS `course`;
CREATE TABLE `course` (
`CorId` int(8) NOT NULL COMMENT '课程ID主键 ',
`CorName` varchar(15) NOT NULL COMMENT '姓名',
`CorInfo` varchar(100) NOT NULL COMMENT '简介',
`TchId` int(8) NOT NULL COMMENT '教师ID外键',
`Cortype` varchar(50) NOT NULL COMMENT '课程类别',
PRIMARY KEY (`CorId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*Data for the table `course` */
/*Table structure for table `ggxx` */
DROP TABLE IF EXISTS `ggxx`;
CREATE TABLE `ggxx` (
`noticeID` int(10) NOT NULL COMMENT '公告ID 主键',
`AdminID` int(10) default NULL COMMENT '管理员ID外键',
`TchID` int(8) default NULL COMMENT '教师ID 外键',
`noticeContent` varchar(500) NOT NULL COMMENT '公告内容',
`noticeTitle` varchar(100) NOT NULL COMMENT '公告标题',
`oticeTime` datetime NOT NULL COMMENT '发布时间',
`noticeType` varchar(100) NOT NULL COMMENT '公告类型',
PRIMARY KEY (`noticeID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*Data for the table `ggxx` */
/*Table structure for table `lyhf` */
DROP TABLE IF EXISTS `lyhf`;
CREATE TABLE `lyhf` (
`hfID` int(7) NOT NULL COMMENT '回复ID 主键',
`hfcontent` varchar(500) NOT NULL COMMENT '回复内容',
`hftheme` varchar(100) NOT NULL COMMENT '回复主题',
`hftime` datetime NOT NULL COMMENT '回复时间',
`TchID` int(8) NOT NULL COMMENT '教师id 外键',
PRIMARY KEY (`hfID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*Data for the table `lyhf` */
/*Table structure for table `lyxx` */
DROP TABLE IF EXISTS `lyxx`;
CREATE TABLE `lyxx` (
`lyID` int(7) NOT NULL COMMENT '留言ID 主键',
`lycontent` varchar(500) NOT NULL COMMENT '留言内容',
`lyTheme` varchar(100) NOT NULL COMMENT '留言主题',
`lyTime` datetime NOT NULL COMMENT '留言时间',
`StuID` int(8) NOT NULL COMMENT '学生id 外键',
PRIMARY KEY (`lyID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*Data for the table `lyxx` */
/*Table structure for table `paper` */
DROP TABLE IF EXISTS `paper`;
CREATE TABLE `paper` (
`Pid` int(8) NOT NULL COMMENT '试卷id主键',
`Pname` varchar(50) NOT NULL COMMENT '试卷名称',
`Tchid` int(8) NOT NULL COMMENT '上传教师id 外键',
`CorId` int(8) NOT NULL COMMENT '外键',
`Ptime` date NOT NULL COMMENT '试卷上传时间',
PRIMARY KEY (`Pid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*Data for the table `paper` */
/*Table structure for table `source` */
DROP TABLE IF EXISTS `source`;
CREATE TABLE `source` (
`Sid` int(8) NOT NULL COMMENT '主键',
`Sname` varchar(50) NOT NULL COMMENT '资料题目',
`Stype` varchar(50) NOT NULL COMMENT '资料类型',
`TchId` int(8) NOT NULL COMMENT '教师ID',
`Stime` date NOT NULL COMMENT '上传时间',
`Tsave` date NOT NULL COMMENT '资料存储时间',
`CorId` int(8) NOT NULL COMMENT '课程ID',
PRIMARY KEY (`Sid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*Data for the table `source` */
/*Table structure for table `student` */
DROP TABLE IF EXISTS `student`;
CREATE TABLE `student` (
`StuId` int(8) NOT NULL COMMENT '学生ID主键',
`StuName` varchar(15) NOT NULL COMMENT '姓名',
`StuRole` varchar(20) NOT NULL COMMENT '角色',
`StuDept` varchar(20) NOT NULL COMMENT '学院',
`StuMajor` varchar(20) NOT NULL COMMENT '系',
PRIMARY KEY (`StuId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*Data for the table `student` */
/*Table structure for table `teacher` */
DROP TABLE IF EXISTS `teacher`;
CREATE TABLE `teacher` (
`TchId` int(8) NOT NULL COMMENT '教师ID主键 ',
`TchName` varchar(15) NOT NULL COMMENT '姓名 ',
`TchRole` varchar(20) NOT NULL COMMENT '角色 ',
`TchDept` varchar(20) NOT NULL COMMENT '学院',
`TchMajor` varchar(20) NOT NULL COMMENT '系',
`TchInfo` varchar(100) NOT NULL COMMENT '简介 ',
PRIMARY KEY (`TchId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*Data for the table `teacher` */
/*Table structure for table `test` */
DROP TABLE IF EXISTS `test`;
CREATE TABLE `test` (
`Tid` int(8) NOT NULL COMMENT '考试表id 主键',
` StuId` int(8) NOT NULL COMMENT '考生id 主键',
`Tstart` date NOT NULL COMMENT '考试开始时间',
`Ttime` datetime NOT NULL COMMENT '考试所需时间',
`Score` int(3) NOT NULL COMMENT '考试分数',
PRIMARY KEY (`Tid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*Data for the table `test` */
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;