C#建立宿舍管理系统数据库源码-成都快上网建站

C#建立宿舍管理系统数据库源码

这篇文章给大家分享的C#建立宿舍管理系统数据库的代码,相信大部分人都还没学会这个技能,为了让大家学会,给大家总结了以下内容,话不多说,一起往下看吧。

我们提供的服务有:成都网站设计、做网站、微信公众号开发、网站优化、网站认证、泽库ssl等。为成百上千企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的泽库网站制作公司

/*
Navicat MySQL Data Transfer

Source Server         : hibernate
Source Server Version : 50610
Source Host           : 127.0.0.1:3306
Source Database       : dormdb

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

Date: 2019-08-02 12:10:00
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for building
-- ----------------------------
DROP TABLE IF EXISTS `building`;
CREATE TABLE `building` (
  `buildId` int(11) NOT NULL AUTO_INCREMENT,
  `buildName` varchar(30) DEFAULT NULL,
  `dormCount` int(11) DEFAULT NULL,
  `dormFloor` int(11) DEFAULT NULL,
  PRIMARY KEY (`buildId`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of building
-- ----------------------------
INSERT INTO `building` VALUES ('1', '1号楼', '40', '4');
INSERT INTO `building` VALUES ('2', '2号楼', '20', '5');

-- ----------------------------
-- Table structure for charge
-- ----------------------------
DROP TABLE IF EXISTS `charge`;
CREATE TABLE `charge` (
  `chargeId` int(11) NOT NULL AUTO_INCREMENT,
  `chargeDate` datetime DEFAULT NULL,
  `fk_typeId` int(11) DEFAULT NULL,
  `fk_stuId` int(11) DEFAULT NULL,
  `payMoney` decimal(10,2) DEFAULT NULL,
  `fk_teachId` int(11) DEFAULT NULL,
  `memo` varchar(100) DEFAULT NULL,
  `day` int(11) DEFAULT NULL,
  PRIMARY KEY (`chargeId`),
  KEY `fk_typeId` (`fk_typeId`),
  KEY `fk_stuId` (`fk_stuId`),
  KEY `fk_teachId` (`fk_teachId`),
  CONSTRAINT `charge_ibfk_1` FOREIGN KEY (`fk_typeId`) REFERENCES `chargetype` (`typeid`),
  CONSTRAINT `charge_ibfk_2` FOREIGN KEY (`fk_stuId`) REFERENCES `student` (`stuId`),
  CONSTRAINT `charge_ibfk_3` FOREIGN KEY (`fk_teachId`) REFERENCES `teacher` (`teachId`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of charge
-- ----------------------------
INSERT INTO `charge` VALUES ('1', '2019-04-11 08:46:24', '1', '1', '300.00', '2', 'xxxx', '14');
INSERT INTO `charge` VALUES ('2', '2019-04-23 10:06:14', '1', '1', '300.00', '2', 'xxx', '1');

-- ----------------------------
-- Table structure for chargetype
-- ----------------------------
DROP TABLE IF EXISTS `chargetype`;
CREATE TABLE `chargetype` (
  `typeid` int(11) NOT NULL AUTO_INCREMENT,
  `typeName` varchar(20) DEFAULT NULL,
  `unitPrice` decimal(18,2) DEFAULT NULL,
  `flag` int(11) DEFAULT NULL,
  `memo` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`typeid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of chargetype
-- ----------------------------
INSERT INTO `chargetype` VALUES ('1', '二人间', '10.00', null, null);
INSERT INTO `chargetype` VALUES ('2', '三人间', '8.00', null, null);

-- ----------------------------
-- Table structure for classinfo
-- ----------------------------
DROP TABLE IF EXISTS `classinfo`;
CREATE TABLE `classinfo` (
  `classId` int(11) NOT NULL AUTO_INCREMENT,
  `className` varchar(20) DEFAULT NULL,
  `fk_teachId` int(11) DEFAULT NULL,
  `createDate` datetime DEFAULT NULL,
  `endDate` datetime DEFAULT NULL,
  `flag` int(11) DEFAULT NULL,
  `memo` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`classId`),
  KEY `fk_teachId` (`fk_teachId`),
  CONSTRAINT `classinfo_ibfk_1` FOREIGN KEY (`fk_teachId`) REFERENCES `teacher` (`teachId`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of classinfo
-- ----------------------------
INSERT INTO `classinfo` VALUES ('1', 'a125', '1', '2019-04-15 09:04:10', null, '0', null);
INSERT INTO `classinfo` VALUES ('2', 'a126', '1', '2019-04-15 09:05:08', null, '0', null);
INSERT INTO `classinfo` VALUES ('3', 'a127', '1', '2019-04-15 09:05:18', '2019-04-15 09:05:20', '1', null);

-- ----------------------------
-- Table structure for dorm
-- ----------------------------
DROP TABLE IF EXISTS `dorm`;
CREATE TABLE `dorm` (
  `dormId` int(11) NOT NULL AUTO_INCREMENT,
  `dormNum` varchar(10) DEFAULT NULL,
  `fk_typeId` int(11) DEFAULT NULL,
  `fk_buildid` int(11) DEFAULT NULL,
  `personCount` int(11) DEFAULT NULL,
  `flag` int(11) DEFAULT NULL,
  `memo` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`dormId`),
  KEY `fk_typeId` (`fk_typeId`),
  KEY `fk_buildid` (`fk_buildid`),
  CONSTRAINT `dorm_ibfk_1` FOREIGN KEY (`fk_typeId`) REFERENCES `dormtype` (`typeId`),
  CONSTRAINT `dorm_ibfk_2` FOREIGN KEY (`fk_buildid`) REFERENCES `building` (`buildId`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of dorm
-- ----------------------------
INSERT INTO `dorm` VALUES ('1', '401', '1', '1', '0', '1', null);
INSERT INTO `dorm` VALUES ('2', '402', '2', '2', '0', '1', null);
INSERT INTO `dorm` VALUES ('3', '403', '1', '2', '0', '1', null);

-- ----------------------------
-- Table structure for dormtype
-- ----------------------------
DROP TABLE IF EXISTS `dormtype`;
CREATE TABLE `dormtype` (
  `typeId` int(11) NOT NULL AUTO_INCREMENT,
  `typeName` varchar(20) DEFAULT NULL,
  `personCount` int(11) DEFAULT NULL,
  `price` decimal(8,2) DEFAULT NULL,
  `flag` int(11) DEFAULT NULL,
  `sex` char(2) DEFAULT NULL,
  `memeo` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`typeId`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of dormtype
-- ----------------------------
INSERT INTO `dormtype` VALUES ('1', '4人间', '4', '100.00', '1', '男', null);
INSERT INTO `dormtype` VALUES ('2', '4人间', '4', '200.00', '1', '女', null);

-- ----------------------------
-- Table structure for power
-- ----------------------------
DROP TABLE IF EXISTS `power`;
CREATE TABLE `power` (
  `pid` int(11) NOT NULL AUTO_INCREMENT,
  `pname` varchar(20) DEFAULT NULL,
  `url` varchar(200) DEFAULT NULL,
  PRIMARY KEY (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of power
-- ----------------------------

-- ----------------------------
-- Table structure for role
-- ----------------------------
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
  `rid` int(11) NOT NULL AUTO_INCREMENT,
  `rname` varchar(20) DEFAULT NULL,
  `sort` int(11) DEFAULT NULL,
  PRIMARY KEY (`rid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of role
-- ----------------------------

-- ----------------------------
-- Table structure for role_power
-- ----------------------------
DROP TABLE IF EXISTS `role_power`;
CREATE TABLE `role_power` (
  `pid` int(11) DEFAULT NULL,
  `rid` int(11) DEFAULT NULL,
  KEY `pid` (`pid`),
  KEY `rid` (`rid`),
  CONSTRAINT `role_power_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `power` (`pid`),
  CONSTRAINT `role_power_ibfk_2` FOREIGN KEY (`rid`) REFERENCES `role` (`rid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of role_power
-- ----------------------------

-- ----------------------------
-- Table structure for student
-- ----------------------------
DROP TABLE IF EXISTS `student`;
CREATE TABLE `student` (
  `stuId` int(11) NOT NULL AUTO_INCREMENT,
  `stuNum` varchar(30) DEFAULT NULL,
  `stuName` varchar(20) DEFAULT NULL,
  `stuUserName` varchar(20) DEFAULT NULL,
  `stuPass` varchar(20) DEFAULT NULL,
  `sex` varchar(2) DEFAULT NULL,
  `birthday` datetime DEFAULT NULL,
  `cardId` varchar(20) DEFAULT NULL,
  `fk_classId` int(11) DEFAULT NULL,
  `tel` varchar(20) DEFAULT NULL,
  `province` varchar(20) DEFAULT NULL,
  `city` varchar(20) DEFAULT NULL,
  `inDate` datetime DEFAULT NULL,
  `outDate` datetime DEFAULT NULL,
  `dormEndDate` datetime DEFAULT NULL,
  `fk_dormId` int(11) DEFAULT NULL,
  `flag` int(11) DEFAULT NULL,
  `memo` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`stuId`),
  KEY `fk_classId` (`fk_classId`),
  KEY `fk_dormId` (`fk_dormId`),
  CONSTRAINT `student_ibfk_1` FOREIGN KEY (`fk_classId`) REFERENCES `classinfo` (`classId`),
  CONSTRAINT `student_ibfk_2` FOREIGN KEY (`fk_dormId`) REFERENCES `dorm` (`dormId`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of student
-- ----------------------------
INSERT INTO `student` VALUES ('1', '10001', '周瑜', null, null, '男', null, null, '1', null, null, null, null, null, null, null, '0', null);
INSERT INTO `student` VALUES ('2', '10002', '小乔', null, null, '女', null, null, '1', null, null, null, null, null, null, null, '0', null);
INSERT INTO `student` VALUES ('3', '10003', '大乔', null, null, '女', null, null, '1', null, null, null, null, null, null, null, '0', null);
INSERT INTO `student` VALUES ('4', '10004', '貂蝉', null, null, '女', null, null, '1', null, null, null, null, null, null, null, '0', null);
INSERT INTO `student` VALUES ('5', '10005', '孙尚香', null, null, '女', null, null, '1', null, null, null, null, null, null, null, '0', null);
INSERT INTO `student` VALUES ('6', '10006', '赵云', null, null, '男', null, null, '2', null, null, null, null, null, null, null, '0', null);
INSERT INTO `student` VALUES ('7', '10007', '关羽', null, null, '男', null, null, '2', null, null, null, null, null, null, null, '0', null);
INSERT INTO `student` VALUES ('8', '10008', '张飞', null, null, '男', null, null, '2', null, null, null, null, null, null, null, '0', null);
INSERT INTO `student` VALUES ('9', '10009', '马超', null, null, '男', null, null, '2', null, null, null, null, null, null, null, '0', null);
INSERT INTO `student` VALUES ('10', '10010', '黄忠', null, null, '男', null, null, '2', null, null, null, null, null, null, null, '1', null);

-- ----------------------------
-- Table structure for teacher
-- ----------------------------
DROP TABLE IF EXISTS `teacher`;
CREATE TABLE `teacher` (
  `teachId` int(11) NOT NULL AUTO_INCREMENT,
  `teachName` varchar(30) DEFAULT NULL,
  `teachUserName` varchar(20) DEFAULT NULL,
  `teachPass` varchar(20) DEFAULT NULL,
  `sex` varchar(2) DEFAULT NULL,
  `birthday` datetime DEFAULT NULL,
  `idCard` varchar(20) DEFAULT NULL,
  `edulevel` varchar(20) DEFAULT NULL,
  `specialty` varchar(30) DEFAULT NULL,
  `tel` varchar(20) DEFAULT NULL,
  `address` varchar(50) DEFAULT NULL,
  `flag` int(11) DEFAULT NULL,
  `memo` varchar(100) DEFAULT NULL,
  `hireDate` datetime DEFAULT NULL,
  `leaveDate` datetime DEFAULT NULL,
  `fk_typeid` int(11) DEFAULT NULL,
  PRIMARY KEY (`teachId`),
  KEY `fk_typeid` (`fk_typeid`),
  CONSTRAINT `teacher_ibfk_1` FOREIGN KEY (`fk_typeid`) REFERENCES `teachertype` (`typeId`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of teacher
-- ----------------------------
INSERT INTO `teacher` VALUES ('1', '王杨', null, null, null, '2019-04-16 00:00:00', null, null, null, null, null, '0', null, '2019-04-16 00:00:00', null, '1');
INSERT INTO `teacher` VALUES ('2', '赵明芳', null, null, null, null, null, null, null, null, null, '2', null, null, null, '2');
INSERT INTO `teacher` VALUES ('3', '张建', null, null, null, null, null, null, null, null, null, '1', null, null, null, '1');
INSERT INTO `teacher` VALUES ('4', '司朝贵', null, null, null, null, null, null, null, null, null, '2', null, null, '2019-04-10 15:16:12', '2');
INSERT INTO `teacher` VALUES ('5', '马林', null, null, null, null, null, null, null, null, null, '3', null, null, null, '1');
INSERT INTO `teacher` VALUES ('6', '安春青', null, null, null, null, null, null, null, null, null, '1', null, null, null, '7');
INSERT INTO `teacher` VALUES ('7', '武亚娟', null, null, null, null, null, null, null, null, null, '1', null, null, null, '2');
INSERT INTO `teacher` VALUES ('8', 'AA', null, null, null, null, null, null, null, null, null, '2', null, '2019-04-10 11:07:08', null, '1');
INSERT INTO `teacher` VALUES ('9', '王丽娜', null, null, null, '2010-06-06 00:00:00', null, null, null, null, null, '1', null, null, null, '1');
INSERT INTO `teacher` VALUES ('10', '李智', null, null, null, '1989-11-08 00:00:00', null, null, null, null, null, '2', null, '2011-03-10 00:00:00', null, '1');
INSERT INTO `teacher` VALUES ('11', '赵尤溪', null, null, null, '2000-01-11 00:00:00', null, null, null, null, null, '1', null, '2019-04-10 15:02:48', null, '2');
INSERT INTO `teacher` VALUES ('12', '正帅鹏', null, null, null, '1998-01-01 00:00:00', null, null, null, null, null, '1', null, '2019-04-12 08:47:36', null, '1');
INSERT INTO `teacher` VALUES ('13', '张三', '1013', '000000', null, null, null, null, null, null, null, '1', null, null, null, null);
INSERT INTO `teacher` VALUES ('14', '周瑜', '1014', '000000', null, '2019-04-12 00:00:00', null, null, null, null, null, '1', null, '2019-04-12 10:00:15', null, '1');
INSERT INTO `teacher` VALUES ('15', '徐孟伟', '1015', '000000', null, '2010-06-12 00:00:00', null, null, null, null, null, '1', null, '2019-04-12 10:08:08', null, '2');
INSERT INTO `teacher` VALUES ('16', '任鑫', '1016', '000000', null, '2000-07-12 00:00:00', null, null, null, null, null, '1', null, '2019-04-12 10:09:17', null, '3');
INSERT INTO `teacher` VALUES ('17', 'AAA', '1017', '000000', null, '2019-04-12 00:00:00', null, null, null, null, null, '1', null, '2019-04-12 10:09:54', null, '1');
INSERT INTO `teacher` VALUES ('18', '库远远', '1018', '000000', null, '2010-02-03 00:00:00', null, null, null, null, null, '0', null, '2019-04-12 10:12:13', null, '3');
INSERT INTO `teacher` VALUES ('19', '张三', null, null, null, null, null, null, null, null, null, null, null, null, null, null);
INSERT INTO `teacher` VALUES ('20', '王萍', '10020', '0000', null, '2019-04-12 00:00:00', null, null, null, null, null, '1', null, '2019-04-12 14:03:35', null, '3');
INSERT INTO `teacher` VALUES ('22', '赵培勇', null, null, null, '1994-06-16 00:00:00', null, null, null, null, null, '0', null, '2019-04-16 14:41:55', null, '3');
INSERT INTO `teacher` VALUES ('23', '刘新勇', '23', '0000', null, '2019-04-27 00:00:00', null, null, null, null, null, '0', null, '2019-04-27 14:23:07', null, '3');
INSERT INTO `teacher` VALUES ('24', '刘新勇', '24', '0000', null, '2019-04-27 00:00:00', null, null, null, null, null, '0', null, '2019-04-27 14:23:10', null, '3');

-- ----------------------------
-- Table structure for teachertype
-- ----------------------------
DROP TABLE IF EXISTS `teachertype`;
CREATE TABLE `teachertype` (
  `typeId` int(11) NOT NULL AUTO_INCREMENT,
  `typeName` varchar(30) DEFAULT NULL,
  `memo` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`typeId`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of teachertype
-- ----------------------------
INSERT INTO `teachertype` VALUES ('1', '教员', '');
INSERT INTO `teachertype` VALUES ('2', '班主任', '负责管理');
INSERT INTO `teachertype` VALUES ('3', '宿管', '管理寝室');
INSERT INTO `teachertype` VALUES ('6', '校长', '厉害极了!');
INSERT INTO `teachertype` VALUES ('7', '教导主任', '训话,请家长,开除');
INSERT INTO `teachertype` VALUES ('10', '副校长', '');
INSERT INTO `teachertype` VALUES ('12', '副校长', '');
INSERT INTO `teachertype` VALUES ('13', '副校长', '');

-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
  `uid` int(11) NOT NULL AUTO_INCREMENT,
  `tid` int(11) DEFAULT NULL,
  `sid` int(11) DEFAULT NULL,
  PRIMARY KEY (`uid`),
  KEY `tid` (`tid`),
  KEY `sid` (`sid`),
  CONSTRAINT `users_ibfk_1` FOREIGN KEY (`tid`) REFERENCES `teacher` (`teachId`),
  CONSTRAINT `users_ibfk_2` FOREIGN KEY (`sid`) REFERENCES `student` (`stuId`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of users
-- ----------------------------
INSERT INTO `users` VALUES ('1', '1', '1');

-- ----------------------------
-- Table structure for user_role
-- ----------------------------
DROP TABLE IF EXISTS `user_role`;
CREATE TABLE `user_role` (
  `uid` int(11) DEFAULT NULL,
  `rid` int(11) DEFAULT NULL,
  KEY `uid` (`uid`),
  KEY `rid` (`rid`),
  CONSTRAINT `user_role_ibfk_1` FOREIGN KEY (`uid`) REFERENCES `users` (`uid`),
  CONSTRAINT `user_role_ibfk_2` FOREIGN KEY (`rid`) REFERENCES `role` (`rid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of user_role
-- ----------------------------

以上就是C#建立宿舍管理系统数据库的代码展示,详细使用情况还得要大家自己使用过才能知道具体要领。如果想阅读更多相关内容的文章,欢迎关注创新互联行业资讯频道!


分享文章:C#建立宿舍管理系统数据库源码
转载源于:http://kswjz.com/article/gcjgds.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流