/*
Navicat MySQL Data Transfer

Source Server         : local
Source Server Version : 50622
Source Host           : localhost:3306
Source Database       : ddpf13_alpha_7-3-3

Target Server Type    : MYSQL
Target Server Version : 50622
File Encoding         : 65001

Date: 2016-07-03 22:51:15
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for dd_accident
-- ----------------------------
DROP TABLE IF EXISTS `dd_accident`;
CREATE TABLE `dd_accident` (
  `accidentID` int(20) NOT NULL AUTO_INCREMENT COMMENT '事故id',
  `accidentYear` smallint(6) NOT NULL COMMENT '学年',
  `accidentTerm` tinyint(4) NOT NULL COMMENT '学期',
  `userId` int(20) NOT NULL,
  `accidentContent` varchar(127) NOT NULL COMMENT '事故内容',
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`accidentID`),
  KEY `FK_Reference_37` (`userId`),
  CONSTRAINT `FK_Reference_37` FOREIGN KEY (`userId`) REFERENCES `dd_user` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='事故表';

-- ----------------------------
-- Table structure for dd_apply_listened
-- ----------------------------
DROP TABLE IF EXISTS `dd_apply_listened`;
CREATE TABLE `dd_apply_listened` (
  `applyId` int(20) NOT NULL AUTO_INCREMENT COMMENT '听课申请id',
  `applyYear` smallint(6) NOT NULL COMMENT '学年',
  `userId` int(20) NOT NULL,
  `courseTerm` char(20) NOT NULL COMMENT '是否开课 开学的学期',
  `applyType` tinyint(4) NOT NULL COMMENT '申请课程类型//theory; experiment; theory,experiment;',
  `applyTheoryTypeId` int(20) DEFAULT NULL COMMENT '理论课听课类型id',
  `applyExperimentTypeId` int(20) DEFAULT NULL COMMENT '实验课听课类型id',
  `applyTheoryJobTitleId` int(20) DEFAULT NULL COMMENT '理论课申报职称id',
  `applyExperimentJobTitleId` int(20) DEFAULT NULL COMMENT '实验课申报职称id',
  `applyStatus` tinyint(4) NOT NULL DEFAULT '0' COMMENT '申请状态',
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`applyId`),
  KEY `FK_Reference_33` (`applyExperimentJobTitleId`),
  KEY `FK_Reference_34` (`applyTheoryTypeId`),
  KEY `FK_Reference_35` (`applyExperimentTypeId`),
  KEY `FK_Reference_36` (`applyTheoryJobTitleId`),
  KEY `FK_Reference_38` (`userId`),
  CONSTRAINT `FK_Reference_33` FOREIGN KEY (`applyExperimentJobTitleId`) REFERENCES `dd_system_conf` (`confId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_Reference_34` FOREIGN KEY (`applyTheoryTypeId`) REFERENCES `dd_system_conf` (`confId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_Reference_35` FOREIGN KEY (`applyExperimentTypeId`) REFERENCES `dd_system_conf` (`confId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_Reference_36` FOREIGN KEY (`applyTheoryJobTitleId`) REFERENCES `dd_system_conf` (`confId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_Reference_38` FOREIGN KEY (`userId`) REFERENCES `dd_user` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='听课申请表 ';

-- ----------------------------
-- Table structure for dd_appraiser_group
-- ----------------------------
DROP TABLE IF EXISTS `dd_appraiser_group`;
CREATE TABLE `dd_appraiser_group` (
  `appraiserGroupId` int(20) NOT NULL AUTO_INCREMENT COMMENT '督导组id',
  `appraiserGroupName` varchar(255) NOT NULL COMMENT '督导组名称',
  `leaderId` int(20) DEFAULT NULL COMMENT '督导组组长id',
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`appraiserGroupId`),
  KEY `FK_Reference_24` (`leaderId`),
  CONSTRAINT `FK_Reference_24` FOREIGN KEY (`leaderId`) REFERENCES `dd_user` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='督导组分组表 ';

-- ----------------------------
-- Table structure for dd_audit_superiority
-- ----------------------------
DROP TABLE IF EXISTS `dd_audit_superiority`;
CREATE TABLE `dd_audit_superiority` (
  `auditId` int(20) NOT NULL AUTO_INCREMENT COMMENT '审核id',
  `auditYear` smallint(6) NOT NULL COMMENT '学年',
  `userId` int(20) NOT NULL,
  `applyGrade` char(20) NOT NULL DEFAULT '' COMMENT '申报等级',
  `appraiserEvalScore` int(11) NOT NULL DEFAULT '0' COMMENT '督导评分',
  `stuEvalScore` int(11) NOT NULL DEFAULT '0' COMMENT '学生评分',
  `courseCountOwn` smallint(6) NOT NULL DEFAULT '0' COMMENT '独立承担课程门次',
  `planPeriod` smallint(6) NOT NULL DEFAULT '0' COMMENT '累计计划学时',
  `undergraduateWorkload` smallint(6) NOT NULL DEFAULT '0' COMMENT '本科基本教学工作量',
  `PostgraduateWorkload` smallint(6) NOT NULL DEFAULT '0' COMMENT '研究生基本教学工作量',
  `auditStatus` tinyint(4) NOT NULL DEFAULT '0' COMMENT '审核状态',
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`auditId`),
  KEY `FK_Reference_39` (`userId`),
  CONSTRAINT `FK_Reference_39` FOREIGN KEY (`userId`) REFERENCES `dd_user` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='推优审核表';

-- ----------------------------
-- Table structure for dd_briefing
-- ----------------------------
DROP TABLE IF EXISTS `dd_briefing`;
CREATE TABLE `dd_briefing` (
  `briefingId` int(20) NOT NULL AUTO_INCREMENT COMMENT '简报id',
  `briefingYear` smallint(6) NOT NULL COMMENT '学年',
  `briefingTerm` tinyint(4) NOT NULL COMMENT '期数',
  `uploadId` int(20) NOT NULL COMMENT '上传id',
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`briefingId`),
  KEY `FK_Reference_21` (`uploadId`),
  CONSTRAINT `FK_Reference_21` FOREIGN KEY (`uploadId`) REFERENCES `dd_upload` (`uploadId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='简报表';

-- ----------------------------
-- Table structure for dd_briefing_competence
-- ----------------------------
DROP TABLE IF EXISTS `dd_briefing_competence`;
CREATE TABLE `dd_briefing_competence` (
  `briefingCompetenceId` int(20) NOT NULL AUTO_INCREMENT COMMENT '权限id',
  `userId` int(20) NOT NULL COMMENT '教师id',
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`briefingCompetenceId`),
  KEY `FK_Reference_49` (`userId`),
  CONSTRAINT `FK_Reference_49` FOREIGN KEY (`userId`) REFERENCES `dd_user` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='督导简报权限表';

-- ----------------------------
-- Table structure for dd_course_experiment
-- ----------------------------
DROP TABLE IF EXISTS `dd_course_experiment`;
CREATE TABLE `dd_course_experiment` (
  `courseId` int(20) NOT NULL AUTO_INCREMENT COMMENT '课程id',
  `courseYear` smallint(6) NOT NULL COMMENT '学年',
  `courseTerm` tinyint(4) NOT NULL COMMENT '学期',
  `courseName` varchar(255) NOT NULL COMMENT '课程名称',
  `userId` int(20) NOT NULL,
  `courseJoined` int(11) DEFAULT NULL COMMENT '上课人数',
  `courseClass` varchar(40) DEFAULT '' COMMENT '上课班级',
  `courseSite` varchar(40) DEFAULT '' COMMENT '上课地点',
  `courseSession` varchar(40) DEFAULT '' COMMENT '上课时间 周二第1，2节',
  `courseType` varchar(40) DEFAULT '' COMMENT '课程类型',
  `courseDepartmentId` int(20) DEFAULT NULL COMMENT '开课实验室所属部门',
  `experimentName` varchar(255) DEFAULT '' COMMENT '实验项目名称',
  `experimentPeriod` smallint(6) DEFAULT NULL COMMENT '实验项目学时',
  `experimentType` varchar(40) DEFAULT '' COMMENT '实验项目类型',
  `experimentLab` varchar(40) DEFAULT '' COMMENT '开课实验室',
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`courseId`),
  KEY `FK_Reference_40` (`userId`),
  KEY `FK_Reference_8` (`courseDepartmentId`),
  CONSTRAINT `FK_Reference_40` FOREIGN KEY (`userId`) REFERENCES `dd_user` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_Reference_8` FOREIGN KEY (`courseDepartmentId`) REFERENCES `dd_department` (`departmentId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='在导入课表时，要更新<记录在>部门表中没有的课程的开课实验室所属部门(开课实验室不做筛选，不更新)';

-- ----------------------------
-- Table structure for dd_course_theory
-- ----------------------------
DROP TABLE IF EXISTS `dd_course_theory`;
CREATE TABLE `dd_course_theory` (
  `courseId` int(20) NOT NULL AUTO_INCREMENT COMMENT '课程id',
  `courseYear` smallint(6) NOT NULL COMMENT '学年',
  `courseTerm` tinyint(4) NOT NULL COMMENT '学期',
  `courseName` varchar(255) NOT NULL COMMENT '课程名称',
  `userId` int(20) NOT NULL,
  `courseJoined` int(11) DEFAULT NULL COMMENT '上课人数',
  `courseClass` varchar(40) DEFAULT '' COMMENT '上课班级',
  `courseSite` varchar(40) DEFAULT '' COMMENT '上课地点',
  `courseSession` varchar(40) DEFAULT '' COMMENT '上课时间 周二第1，2节',
  `courseType` varchar(40) DEFAULT '' COMMENT '课程类型',
  `courseDepartmentId` int(20) DEFAULT NULL COMMENT '开课学院',
  `coursePeriod` smallint(6) DEFAULT NULL COMMENT '课程学时',
  `courseStartWeek` tinyint(4) DEFAULT NULL COMMENT '开始周',
  `courseEndWeek` tinyint(4) DEFAULT NULL COMMENT '结束周',
  `courseCampus` varchar(40) DEFAULT '' COMMENT '校区名',
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`courseId`),
  KEY `FK_Reference_41` (`userId`),
  KEY `FK_Reference_6` (`courseDepartmentId`),
  CONSTRAINT `FK_Reference_41` FOREIGN KEY (`userId`) REFERENCES `dd_user` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_Reference_6` FOREIGN KEY (`courseDepartmentId`) REFERENCES `dd_department` (`departmentId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='课表(理论课) 在导入课表时，要更新部门表中没有的课程所属部门';

-- ----------------------------
-- Table structure for dd_database
-- ----------------------------
DROP TABLE IF EXISTS `dd_database`;
CREATE TABLE `dd_database` (
  `databaseNum` varchar(255) DEFAULT NULL COMMENT '0.0.1',
  `databaseInfo` varchar(255) DEFAULT NULL,
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='督导数据库信息表 ';

-- ----------------------------
-- Table structure for dd_department
-- ----------------------------
DROP TABLE IF EXISTS `dd_department`;
CREATE TABLE `dd_department` (
  `departmentId` int(20) NOT NULL AUTO_INCREMENT COMMENT '部门id',
  `departmentName` varchar(60) NOT NULL COMMENT '部门名称',
  `departmentPeopleNum` int(11) NOT NULL DEFAULT '0' COMMENT '部门人数',
  `departmentGroupId` int(20) DEFAULT NULL COMMENT '部门所属督导组',
  `departmentStatus` tinyint(4) NOT NULL DEFAULT '0' COMMENT '部门状态',
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`departmentId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='记录部门（导入课表时要更新没有的部门） 学院人数管理';

-- ----------------------------
-- Table structure for dd_evaluate_experiment
-- ----------------------------
DROP TABLE IF EXISTS `dd_evaluate_experiment`;
CREATE TABLE `dd_evaluate_experiment` (
  `evalId` int(20) NOT NULL AUTO_INCREMENT COMMENT '评分id',
  `evalYear` smallint(6) NOT NULL COMMENT '学年',
  `evalTerm` tinyint(4) NOT NULL COMMENT '学期',
  `courseId` int(20) NOT NULL COMMENT '课程id',
  `teacherId` int(20) NOT NULL,
  `evalStatus` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态',
  `appraiserId` int(20) NOT NULL,
  `evaluationId` int(20) DEFAULT NULL COMMENT '教学质量评价表id',
  `ctime` datetime NOT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`evalId`),
  KEY `FK_Reference_16` (`courseId`),
  KEY `FK_Reference_20` (`evaluationId`),
  KEY `FK_Reference_42` (`teacherId`),
  KEY `FK_Reference_43` (`appraiserId`),
  CONSTRAINT `FK_Reference_16` FOREIGN KEY (`courseId`) REFERENCES `dd_course_experiment` (`courseId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_Reference_20` FOREIGN KEY (`evaluationId`) REFERENCES `dd_evaluation_experiment` (`evaluationId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_Reference_42` FOREIGN KEY (`teacherId`) REFERENCES `dd_user` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_Reference_43` FOREIGN KEY (`appraiserId`) REFERENCES `dd_user` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='督导评分表-实验课 dd_evaluate_experiment';

-- ----------------------------
-- Table structure for dd_evaluate_theory
-- ----------------------------
DROP TABLE IF EXISTS `dd_evaluate_theory`;
CREATE TABLE `dd_evaluate_theory` (
  `evalId` int(20) NOT NULL AUTO_INCREMENT COMMENT '评分id',
  `evalYear` smallint(6) NOT NULL COMMENT '学年',
  `evalTerm` tinyint(4) NOT NULL COMMENT '学期',
  `courseId` int(20) NOT NULL COMMENT '课程id',
  `teacherId` int(20) NOT NULL,
  `evalStatus` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态',
  `appraiserId` int(20) NOT NULL,
  `evaluationId` int(20) NOT NULL COMMENT '教学质量评价表id',
  `ctime` datetime NOT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`evalId`),
  KEY `FK_Reference_15` (`courseId`),
  KEY `FK_Reference_19` (`evaluationId`),
  KEY `FK_Reference_44` (`teacherId`),
  KEY `FK_Reference_45` (`appraiserId`),
  CONSTRAINT `FK_Reference_15` FOREIGN KEY (`courseId`) REFERENCES `dd_course_theory` (`courseId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_Reference_19` FOREIGN KEY (`evaluationId`) REFERENCES `dd_evaluation_theory` (`evaluationId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_Reference_44` FOREIGN KEY (`teacherId`) REFERENCES `dd_user` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_Reference_45` FOREIGN KEY (`appraiserId`) REFERENCES `dd_user` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='督导评分表(理论课)';

-- ----------------------------
-- Table structure for dd_evaluation_experiment
-- ----------------------------
DROP TABLE IF EXISTS `dd_evaluation_experiment`;
CREATE TABLE `dd_evaluation_experiment` (
  `evaluationId` int(20) NOT NULL AUTO_INCREMENT COMMENT '评价表id',
  `evaluationData` varchar(255) DEFAULT NULL COMMENT '各种数据',
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`evaluationId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='教学质量评价表(实验课) 具体要保存什么字段自行添加';

-- ----------------------------
-- Table structure for dd_evaluation_theory
-- ----------------------------
DROP TABLE IF EXISTS `dd_evaluation_theory`;
CREATE TABLE `dd_evaluation_theory` (
  `evaluationId` int(20) NOT NULL AUTO_INCREMENT COMMENT '评价表id',
  `evaluationData` varchar(255) DEFAULT NULL COMMENT '各种数据',
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`evaluationId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='教学质量评价表(理论课) 具体要保存什么字段自行添加';

-- ----------------------------
-- Table structure for dd_role
-- ----------------------------
DROP TABLE IF EXISTS `dd_role`;
CREATE TABLE `dd_role` (
  `roleId` int(20) NOT NULL AUTO_INCREMENT,
  `userId` int(20) NOT NULL COMMENT '用户id',
  `roleTypeId` int(20) NOT NULL COMMENT '用户角色类型id',
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`roleId`),
  KEY `FK_Reference_25` (`roleTypeId`),
  CONSTRAINT `FK_Reference_25` FOREIGN KEY (`roleTypeId`) REFERENCES `dd_system_conf` (`confId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户角色关系表';

-- ----------------------------
-- Table structure for dd_schedule_experiment
-- ----------------------------
DROP TABLE IF EXISTS `dd_schedule_experiment`;
CREATE TABLE `dd_schedule_experiment` (
  `scheduleId` int(20) NOT NULL AUTO_INCREMENT COMMENT '安排id',
  `scheduleYear` smallint(6) NOT NULL COMMENT '学年',
  `scheduleTerm` tinyint(4) NOT NULL COMMENT '学期',
  `userId` int(20) NOT NULL,
  `courseId` int(20) NOT NULL COMMENT '所听课程id',
  `scheduleStatus` tinyint(4) NOT NULL DEFAULT '0' COMMENT '分配状态',
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`scheduleId`),
  KEY `FK_Reference_10` (`courseId`),
  KEY `FK_Reference_46` (`userId`),
  CONSTRAINT `FK_Reference_10` FOREIGN KEY (`courseId`) REFERENCES `dd_course_experiment` (`courseId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_Reference_46` FOREIGN KEY (`userId`) REFERENCES `dd_user` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='听课安排表(实验课)';

-- ----------------------------
-- Table structure for dd_schedule_theory
-- ----------------------------
DROP TABLE IF EXISTS `dd_schedule_theory`;
CREATE TABLE `dd_schedule_theory` (
  `scheduleId` int(20) NOT NULL AUTO_INCREMENT COMMENT '安排id',
  `scheduleYear` smallint(6) NOT NULL COMMENT '学年',
  `scheduleTerm` tinyint(4) NOT NULL COMMENT '学期',
  `userId` int(20) NOT NULL,
  `courseId` int(20) NOT NULL COMMENT '所听课程id',
  `scheduleStatus` tinyint(4) NOT NULL COMMENT '分配状态',
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`scheduleId`),
  KEY `FK_Reference_47` (`userId`),
  KEY `FK_Reference_9` (`courseId`),
  CONSTRAINT `FK_Reference_47` FOREIGN KEY (`userId`) REFERENCES `dd_user` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_Reference_9` FOREIGN KEY (`courseId`) REFERENCES `dd_course_theory` (`courseId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='听课安排表(理论课)';

-- ----------------------------
-- Table structure for dd_student_evaluation
-- ----------------------------
DROP TABLE IF EXISTS `dd_student_evaluation`;
CREATE TABLE `dd_student_evaluation` (
  `stuEvalId` int(20) NOT NULL AUTO_INCREMENT COMMENT '网评id',
  `userId` int(20) NOT NULL,
  `stuEvalData` varchar(255) DEFAULT NULL COMMENT '各种数据',
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`stuEvalId`),
  KEY `FK_Reference_50` (`userId`),
  CONSTRAINT `FK_Reference_50` FOREIGN KEY (`userId`) REFERENCES `dd_user` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='学生网评表 具体数据自行添加';

-- ----------------------------
-- Table structure for dd_summary
-- ----------------------------
DROP TABLE IF EXISTS `dd_summary`;
CREATE TABLE `dd_summary` (
  `summaryId` int(20) NOT NULL AUTO_INCREMENT COMMENT '总结id',
  `summaryYear` smallint(6) NOT NULL COMMENT '学年',
  `summaryNO` tinyint(4) NOT NULL COMMENT '期数',
  `appraiserGroupId` int(20) DEFAULT NULL COMMENT '总结所属督导组id',
  `summaryStatus` tinyint(4) DEFAULT '0' COMMENT '总结状态',
  `uploadId` int(20) DEFAULT NULL COMMENT '上传id',
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`summaryId`),
  KEY `FK_Reference_23` (`uploadId`),
  KEY `FK_Reference_51` (`appraiserGroupId`),
  CONSTRAINT `FK_Reference_23` FOREIGN KEY (`uploadId`) REFERENCES `dd_upload` (`uploadId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_Reference_51` FOREIGN KEY (`appraiserGroupId`) REFERENCES `dd_appraiser_group` (`appraiserGroupId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='总结表';

-- ----------------------------
-- Table structure for dd_system_conf
-- ----------------------------
DROP TABLE IF EXISTS `dd_system_conf`;
CREATE TABLE `dd_system_conf` (
  `confId` int(20) NOT NULL AUTO_INCREMENT,
  `pid` int(20) NOT NULL,
  `k` varchar(255) NOT NULL DEFAULT '',
  `value` varchar(255) NOT NULL DEFAULT '',
  `extra` varchar(255) DEFAULT '' COMMENT '额外，自行解析',
  `status` tinyint(4) DEFAULT '0' COMMENT '状态',
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`confId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统配置表， 用于存放一些配置信息';

-- ----------------------------
-- Table structure for dd_upload
-- ----------------------------
DROP TABLE IF EXISTS `dd_upload`;
CREATE TABLE `dd_upload` (
  `uploadId` int(20) NOT NULL AUTO_INCREMENT COMMENT '上传id',
  `uploadName` varchar(255) NOT NULL COMMENT '文件名',
  `uploadTime` datetime NOT NULL COMMENT '上传时间',
  `uploadPath` varchar(511) NOT NULL COMMENT '文件路径',
  `userId` int(20) DEFAULT NULL COMMENT '上传者id',
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`uploadId`),
  KEY `FK_Reference_22` (`userId`),
  CONSTRAINT `FK_Reference_22` FOREIGN KEY (`userId`) REFERENCES `dd_user` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='上传文件表';

-- ----------------------------
-- Table structure for dd_user
-- ----------------------------
DROP TABLE IF EXISTS `dd_user`;
CREATE TABLE `dd_user` (
  `userId` int(20) NOT NULL AUTO_INCREMENT COMMENT '用户id',
  `userAccount` char(20) NOT NULL COMMENT '账号',
  `userPassword` char(40) NOT NULL COMMENT '用户密码',
  `userName` varchar(64) NOT NULL COMMENT '用户姓名',
  `departmentId` int(20) DEFAULT NULL COMMENT '用户所属部门id',
  `establishmentId` int(20) DEFAULT NULL COMMENT '用户编制id',
  `dutiesId` int(20) DEFAULT NULL COMMENT '用户行政职务id',
  `jobTitleId` int(20) DEFAULT NULL COMMENT '用户行政职称id',
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`userId`),
  KEY `FK_Reference_1` (`departmentId`),
  KEY `FK_Reference_2` (`establishmentId`),
  KEY `FK_Reference_3` (`dutiesId`),
  KEY `FK_Reference_4` (`jobTitleId`),
  CONSTRAINT `FK_Reference_1` FOREIGN KEY (`departmentId`) REFERENCES `dd_system_conf` (`confId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_Reference_2` FOREIGN KEY (`establishmentId`) REFERENCES `dd_system_conf` (`confId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_Reference_3` FOREIGN KEY (`dutiesId`) REFERENCES `dd_system_conf` (`confId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_Reference_4` FOREIGN KEY (`jobTitleId`) REFERENCES `dd_system_conf` (`confId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户表';

-- ----------------------------
-- Table structure for dd_user_listened
-- ----------------------------
DROP TABLE IF EXISTS `dd_user_listened`;
CREATE TABLE `dd_user_listened` (
  `listenedId` int(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `listenedYear` smallint(6) NOT NULL COMMENT '学年',
  `listenedTerm` tinyint(4) NOT NULL COMMENT '学期',
  `userId` int(20) NOT NULL,
  `theoryListened` int(11) DEFAULT '0' COMMENT '理论课已听次数',
  `theoryMaxListened` int(11) DEFAULT '0' COMMENT '理论课最大听课次数',
  `experimentListened` int(11) DEFAULT '0' COMMENT '实验课已听次数',
  `experimentMaxListened` int(11) DEFAULT '0' COMMENT '实验课最大听课次数',
  `ctime` datetime DEFAULT NULL,
  `mtime` datetime DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`listenedId`),
  KEY `FK_Reference_48` (`userId`),
  CONSTRAINT `FK_Reference_48` FOREIGN KEY (`userId`) REFERENCES `dd_user` (`userId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='教师的最大听课次数被更改过 记录在这里；若没有，使用当年学期的默认配置<配置表>';

-- ----------------------------
-- View structure for dd_view_apply_job_title
-- ----------------------------
DROP VIEW IF EXISTS `dd_view_apply_job_title`;
CREATE VIEW `dd_view_apply_job_title` AS select `dd_system_conf`.`confId` AS `applyJobTitleId`,`dd_system_conf`.`value` AS `applyJobTitleName`,`dd_system_conf`.`pid` AS `pid`,`dd_system_conf`.`k` AS `k`,`dd_system_conf`.`extra` AS `extra`,`dd_system_conf`.`status` AS `status` from `dd_system_conf` where `dd_system_conf`.`pid` in (select `dd_system_conf`.`confId` from `dd_system_conf` where ((`dd_system_conf`.`k` = 'root') and (`dd_system_conf`.`value` = 'view_apply_job_title'))) ;

-- ----------------------------
-- View structure for dd_view_duties
-- ----------------------------
DROP VIEW IF EXISTS `dd_view_duties`;
CREATE VIEW `dd_view_duties` AS select `dd_system_conf`.`confId` AS `dutiesId`,`dd_system_conf`.`value` AS `dutiesName`,`dd_system_conf`.`pid` AS `pid`,`dd_system_conf`.`k` AS `k`,`dd_system_conf`.`extra` AS `extra`,`dd_system_conf`.`status` AS `status` from `dd_system_conf` where `dd_system_conf`.`pid` in (select `dd_system_conf`.`confId` from `dd_system_conf` where ((`dd_system_conf`.`k` = 'root') and (`dd_system_conf`.`value` = 'view_duties'))) ;

-- ----------------------------
-- View structure for dd_view_establishmentid
-- ----------------------------
DROP VIEW IF EXISTS `dd_view_establishmentid`;
CREATE VIEW `dd_view_establishmentid` AS select `dd_system_conf`.`confId` AS `establishmentId`,`dd_system_conf`.`value` AS `establishmentName`,`dd_system_conf`.`pid` AS `pid`,`dd_system_conf`.`k` AS `k`,`dd_system_conf`.`extra` AS `extra`,`dd_system_conf`.`status` AS `status` from `dd_system_conf` where `dd_system_conf`.`pid` in (select `dd_system_conf`.`confId` from `dd_system_conf` where ((`dd_system_conf`.`k` = 'root') and (`dd_system_conf`.`value` = 'view_establishment'))) ;

-- ----------------------------
-- View structure for dd_view_job_title
-- ----------------------------
DROP VIEW IF EXISTS `dd_view_job_title`;
CREATE VIEW `dd_view_job_title` AS select `dd_system_conf`.`confId` AS `jobTitleId`,`dd_system_conf`.`value` AS `jobTitleName`,`dd_system_conf`.`pid` AS `pid`,`dd_system_conf`.`k` AS `k`,`dd_system_conf`.`extra` AS `extra`,`dd_system_conf`.`status` AS `status` from `dd_system_conf` where `dd_system_conf`.`pid` in (select `dd_system_conf`.`confId` from `dd_system_conf` where ((`dd_system_conf`.`k` = 'root') and (`dd_system_conf`.`value` = 'view_job_title'))) ;

-- ----------------------------
-- View structure for dd_view_listened_type
-- ----------------------------
DROP VIEW IF EXISTS `dd_view_listened_type`;
CREATE VIEW `dd_view_listened_type` AS select `dd_system_conf`.`confId` AS `listenedId`,`dd_system_conf`.`value` AS `listenedName`,`dd_system_conf`.`pid` AS `pid`,`dd_system_conf`.`k` AS `k`,`dd_system_conf`.`extra` AS `extra`,`dd_system_conf`.`status` AS `status` from `dd_system_conf` where `dd_system_conf`.`pid` in (select `dd_system_conf`.`confId` from `dd_system_conf` where ((`dd_system_conf`.`k` = 'root') and (`dd_system_conf`.`value` = 'view_listened_type'))) ;

-- ----------------------------
-- View structure for dd_view_roletype
-- ----------------------------
DROP VIEW IF EXISTS `dd_view_roletype`;
CREATE VIEW `dd_view_roletype` AS select `dd_system_conf`.`confId` AS `roleId`,`dd_system_conf`.`value` AS `roleName`,`dd_system_conf`.`pid` AS `pid`,`dd_system_conf`.`k` AS `k`,`dd_system_conf`.`extra` AS `extra`,`dd_system_conf`.`status` AS `status` from `dd_system_conf` where `dd_system_conf`.`pid` in (select `dd_system_conf`.`confId` from `dd_system_conf` where ((`dd_system_conf`.`k` = 'root') and (`dd_system_conf`.`value` = 'view_roleType'))) ;
