├── README.md ├── dormitory.sql ├── pom.xml └── src └── main ├── java └── org │ └── zzzzzz │ ├── controller │ ├── AbsentController.java │ ├── AccountController.java │ ├── BuildingController.java │ ├── DormitoryAdminController.java │ ├── DormitoryController.java │ ├── MoveoutController.java │ └── StudentController.java │ ├── dto │ └── AccountDto.java │ ├── entity │ ├── Absent.java │ ├── Building.java │ ├── Dormitory.java │ ├── DormitoryAdmin.java │ ├── Moveout.java │ ├── Student.java │ └── SystemAdmin.java │ ├── form │ └── AccountForm.java │ ├── mapper │ ├── AbsentMapper.java │ ├── BuildingMapper.java │ ├── DormitoryAdminMapper.java │ ├── DormitoryMapper.java │ ├── MoveoutMapper.java │ ├── StudentMapper.java │ └── SystemAdminMapper.java │ └── service │ ├── AbsentService.java │ ├── AccountService.java │ ├── BuildingService.java │ ├── DormitoryAdminService.java │ ├── DormitoryService.java │ ├── MoveoutService.java │ ├── StudentService.java │ └── impl │ ├── AbsentServiceImpl.java │ ├── AccountServiceImpl.java │ ├── BuildingServiceImpl.java │ ├── DormitoryAdminServiceImpl.java │ ├── DormitoryServiceImpl.java │ ├── MoveoutServiceImpl.java │ └── StudentServiceImpl.java ├── resources ├── config.xml ├── datasource.properties ├── org │ └── zzzzzz │ │ └── mapper │ │ ├── AbsentMapper.xml │ │ ├── BuildingMapper.xml │ │ ├── DormitoryAdminMapper.xml │ │ ├── DormitoryMapper.xml │ │ ├── MoveoutMapper.xml │ │ ├── StudentMapper.xml │ │ └── SystemAdminMapper.xml ├── spring.xml └── springmvc.xml └── webapp ├── WEB-INF └── web.xml ├── absentrecord.jsp ├── absentregister.jsp ├── adminmanager.jsp ├── buildingmanager.jsp ├── css └── style.css ├── dormitoryadmin.jsp ├── dormitorymanager.jsp ├── img ├── 1.jpg ├── 2.jpg └── 3.jpg ├── index.jsp ├── login.jsp ├── moveoutrecord.jsp ├── moveoutregister.jsp ├── studentmanager.jsp └── systemadmin.jsp /README.md: -------------------------------------------------------------------------------- 1 | # 宿舍管理系统 2 | 3 | > 可供大作业、课程设计、毕业选题、技术学习等进行参考 4 | 5 | ## 技术栈 6 | `Spring + SpringMVC + MyBatis + Servlet + ajax(异步提交、级联查询) + jsp + JavaScript + BootStrap` 7 | 8 | ## 开发涉及到的版本信息(供参考) 9 | `Java: 1.8`、`MySQL: 8.0.26`、`Maven: 3.6.1`、`Tomcat: 9.0.24`、`IDEA: 2022.1.1` 10 | 11 | ## 数据库SQL文件 12 | 本项目所涉及到的完整sql文件已经在项目中给出,自行使用相关工具进行执行即可 13 | 14 | ## 帮助 15 | 有疑惑的同学可以向我发送邮件进行探讨,邮箱:`openallzzz@qq.com` 16 | 17 | ## 外链 18 | [B站空间](https://space.bilibili.com/382163139?spm_id_from=333.1007.0.0)   19 | [博客地址](https://blog.csdn.net/Zygood_)  [力扣主页](https://leetcode.cn/u/openallzzz/) 20 | 21 | 本人在学习项目构建之余还会进行算法方面的研究,有相同兴趣的同学可以一起学习。 22 | 23 | -------------------------------------------------------------------------------- /dormitory.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 8.0.19, for Win64 (x86_64) 2 | -- 3 | -- Host: 127.0.0.1 Database: dormitory 4 | -- ------------------------------------------------------ 5 | -- Server version 8.0.19 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!50503 SET NAMES utf8mb4 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Current Database: `dormitory` 20 | -- 21 | 22 | CREATE DATABASE /*!32312 IF NOT EXISTS*/ `dormitory` /*!40100 DEFAULT CHARACTER SET utf8 */ /*!80016 DEFAULT ENCRYPTION='N' */; 23 | 24 | USE `dormitory`; 25 | 26 | -- 27 | -- Table structure for table `absent` 28 | -- 29 | 30 | DROP TABLE IF EXISTS `absent`; 31 | /*!40101 SET @saved_cs_client = @@character_set_client */; 32 | /*!50503 SET character_set_client = utf8mb4 */; 33 | CREATE TABLE `absent` ( 34 | `id` int NOT NULL AUTO_INCREMENT, 35 | `building_id` int DEFAULT NULL, 36 | `dormitory_id` int DEFAULT NULL, 37 | `student_id` int DEFAULT NULL, 38 | `dormitory_admin_id` int DEFAULT NULL, 39 | `create_date` varchar(20) DEFAULT NULL, 40 | `reason` varchar(20) DEFAULT NULL, 41 | PRIMARY KEY (`id`) 42 | ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; 43 | /*!40101 SET character_set_client = @saved_cs_client */; 44 | 45 | -- 46 | -- Dumping data for table `absent` 47 | -- 48 | 49 | LOCK TABLES `absent` WRITE; 50 | /*!40000 ALTER TABLE `absent` DISABLE KEYS */; 51 | INSERT INTO `absent` VALUES (13,1,2,5,16,'2022-04-16','请假'),(14,1,1,1,1,'2022-04-26','请假'),(15,2,5,63,1,'2022-04-26','请假'); 52 | /*!40000 ALTER TABLE `absent` ENABLE KEYS */; 53 | UNLOCK TABLES; 54 | 55 | -- 56 | -- Table structure for table `building` 57 | -- 58 | 59 | DROP TABLE IF EXISTS `building`; 60 | /*!40101 SET @saved_cs_client = @@character_set_client */; 61 | /*!50503 SET character_set_client = utf8mb4 */; 62 | CREATE TABLE `building` ( 63 | `id` int NOT NULL AUTO_INCREMENT, 64 | `name` varchar(50) DEFAULT NULL, 65 | `introduction` varchar(1000) DEFAULT NULL, 66 | `admin_id` int DEFAULT NULL, 67 | PRIMARY KEY (`id`) 68 | ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8; 69 | /*!40101 SET character_set_client = @saved_cs_client */; 70 | 71 | -- 72 | -- Dumping data for table `building` 73 | -- 74 | 75 | LOCK TABLES `building` WRITE; 76 | /*!40000 ALTER TABLE `building` DISABLE KEYS */; 77 | INSERT INTO `building` VALUES (1,'1号楼','计算机学院宿舍楼',16),(2,'2号楼','计算机学院宿舍楼',16),(16,'5号楼','电信学院宿舍楼',16); 78 | /*!40000 ALTER TABLE `building` ENABLE KEYS */; 79 | UNLOCK TABLES; 80 | 81 | -- 82 | -- Table structure for table `dormitory` 83 | -- 84 | 85 | DROP TABLE IF EXISTS `dormitory`; 86 | /*!40101 SET @saved_cs_client = @@character_set_client */; 87 | /*!50503 SET character_set_client = utf8mb4 */; 88 | CREATE TABLE `dormitory` ( 89 | `id` int NOT NULL AUTO_INCREMENT, 90 | `building_id` int DEFAULT NULL, 91 | `name` varchar(20) DEFAULT NULL, 92 | `type` int DEFAULT NULL, 93 | `available` int DEFAULT NULL, 94 | `telephone` varchar(20) DEFAULT NULL, 95 | PRIMARY KEY (`id`) 96 | ) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8; 97 | /*!40101 SET character_set_client = @saved_cs_client */; 98 | 99 | -- 100 | -- Dumping data for table `dormitory` 101 | -- 102 | 103 | LOCK TABLES `dormitory` WRITE; 104 | /*!40000 ALTER TABLE `dormitory` DISABLE KEYS */; 105 | INSERT INTO `dormitory` VALUES (1,1,'101',4,0,'88230001'),(2,1,'102',4,0,'88230002'),(3,1,'211',4,0,'88230007'),(4,2,'212',6,1,'88230008'),(5,2,'321',8,6,'88230013'),(6,2,'322',10,10,'88230016'),(36,1,'666',6,6,'88136666'); 106 | /*!40000 ALTER TABLE `dormitory` ENABLE KEYS */; 107 | UNLOCK TABLES; 108 | 109 | -- 110 | -- Table structure for table `dormitory_admin` 111 | -- 112 | 113 | DROP TABLE IF EXISTS `dormitory_admin`; 114 | /*!40101 SET @saved_cs_client = @@character_set_client */; 115 | /*!50503 SET character_set_client = utf8mb4 */; 116 | CREATE TABLE `dormitory_admin` ( 117 | `id` int NOT NULL AUTO_INCREMENT, 118 | `username` varchar(20) DEFAULT NULL, 119 | `password` varchar(20) DEFAULT NULL, 120 | `name` varchar(20) DEFAULT NULL, 121 | `gender` varchar(10) DEFAULT NULL, 122 | `telephone` varchar(20) DEFAULT NULL, 123 | PRIMARY KEY (`id`) 124 | ) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8; 125 | /*!40101 SET character_set_client = @saved_cs_client */; 126 | 127 | -- 128 | -- Dumping data for table `dormitory_admin` 129 | -- 130 | 131 | LOCK TABLES `dormitory_admin` WRITE; 132 | /*!40000 ALTER TABLE `dormitory_admin` DISABLE KEYS */; 133 | INSERT INTO `dormitory_admin` VALUES (1,'ll','123123','宋玉','女','13312345678'),(2,'ww','123123','王力','男','13612345678'),(16,'zz','123123','张三','女','13312345678'); 134 | /*!40000 ALTER TABLE `dormitory_admin` ENABLE KEYS */; 135 | UNLOCK TABLES; 136 | 137 | -- 138 | -- Table structure for table `moveout` 139 | -- 140 | 141 | DROP TABLE IF EXISTS `moveout`; 142 | /*!40101 SET @saved_cs_client = @@character_set_client */; 143 | /*!50503 SET character_set_client = utf8mb4 */; 144 | CREATE TABLE `moveout` ( 145 | `id` int NOT NULL AUTO_INCREMENT, 146 | `student_id` varchar(11) DEFAULT NULL, 147 | `dormitory_id` varchar(50) DEFAULT NULL, 148 | `reason` varchar(11) DEFAULT NULL, 149 | `create_date` varchar(20) DEFAULT NULL, 150 | PRIMARY KEY (`id`) 151 | ) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8; 152 | /*!40101 SET character_set_client = @saved_cs_client */; 153 | 154 | -- 155 | -- Dumping data for table `moveout` 156 | -- 157 | 158 | LOCK TABLES `moveout` WRITE; 159 | /*!40000 ALTER TABLE `moveout` DISABLE KEYS */; 160 | INSERT INTO `moveout` VALUES (15,'63','6','毕业','2022-04-17'),(17,'18','4','毕业','2022-04-27'); 161 | /*!40000 ALTER TABLE `moveout` ENABLE KEYS */; 162 | UNLOCK TABLES; 163 | 164 | -- 165 | -- Table structure for table `student` 166 | -- 167 | 168 | DROP TABLE IF EXISTS `student`; 169 | /*!40101 SET @saved_cs_client = @@character_set_client */; 170 | /*!50503 SET character_set_client = utf8mb4 */; 171 | CREATE TABLE `student` ( 172 | `id` int NOT NULL AUTO_INCREMENT, 173 | `number` varchar(11) DEFAULT NULL, 174 | `name` varchar(20) DEFAULT NULL, 175 | `gender` varchar(20) DEFAULT NULL, 176 | `dormitory_id` int DEFAULT NULL, 177 | `state` varchar(20) DEFAULT NULL, 178 | `create_date` varchar(20) DEFAULT NULL, 179 | PRIMARY KEY (`id`) 180 | ) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8; 181 | /*!40101 SET character_set_client = @saved_cs_client */; 182 | 183 | -- 184 | -- Dumping data for table `student` 185 | -- 186 | 187 | LOCK TABLES `student` WRITE; 188 | /*!40000 ALTER TABLE `student` DISABLE KEYS */; 189 | INSERT INTO `student` VALUES (1,'001','王伟','男',1,'入住','2022-04-14'),(2,'002','曹海','男',1,'入住','2022-04-14'),(3,'003','李力','男',1,'入住','2022-04-14'),(4,'004','赵昭','男',1,'入住','2022-04-14'),(5,'005','王维利','男',2,'入住','2022-04-14'),(6,'006','李双','女',2,'入住','2022-04-14'),(7,'007','李小峰','男',2,'入住','2022-04-14'),(8,'008','孙奇','男',2,'入住','2022-04-14'),(9,'009','李立','女',3,'入住','2022-04-14'),(10,'010','周华发','男',3,'入住','2022-04-14'),(11,'011','赵正义','男',3,'入住','2022-04-14'),(12,'012','李明','男',3,'入住','2022-04-14'),(13,'013','许鹏飞','男',4,'入住','2022-04-14'),(14,'014','朱海','男',4,'入住','2022-04-14'),(15,'015','苏苏苏','男',4,'入住','2022-04-14'),(16,'016','李雪','女',4,'入住','2022-04-14'),(17,'017','李爽','女',4,'入住','2022-04-14'),(18,'018','王纯','女',4,'迁出','2022-04-14'),(63,'019','小明','男',5,'迁出','2022-04-17'); 190 | /*!40000 ALTER TABLE `student` ENABLE KEYS */; 191 | UNLOCK TABLES; 192 | 193 | -- 194 | -- Table structure for table `system_admin` 195 | -- 196 | 197 | DROP TABLE IF EXISTS `system_admin`; 198 | /*!40101 SET @saved_cs_client = @@character_set_client */; 199 | /*!50503 SET character_set_client = utf8mb4 */; 200 | CREATE TABLE `system_admin` ( 201 | `id` int NOT NULL AUTO_INCREMENT, 202 | `username` varchar(20) DEFAULT NULL, 203 | `password` varchar(20) DEFAULT NULL, 204 | `name` varchar(20) DEFAULT NULL, 205 | `telephone` varchar(20) DEFAULT NULL, 206 | PRIMARY KEY (`id`) 207 | ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; 208 | /*!40101 SET character_set_client = @saved_cs_client */; 209 | 210 | -- 211 | -- Dumping data for table `system_admin` 212 | -- 213 | 214 | LOCK TABLES `system_admin` WRITE; 215 | /*!40000 ALTER TABLE `system_admin` DISABLE KEYS */; 216 | INSERT INTO `system_admin` VALUES (1,'admin1','123123','管理员1','88132001'),(2,'admin2','123123','管理员2','88132002'); 217 | /*!40000 ALTER TABLE `system_admin` ENABLE KEYS */; 218 | UNLOCK TABLES; 219 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 220 | 221 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 222 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 223 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 224 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 225 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 226 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 227 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 228 | 229 | -- Dump completed on 2022-04-27 16:59:42 230 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 4.0.0 6 | 7 | org.zzzzzz 8 | dormitoryms_ssm 9 | 1.0-SNAPSHOT 10 | war 11 | 12 | dormitoryms_ssm Maven Webapp 13 | 14 | http://www.example.com 15 | 16 | 17 | UTF-8 18 | 1.8 19 | 1.8 20 | 21 | 22 | 23 | 24 | junit 25 | junit 26 | 4.11 27 | test 28 | 29 | 30 | 31 | 32 | org.springframework 33 | spring-webmvc 34 | 5.2.7.RELEASE 35 | 36 | 37 | 38 | 39 | org.springframework 40 | spring-jdbc 41 | 5.2.7.RELEASE 42 | 43 | 44 | 45 | org.springframework 46 | spring-context 47 | 5.2.7.RELEASE 48 | 49 | 50 | 51 | 52 | org.mybatis 53 | mybatis 54 | 3.5.5 55 | 56 | 57 | 58 | 59 | org.mybatis 60 | mybatis-spring 61 | 2.0.3 62 | 63 | 64 | 65 | 66 | mysql 67 | mysql-connector-java 68 | 8.0.26 69 | 70 | 71 | 72 | 73 | com.mchange 74 | c3p0 75 | 0.9.5.5 76 | 77 | 78 | 79 | 80 | jstl 81 | jstl 82 | 1.2 83 | 84 | 85 | 86 | 87 | javax.servlet 88 | javax.servlet-api 89 | 4.0.1 90 | 91 | 92 | 93 | 94 | org.projectlombok 95 | lombok 96 | 1.18.12 97 | 98 | 99 | 100 | com.alibaba 101 | fastjson 102 | 1.2.18 103 | 104 | 105 | 106 | 107 | 108 | dormitoryms_ssm 109 | 110 | 111 | 112 | maven-clean-plugin 113 | 3.1.0 114 | 115 | 116 | 117 | maven-resources-plugin 118 | 3.0.2 119 | 120 | 121 | maven-compiler-plugin 122 | 3.8.0 123 | 124 | 125 | maven-surefire-plugin 126 | 2.22.1 127 | 128 | 129 | maven-war-plugin 130 | 3.2.2 131 | 132 | 133 | maven-install-plugin 134 | 2.5.2 135 | 136 | 137 | maven-deploy-plugin 138 | 2.8.2 139 | 140 | 141 | 142 | 143 | 144 | 145 | src/main/java 146 | 147 | **/*.properties 148 | **/*.xml 149 | 150 | false 151 | 152 | 153 | 154 | src/main/resources 155 | 156 | datasource.properties 157 | **/*.xml 158 | 159 | false 160 | 161 | 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/controller/AbsentController.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.PostMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.servlet.ModelAndView; 9 | import org.zzzzzz.entity.*; 10 | import org.zzzzzz.service.AbsentService; 11 | import org.zzzzzz.service.BuildingService; 12 | import org.zzzzzz.service.DormitoryService; 13 | import org.zzzzzz.service.StudentService; 14 | 15 | import javax.servlet.http.HttpSession; 16 | import java.util.List; 17 | 18 | @Controller 19 | @RequestMapping("/absent") 20 | public class AbsentController { 21 | 22 | @Autowired 23 | private AbsentService absentService; 24 | 25 | @Autowired 26 | private BuildingService buildingService; 27 | 28 | @Autowired 29 | private DormitoryService dormitoryService; 30 | 31 | @Autowired 32 | private StudentService studentService; 33 | 34 | @GetMapping("/list") 35 | public ModelAndView list() { 36 | ModelAndView modelAndView = new ModelAndView(); 37 | modelAndView.setViewName("absentrecord"); 38 | modelAndView.addObject("list", this.absentService.list()); 39 | return modelAndView; 40 | } 41 | 42 | @PostMapping("/search") 43 | public ModelAndView search(String key, String value) { 44 | ModelAndView modelAndView = new ModelAndView(); 45 | modelAndView.setViewName("absentrecord"); 46 | modelAndView.addObject("list", this.absentService.search(key, value)); 47 | return modelAndView; 48 | } 49 | 50 | @GetMapping("/init") 51 | public ModelAndView init() { 52 | ModelAndView modelAndView = new ModelAndView(); 53 | modelAndView.setViewName("absentregister"); 54 | List buildingList = this.buildingService.list(); 55 | modelAndView.addObject("buildingList", buildingList); 56 | List dormitoryList = this.dormitoryService.findByBuildingId(buildingList.get(0).getId()); 57 | modelAndView.addObject("dormitoryList", dormitoryList); 58 | List studentList = this.studentService.findByDormitory(dormitoryList.get(0).getId()); 59 | modelAndView.addObject("studentList", studentList); 60 | return modelAndView; 61 | } 62 | 63 | @PostMapping("/save") 64 | public String save(Absent absent, HttpSession session) { 65 | DormitoryAdmin dormitoryAdmin = (DormitoryAdmin) session.getAttribute("dormitoryAdmin"); 66 | absent.setDormitoryAdminId(dormitoryAdmin.getId()); 67 | this.absentService.save(absent); 68 | return "redirect:/absent/init"; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/controller/AccountController.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.PostMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.servlet.ModelAndView; 9 | import org.zzzzzz.dto.AccountDto; 10 | import org.zzzzzz.form.AccountForm; 11 | import org.zzzzzz.service.AccountService; 12 | 13 | import javax.servlet.http.HttpSession; 14 | 15 | @Controller 16 | @RequestMapping("/account") 17 | public class AccountController { 18 | 19 | @Autowired 20 | private AccountService accountService; 21 | 22 | @PostMapping("/login") 23 | public ModelAndView login(AccountForm accountForm, HttpSession session) { 24 | AccountDto accountDto = accountService.login(accountForm); 25 | ModelAndView modelAndView = new ModelAndView(); 26 | switch (accountDto.getCode()) { 27 | case -1 : 28 | modelAndView.setViewName("login"); 29 | modelAndView.addObject("usernameError", "用户名不存在"); 30 | break; 31 | case -2 : 32 | modelAndView.setViewName("login"); 33 | modelAndView.addObject("passwordError", "密码错误"); 34 | break; 35 | case 0 : 36 | switch (accountForm.getType()) { 37 | case "systemAdmin" : 38 | modelAndView.setViewName("systemadmin"); 39 | session.setAttribute("systemAdmin", accountDto.getAdmin()); 40 | break; 41 | case "dormitoryAdmin" : 42 | modelAndView.setViewName("dormitoryadmin"); 43 | session.setAttribute("dormitoryAdmin", accountDto.getAdmin()); 44 | break; 45 | } 46 | 47 | break; 48 | } 49 | return modelAndView; 50 | } 51 | 52 | @GetMapping("/logout") 53 | public String logout(HttpSession session) { 54 | session.invalidate(); 55 | return "login"; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/controller/BuildingController.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.PostMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.servlet.ModelAndView; 9 | import org.zzzzzz.entity.Building; 10 | import org.zzzzzz.mapper.BuildingMapper; 11 | import org.zzzzzz.service.BuildingService; 12 | import org.zzzzzz.service.DormitoryAdminService; 13 | 14 | @Controller 15 | @RequestMapping("/building") 16 | public class BuildingController { 17 | 18 | @Autowired 19 | private BuildingService buildingService; 20 | 21 | @Autowired 22 | private DormitoryAdminService dormitoryAdminService; 23 | 24 | @GetMapping("/list") 25 | public ModelAndView list() { 26 | ModelAndView modelAndView = new ModelAndView(); 27 | modelAndView.setViewName("buildingmanager"); 28 | modelAndView.addObject("list", buildingService.list()); 29 | modelAndView.addObject("dormitoryAdminList", dormitoryAdminService.list()); 30 | return modelAndView; 31 | } 32 | 33 | @PostMapping("/search") 34 | public ModelAndView serach(String key, String value) { 35 | ModelAndView modelAndView = new ModelAndView(); 36 | modelAndView.setViewName("buildingmanager"); 37 | modelAndView.addObject("list", buildingService.search(key, value)); 38 | modelAndView.addObject("dormitoryAdminList", dormitoryAdminService.list()); 39 | return modelAndView; 40 | } 41 | 42 | @PostMapping("/save") 43 | public String save(Building building) { 44 | this.buildingService.save(building); 45 | return "redirect:/building/list"; 46 | } 47 | 48 | @PostMapping("/update") 49 | public String update(Building building) { 50 | this.buildingService.update(building); 51 | return "redirect:/building/list"; 52 | } 53 | 54 | @PostMapping("/delete") 55 | public String delete(Integer id) { 56 | this.buildingService.delete(id); 57 | return "redirect:/building/list"; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/controller/DormitoryAdminController.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.PostMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.servlet.ModelAndView; 9 | import org.zzzzzz.entity.DormitoryAdmin; 10 | import org.zzzzzz.service.DormitoryAdminService; 11 | 12 | @Controller 13 | @RequestMapping("/dormitoryAdmin") 14 | public class DormitoryAdminController { 15 | 16 | @Autowired 17 | private DormitoryAdminService dormitoryAdminService; 18 | 19 | @GetMapping("/list") 20 | public ModelAndView list() { 21 | ModelAndView modelAndView = new ModelAndView(); 22 | modelAndView.setViewName("adminmanager"); 23 | modelAndView.addObject("list", this.dormitoryAdminService.list()); 24 | return modelAndView; 25 | } 26 | 27 | @PostMapping("/search") 28 | public ModelAndView search(String key, String value) { 29 | ModelAndView modelAndView = new ModelAndView(); 30 | modelAndView.setViewName("adminmanager"); 31 | modelAndView.addObject("list", this.dormitoryAdminService.search(key, value)); 32 | return modelAndView; 33 | } 34 | 35 | @PostMapping("/save") 36 | public String save(DormitoryAdmin dormitoryAdmin) { 37 | this.dormitoryAdminService.save(dormitoryAdmin); 38 | return "redirect:/dormitoryAdmin/list"; 39 | } 40 | 41 | @PostMapping("/delete") 42 | public String delete(Integer id) { 43 | this.dormitoryAdminService.delete(id); 44 | return "redirect:/dormitoryAdmin/list"; 45 | } 46 | @PostMapping("/update") 47 | public String update(DormitoryAdmin dormitoryAdmin) { 48 | this.dormitoryAdminService.update(dormitoryAdmin); 49 | return "redirect:/dormitoryAdmin/list"; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/controller/DormitoryController.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.PostMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.ResponseBody; 9 | import org.springframework.web.servlet.ModelAndView; 10 | import org.zzzzzz.entity.Dormitory; 11 | import org.zzzzzz.entity.Student; 12 | import org.zzzzzz.service.BuildingService; 13 | import org.zzzzzz.service.DormitoryService; 14 | import org.zzzzzz.service.StudentService; 15 | 16 | import java.util.ArrayList; 17 | import java.util.List; 18 | 19 | @Controller 20 | @RequestMapping("/dormitory") 21 | public class DormitoryController { 22 | 23 | @Autowired 24 | private DormitoryService dormitoryService; 25 | 26 | @Autowired 27 | private BuildingService buildingService; 28 | 29 | @Autowired 30 | private StudentService studentService; 31 | 32 | @GetMapping("/list") 33 | public ModelAndView list() { 34 | ModelAndView modelAndView = new ModelAndView(); 35 | modelAndView.setViewName("dormitorymanager"); 36 | modelAndView.addObject("list", this.dormitoryService.list()); 37 | modelAndView.addObject("buildingList", this.buildingService.list()); 38 | return modelAndView; 39 | } 40 | 41 | @PostMapping("/search") 42 | public ModelAndView search(String key, String value) { 43 | ModelAndView modelAndView = new ModelAndView(); 44 | modelAndView.setViewName("dormitorymanager"); 45 | modelAndView.addObject("list", this.dormitoryService.search(key, value)); 46 | modelAndView.addObject("buildingList", this.buildingService.list()); 47 | return modelAndView; 48 | } 49 | 50 | @PostMapping("/save") 51 | public String save(Dormitory dormitory) { 52 | this.dormitoryService.save(dormitory); 53 | return "redirect:/dormitory/list"; 54 | } 55 | 56 | @PostMapping("/update") 57 | public String update(Dormitory dormitory) { 58 | this.dormitoryService.update(dormitory); 59 | return "redirect:/dormitory/list"; 60 | } 61 | 62 | @PostMapping("/delete") 63 | public String delete(Integer id) { 64 | this.dormitoryService.delete(id); 65 | return "redirect:/dormitory/list"; 66 | } 67 | 68 | @PostMapping("/findByBuildingId") 69 | @ResponseBody 70 | public List findByBuildingId(Integer buildingId) { 71 | List dormitoryList = this.dormitoryService.findByBuildingId(buildingId);// json数据需要添加依赖 72 | List list = new ArrayList(); 73 | if(dormitoryList.size() > 0) { 74 | List studentList = studentService.findByDormitory(dormitoryList.get(0).getId()); 75 | list.add(dormitoryList); 76 | if(studentList.size() > 0) { 77 | list.add(studentList); 78 | } else { 79 | list.add(new ArrayList<>()); 80 | } 81 | } else { 82 | list.add(new ArrayList<>()); 83 | list.add(new ArrayList<>()); 84 | } 85 | return list; 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/controller/MoveoutController.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.PostMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.servlet.ModelAndView; 9 | import org.zzzzzz.entity.Moveout; 10 | import org.zzzzzz.service.MoveoutService; 11 | import org.zzzzzz.service.StudentService; 12 | 13 | @Controller 14 | @RequestMapping("/moveout") 15 | public class MoveoutController { 16 | 17 | @Autowired 18 | private StudentService studentService; 19 | 20 | @Autowired 21 | private MoveoutService moveoutService; 22 | 23 | @GetMapping("/list") 24 | public ModelAndView list() { 25 | ModelAndView modelAndView = new ModelAndView(); 26 | modelAndView.setViewName("moveoutregister"); 27 | modelAndView.addObject("list", this.studentService.moveoutList()); 28 | return modelAndView; 29 | } 30 | 31 | @PostMapping("/search") 32 | public ModelAndView search(String key, String value) { 33 | ModelAndView modelAndView = new ModelAndView(); 34 | modelAndView.setViewName("moveoutregister"); 35 | modelAndView.addObject("list", this.studentService.searchForMoveoutList(key, value)); 36 | return modelAndView; 37 | } 38 | 39 | @PostMapping("/register") 40 | public String register(Moveout moveout) { 41 | this.studentService.moveout(moveout); 42 | return "redirect:/moveout/list"; 43 | } 44 | 45 | @GetMapping("/record") 46 | public ModelAndView recored() { 47 | ModelAndView modelAndView = new ModelAndView(); 48 | modelAndView.setViewName("moveoutrecord"); 49 | modelAndView.addObject("list", this.moveoutService.list()); 50 | return modelAndView; 51 | } 52 | 53 | @PostMapping("/recordSearch") 54 | public ModelAndView recoredSearch(String key, String value) { 55 | ModelAndView modelAndView = new ModelAndView(); 56 | modelAndView.setViewName("moveoutrecord"); 57 | modelAndView.addObject("list", this.moveoutService.search(key, value)); 58 | return modelAndView; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/controller/StudentController.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.PostMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.ResponseBody; 9 | import org.springframework.web.servlet.ModelAndView; 10 | import org.zzzzzz.entity.Student; 11 | import org.zzzzzz.service.DormitoryService; 12 | import org.zzzzzz.service.StudentService; 13 | 14 | import javax.jws.WebParam; 15 | import java.util.List; 16 | 17 | @Controller 18 | @RequestMapping("/student") 19 | public class StudentController { 20 | 21 | @Autowired 22 | private StudentService studentService; 23 | 24 | @Autowired 25 | private DormitoryService dormitoryService; 26 | 27 | @GetMapping("/list") 28 | public ModelAndView list() { 29 | ModelAndView modelAndView = new ModelAndView(); 30 | modelAndView.setViewName("studentmanager"); 31 | modelAndView.addObject("list", this.studentService.list()); 32 | modelAndView.addObject("dormitoryList", this.dormitoryService.availableList()); 33 | return modelAndView; 34 | } 35 | 36 | @PostMapping("/search") 37 | public ModelAndView search(String key, String value) { 38 | ModelAndView modelAndView = new ModelAndView(); 39 | modelAndView.setViewName("studentmanager"); 40 | modelAndView.addObject("list", this.studentService.search(key, value)); 41 | modelAndView.addObject("dormitoryList", this.dormitoryService.availableList()); 42 | return modelAndView; 43 | } 44 | 45 | @PostMapping("/save") 46 | public String save(Student student) { 47 | this.studentService.save(student); 48 | return "redirect:/student/list"; 49 | } 50 | 51 | @PostMapping("/update") 52 | public String update(Student student) { 53 | this.studentService.update(student); 54 | return "redirect:/student/list"; 55 | } 56 | 57 | 58 | @PostMapping("/delete") 59 | public String delete(Student student) { 60 | this.studentService.delete(student); 61 | return "redirect:/student/list"; 62 | } 63 | 64 | @PostMapping("/findByDormitoryId") 65 | @ResponseBody // JSON格式的数据 66 | public List findByDormitoryId(Integer dormitoryId) { 67 | return studentService.findByDormitory(dormitoryId); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/dto/AccountDto.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.dto; 2 | 3 | import lombok.Data; 4 | 5 | // 登录后 返回的结果集 6 | @Data 7 | public class AccountDto { 8 | 9 | /* 10 | -2 : 密码错误 11 | -1 : 用户名不存在 12 | 0 : 登录成功 13 | */ 14 | private Integer code; // 此次登录的状态码 15 | private T admin; // 此次登录的管理员的类型 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/entity/Absent.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.entity; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class Absent { 7 | 8 | private Integer id; 9 | private Integer buildingId; 10 | private String buildingName; 11 | private Integer dormitoryId; 12 | private String dormitoryName; 13 | private Integer studentId; 14 | private String studentName; 15 | private Integer dormitoryAdminId; 16 | private String dormitoryAdminName; 17 | private String createDate; 18 | private String reason; 19 | 20 | } 21 | 22 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/entity/Building.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.entity; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class Building { 7 | private Integer id; 8 | private String name; 9 | private String introduction; 10 | private Integer adminId; 11 | private String adminName; 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/entity/Dormitory.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.entity; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class Dormitory { 7 | private Integer id; 8 | private Integer buildingId; 9 | private String buildingName; 10 | private String name; 11 | private Integer type; 12 | private Integer available; 13 | private String telephone; 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/entity/DormitoryAdmin.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.entity; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class DormitoryAdmin { 7 | private Integer id; 8 | private String username; 9 | private String password; 10 | private String name; 11 | private String gender; 12 | private String telephone; 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/entity/Moveout.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.entity; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class Moveout { 7 | private Integer id; 8 | private Integer studentId; 9 | private String studentName; 10 | private Integer dormitoryId; 11 | private String dormitoryName; 12 | private String reason; 13 | private String createDate; 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/entity/Student.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.entity; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class Student { 7 | private Integer id; 8 | private String number; 9 | private String name; 10 | private String gender; 11 | private Integer dormitoryId; 12 | private Integer oldDormitoryId; 13 | private String dormitoryName; 14 | private String state; 15 | private String createDate; 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/entity/SystemAdmin.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.entity; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class SystemAdmin { 7 | 8 | private Integer id; 9 | private String username; 10 | private String password; 11 | private String name; 12 | private String telephone; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/form/AccountForm.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.form; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class AccountForm { 7 | private String username; 8 | private String password; 9 | private String type; 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/mapper/AbsentMapper.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.mapper; 2 | 3 | import org.zzzzzz.entity.Absent; 4 | 5 | import java.util.List; 6 | 7 | public interface AbsentMapper { 8 | 9 | public List list(); 10 | public List searchByBuildingName(String value); 11 | public List searchByDormitoryName(String value); 12 | 13 | public void save(Absent absent); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/mapper/BuildingMapper.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.mapper; 2 | 3 | import org.zzzzzz.entity.Building; 4 | 5 | import java.util.List; 6 | 7 | public interface BuildingMapper { 8 | public List list(); 9 | 10 | public List searchByName(String name); 11 | public List searchByIntrodution(String introduction); 12 | 13 | public void save(Building building); 14 | public void update(Building building); 15 | public void delete(Integer id); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/mapper/DormitoryAdminMapper.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.mapper; 2 | 3 | import org.zzzzzz.entity.DormitoryAdmin; 4 | import org.zzzzzz.service.DormitoryAdminService; 5 | 6 | import java.util.List; 7 | 8 | public interface DormitoryAdminMapper { 9 | 10 | public List list(); 11 | public List searchByUsername(String username); 12 | public List searchByName(String name); 13 | public List searchByTelephone(String telephone); 14 | public void save(DormitoryAdmin dormitoryAdmin); 15 | public void delete(Integer id); 16 | public void update(DormitoryAdmin dormitoryAdmin); 17 | public DormitoryAdmin findByUserName(String username); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/mapper/DormitoryMapper.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.mapper; 2 | 3 | import org.zzzzzz.entity.Dormitory; 4 | 5 | import java.util.List; 6 | 7 | public interface DormitoryMapper { 8 | public List availableList(); 9 | 10 | public void subAvailable(Integer id); 11 | public void addAvailable(Integer id); 12 | 13 | public List findDormitoryIdByBuildingId(Integer buildingId); 14 | 15 | public Integer findAvailableDormitoryId(); 16 | 17 | public void delete(Integer id); 18 | 19 | public void setAvailableToZero(Integer id); 20 | 21 | public List list(); 22 | 23 | public List searchByName(String name); 24 | 25 | public List searchByTelephone(String telephone); 26 | 27 | public void save(Dormitory dormitory); 28 | 29 | public void update(Dormitory dormitory); 30 | 31 | public List findByBuildingId(Integer buildingId); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/mapper/MoveoutMapper.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.mapper; 2 | 3 | import org.zzzzzz.entity.Moveout; 4 | 5 | import java.util.List; 6 | 7 | public interface MoveoutMapper { 8 | public List list(); 9 | public List searchByStudentName(String value); 10 | public List searchByDormitoryName(String value); 11 | 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/mapper/StudentMapper.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.mapper; 2 | 3 | import lombok.experimental.PackagePrivate; 4 | import org.apache.ibatis.annotations.Param; 5 | import org.zzzzzz.entity.Moveout; 6 | import org.zzzzzz.entity.Student; 7 | 8 | import java.util.List; 9 | 10 | public interface StudentMapper { 11 | public List list(); 12 | 13 | public List searchByNumber(String number); 14 | 15 | public List searchByName(String name); 16 | 17 | public void save(Student student); 18 | 19 | public void update(Student student); 20 | 21 | public void delete(Student student); 22 | 23 | public List findStudentIdByDormitoryId(Integer dormitoryId); 24 | 25 | public void resetDormitoryId(@Param("id") Integer studentId, @Param("dormitory_id") Integer dormitoryId); 26 | 27 | public List moveoutList(); 28 | 29 | public List searchForMoveoutByName(String name); 30 | public List searchForMoveoutByNumber(String number); 31 | 32 | public void updateStateById(Integer id); 33 | 34 | public void moveout(Moveout moveout); 35 | 36 | public List findByDormitoryId(Integer dormitoryId); 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/mapper/SystemAdminMapper.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.mapper; 2 | 3 | import org.zzzzzz.entity.SystemAdmin; 4 | 5 | public interface SystemAdminMapper { 6 | 7 | public SystemAdmin findByUsername(String username); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/service/AbsentService.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.service; 2 | 3 | import org.zzzzzz.entity.Absent; 4 | 5 | import javax.servlet.http.HttpSession; 6 | import java.util.List; 7 | 8 | public interface AbsentService { 9 | 10 | public List list(); 11 | public List search(String key, String value); 12 | 13 | public void save(Absent absent); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/service/AccountService.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.service; 2 | 3 | import org.springframework.stereotype.Service; 4 | import org.zzzzzz.dto.AccountDto; 5 | import org.zzzzzz.form.AccountForm; 6 | 7 | @Service 8 | public interface AccountService { 9 | 10 | public AccountDto login(AccountForm accountForm); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/service/BuildingService.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.service; 2 | 3 | import org.springframework.stereotype.Service; 4 | import org.zzzzzz.entity.Building; 5 | 6 | import java.util.List; 7 | 8 | @Service 9 | public interface BuildingService { 10 | public List list(); 11 | 12 | public List search(String key, String value); 13 | 14 | public void save(Building building); 15 | 16 | public void update(Building building); 17 | 18 | public void delete(Integer id); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/service/DormitoryAdminService.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.service; 2 | 3 | import org.springframework.stereotype.Service; 4 | import org.zzzzzz.entity.DormitoryAdmin; 5 | 6 | import java.util.List; 7 | 8 | @Service 9 | public interface DormitoryAdminService { 10 | 11 | public List list(); 12 | 13 | public List search(String key, String value); 14 | 15 | public void save(DormitoryAdmin dormitoryAdmin); 16 | 17 | public void delete(Integer id); 18 | 19 | public void update(DormitoryAdmin dormitoryAdmin); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/service/DormitoryService.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.service; 2 | 3 | import org.springframework.stereotype.Service; 4 | import org.zzzzzz.entity.Dormitory; 5 | 6 | import java.util.List; 7 | 8 | @Service 9 | public interface DormitoryService { 10 | public List availableList(); 11 | public List list(); 12 | 13 | public List search(String key, String value); 14 | 15 | public void save(Dormitory dormitory); 16 | 17 | public void update(Dormitory dormitory); 18 | 19 | public void delete(Integer id); 20 | 21 | public List findByBuildingId(Integer buildingId); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/service/MoveoutService.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.service; 2 | 3 | import org.springframework.stereotype.Service; 4 | import org.zzzzzz.entity.Moveout; 5 | 6 | import java.util.List; 7 | 8 | @Service 9 | public interface MoveoutService { 10 | public List list(); 11 | public List search(String key, String value); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/service/StudentService.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.service; 2 | 3 | import org.springframework.stereotype.Service; 4 | import org.zzzzzz.entity.Moveout; 5 | import org.zzzzzz.entity.Student; 6 | 7 | import java.util.List; 8 | 9 | @Service 10 | public interface StudentService { 11 | public List list(); 12 | 13 | public List search(String key, String value); 14 | 15 | public void save(Student student); 16 | 17 | public void update(Student student); 18 | 19 | public void delete(Student student); 20 | 21 | public List moveoutList(); 22 | 23 | public List searchForMoveoutList(String key, String value); 24 | 25 | public void moveout(Moveout moveout); 26 | 27 | public List findByDormitory(Integer dormitoryId); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/service/impl/AbsentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.service.impl; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import org.zzzzzz.entity.Absent; 6 | import org.zzzzzz.entity.DormitoryAdmin; 7 | import org.zzzzzz.mapper.AbsentMapper; 8 | import org.zzzzzz.service.AbsentService; 9 | 10 | import javax.servlet.http.HttpSession; 11 | import java.util.List; 12 | 13 | @Service 14 | public class AbsentServiceImpl implements AbsentService { 15 | 16 | @Autowired 17 | private AbsentMapper absentMapper; 18 | 19 | @Override 20 | public List list() { 21 | return absentMapper.list(); 22 | } 23 | 24 | @Override 25 | public List search(String key, String value) { 26 | if(value.equals("")) return absentMapper.list(); 27 | List list = null; 28 | switch (key) { 29 | case "buildingName" : 30 | list = this.absentMapper.searchByBuildingName(value); 31 | break; 32 | case "dormitoryName" : 33 | list = this.absentMapper.searchByDormitoryName(value); 34 | break; 35 | } 36 | return list; 37 | } 38 | 39 | @Override 40 | public void save(Absent absent) { 41 | try { 42 | this.absentMapper.save(absent); 43 | } catch (Exception e) { 44 | throw new RuntimeException(e); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/service/impl/AccountServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.service.impl; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import org.springframework.web.bind.annotation.PathVariable; 6 | import org.zzzzzz.dto.AccountDto; 7 | import org.zzzzzz.entity.DormitoryAdmin; 8 | import org.zzzzzz.entity.SystemAdmin; 9 | import org.zzzzzz.form.AccountForm; 10 | import org.zzzzzz.mapper.DormitoryAdminMapper; 11 | import org.zzzzzz.mapper.DormitoryMapper; 12 | import org.zzzzzz.mapper.SystemAdminMapper; 13 | import org.zzzzzz.service.AccountService; 14 | 15 | @Service 16 | public class AccountServiceImpl implements AccountService { 17 | 18 | @Autowired 19 | private SystemAdminMapper systemAdminMapper; 20 | 21 | @Autowired 22 | private DormitoryAdminMapper dormitoryAdminMapper; 23 | 24 | @Override 25 | public AccountDto login(AccountForm accountForm) { 26 | AccountDto dto = new AccountDto(); // 定义返回集 27 | 28 | switch (accountForm.getType()) { 29 | case "systemAdmin" : 30 | SystemAdmin systemAdmin = this.systemAdminMapper.findByUsername(accountForm.getUsername()); 31 | 32 | if (systemAdmin == null) { 33 | dto.setCode(-1); // 设置 用户名错误 状态码 34 | } else if(!systemAdmin.getPassword().equals(accountForm.getPassword())) { 35 | dto.setCode(-2); // 设置 密码错误 状态码 36 | } else if (systemAdmin.getPassword().equals(accountForm.getPassword())){ 37 | dto.setCode(0); // 设置 登录成功 状态码 38 | dto.setAdmin(systemAdmin); // 设置 管理员 信息 39 | } 40 | break; 41 | case "dormitoryAdmin" : 42 | DormitoryAdmin dormitoryAdmin = this.dormitoryAdminMapper.findByUserName(accountForm.getUsername()); 43 | if(dormitoryAdmin == null) { 44 | dto.setCode(-1); 45 | } else { 46 | if(!dormitoryAdmin.getPassword().equals(accountForm.getPassword())) { 47 | dto.setCode(-2); 48 | } else { 49 | dto.setCode(0); 50 | dto.setAdmin(dormitoryAdmin); 51 | } 52 | } 53 | break; 54 | } 55 | return dto; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/service/impl/BuildingServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.service.impl; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import org.zzzzzz.entity.Building; 6 | import org.zzzzzz.mapper.BuildingMapper; 7 | import org.zzzzzz.mapper.DormitoryMapper; 8 | import org.zzzzzz.mapper.StudentMapper; 9 | import org.zzzzzz.service.BuildingService; 10 | 11 | import java.util.List; 12 | 13 | @Service 14 | public class BuildingServiceImpl implements BuildingService { 15 | 16 | @Autowired 17 | private BuildingMapper buildingMapper; 18 | 19 | @Autowired 20 | private DormitoryMapper dormitoryMapper; 21 | 22 | @Autowired 23 | private StudentMapper studentMapper; 24 | 25 | @Override 26 | public List list() { 27 | return buildingMapper.list(); 28 | } 29 | 30 | @Override 31 | public List search(String key, String value) { 32 | List list = null; 33 | if(value.equals("")) list = buildingMapper.list(); 34 | switch (key) { 35 | case "name" : 36 | list = buildingMapper.searchByName(value); 37 | break; 38 | case "introduction" : 39 | list = buildingMapper.searchByIntrodution(value); 40 | break; 41 | } 42 | return list; 43 | } 44 | 45 | @Override 46 | public void save(Building building) { 47 | try { 48 | this.buildingMapper.save(building); 49 | } catch (Exception e) { 50 | throw new RuntimeException(e); 51 | } 52 | } 53 | 54 | @Override 55 | public void update(Building building) { 56 | try { 57 | this.buildingMapper.update(building); 58 | } catch (Exception e) { 59 | throw new RuntimeException(e); 60 | } 61 | } 62 | 63 | @Override 64 | public void delete(Integer id) { 65 | try { 66 | // 查询被删除的楼中的寝室编号集合 67 | List dormitoryIdList = this.dormitoryMapper.findDormitoryIdByBuildingId(id); 68 | for (Integer dormitoryId : dormitoryIdList) { // 枚举每个将被删除的宿舍编号 69 | // 设置当前待删除宿舍的可用床位为零 70 | this.dormitoryMapper.setAvailableToZero(dormitoryId); 71 | // 寻找该宿舍中所住的学生编号集合 72 | List studentIdList = this.studentMapper.findStudentIdByDormitoryId(dormitoryId); 73 | for (Integer studentId : studentIdList) { // 枚举每个待分配的学生编号 74 | // 寻找可用宿舍编号 75 | Integer availableDormitoryId = this.dormitoryMapper.findAvailableDormitoryId(); 76 | if (availableDormitoryId != null) { // 可用宿舍存在时,进行分配 77 | this.studentMapper.resetDormitoryId(studentId, availableDormitoryId); 78 | this.dormitoryMapper.subAvailable(availableDormitoryId); 79 | } 80 | } 81 | // 根据宿舍编号删除宿舍 82 | this.dormitoryMapper.delete(dormitoryId); 83 | } 84 | this.buildingMapper.delete(id); 85 | } catch (Exception e) { 86 | throw new RuntimeException(e); 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/service/impl/DormitoryAdminServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.service.impl; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import org.springframework.transaction.annotation.Transactional; 6 | import org.zzzzzz.entity.DormitoryAdmin; 7 | import org.zzzzzz.mapper.DormitoryAdminMapper; 8 | import org.zzzzzz.service.DormitoryAdminService; 9 | 10 | import java.util.List; 11 | 12 | @Service 13 | public class DormitoryAdminServiceImpl implements DormitoryAdminService { 14 | 15 | @Autowired 16 | private DormitoryAdminMapper dormitoryAdminMapper; 17 | 18 | @Override 19 | public List list() { 20 | return this.dormitoryAdminMapper.list(); 21 | } 22 | 23 | @Override 24 | public List search(String key, String value) { 25 | if(value.equals("")) return list(); 26 | 27 | List list = null; 28 | 29 | switch (key) { 30 | case "username" : 31 | list = dormitoryAdminMapper.searchByUsername(value); 32 | break; 33 | case "name" : 34 | list = dormitoryAdminMapper.searchByName(value); 35 | break; 36 | case "telephone" : 37 | list = dormitoryAdminMapper.searchByTelephone(value); 38 | break; 39 | } 40 | 41 | return list; 42 | } 43 | 44 | @Override 45 | public void save(DormitoryAdmin dormitoryAdmin) { 46 | try { 47 | this.dormitoryAdminMapper.save(dormitoryAdmin); 48 | } catch (Exception e) { 49 | throw new RuntimeException(e); 50 | } 51 | } 52 | 53 | @Override 54 | public void delete(Integer id) { 55 | try { 56 | this.dormitoryAdminMapper.delete(id); 57 | } catch (Exception e) { 58 | throw new RuntimeException(e); 59 | } 60 | } 61 | 62 | @Override 63 | public void update(DormitoryAdmin dormitoryAdmin) { 64 | try { 65 | this.dormitoryAdminMapper.update(dormitoryAdmin); 66 | } catch (Exception e) { 67 | throw new RuntimeException(e); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/service/impl/DormitoryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.service.impl; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import org.zzzzzz.entity.Dormitory; 6 | import org.zzzzzz.mapper.DormitoryMapper; 7 | import org.zzzzzz.mapper.StudentMapper; 8 | import org.zzzzzz.service.DormitoryService; 9 | 10 | import java.util.List; 11 | 12 | @Service 13 | public class DormitoryServiceImpl implements DormitoryService { 14 | 15 | @Autowired 16 | private DormitoryMapper dormitoryMapper; 17 | 18 | @Autowired 19 | private StudentMapper studentMapper; 20 | 21 | @Override 22 | public List availableList() { 23 | return this.dormitoryMapper.availableList(); 24 | } 25 | 26 | @Override 27 | public List list() { 28 | return this.dormitoryMapper.list(); 29 | } 30 | 31 | @Override 32 | public List search(String key, String value) { 33 | List list = null; 34 | if(value.equals("")) { 35 | list = this.dormitoryMapper.list(); 36 | } else { 37 | switch (key) { 38 | case "name" : 39 | list = this.dormitoryMapper.searchByName(value); 40 | break; 41 | case "telephone" : 42 | list = this.dormitoryMapper.searchByTelephone(value); 43 | break; 44 | } 45 | } 46 | return list; 47 | } 48 | 49 | @Override 50 | public void save(Dormitory dormitory) { 51 | try { 52 | this.dormitoryMapper.save(dormitory); 53 | } catch (Exception e) { 54 | throw new RuntimeException(e); 55 | } 56 | } 57 | 58 | @Override 59 | public void update(Dormitory dormitory) { 60 | try { 61 | this.dormitoryMapper.update(dormitory); 62 | } catch (Exception e) { 63 | throw new RuntimeException(e); 64 | } 65 | } 66 | 67 | @Override 68 | public void delete(Integer dormitoryId) { 69 | // 设置当前待删除宿舍的可用床位为零 70 | this.dormitoryMapper.setAvailableToZero(dormitoryId); 71 | // 寻找该宿舍中所住的学生编号集合 72 | List studentIdList = this.studentMapper.findStudentIdByDormitoryId(dormitoryId); 73 | for (Integer studentId : studentIdList) { // 枚举每个待分配的学生编号 74 | // 寻找可用宿舍编号 75 | Integer availableDormitoryId = this.dormitoryMapper.findAvailableDormitoryId(); 76 | if (availableDormitoryId != null) { // 可用宿舍存在时,进行分配 77 | this.studentMapper.resetDormitoryId(studentId, availableDormitoryId); 78 | this.dormitoryMapper.subAvailable(availableDormitoryId); 79 | } 80 | } 81 | // 根据宿舍编号删除宿舍 82 | this.dormitoryMapper.delete(dormitoryId); 83 | } 84 | 85 | @Override 86 | public List findByBuildingId(Integer buildingId) { 87 | return this.dormitoryMapper.findByBuildingId(buildingId); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/service/impl/MoveoutServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.service.impl; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import org.zzzzzz.entity.Moveout; 6 | import org.zzzzzz.mapper.MoveoutMapper; 7 | import org.zzzzzz.service.MoveoutService; 8 | 9 | import java.util.List; 10 | 11 | @Service 12 | public class MoveoutServiceImpl implements MoveoutService { 13 | 14 | @Autowired 15 | private MoveoutMapper moveoutMapper; 16 | 17 | @Override 18 | public List list() { 19 | return this.moveoutMapper.list(); 20 | } 21 | 22 | @Override 23 | public List search(String key, String value) { 24 | if(value.equals("")) return list(); 25 | List list = null; 26 | switch (key) { 27 | case "studentName" : 28 | list = moveoutMapper.searchByStudentName(value); 29 | break; 30 | case "dormitoryName" : 31 | list = moveoutMapper.searchByDormitoryName(value); 32 | break; 33 | } 34 | return list; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/zzzzzz/service/impl/StudentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.zzzzzz.service.impl; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import org.zzzzzz.entity.Moveout; 6 | import org.zzzzzz.entity.Student; 7 | import org.zzzzzz.mapper.DormitoryMapper; 8 | import org.zzzzzz.mapper.StudentMapper; 9 | import org.zzzzzz.service.StudentService; 10 | 11 | import java.text.SimpleDateFormat; 12 | import java.util.Date; 13 | import java.util.List; 14 | 15 | @Service 16 | public class StudentServiceImpl implements StudentService { 17 | 18 | @Autowired 19 | private StudentMapper studentMapper; 20 | 21 | @Autowired 22 | private DormitoryMapper dormitoryMapper; 23 | 24 | @Override 25 | public List list() { 26 | return this.studentMapper.list(); 27 | } 28 | 29 | public List search(String key, String value) { 30 | if(value.equals("")) return studentMapper.list(); 31 | List list = null; 32 | switch (key) { 33 | case "number" : 34 | list = this.studentMapper.searchByNumber(value); 35 | break; 36 | case "name" : 37 | list = this.studentMapper.searchByName(value); 38 | break; 39 | } 40 | return list; 41 | } 42 | 43 | @Override 44 | public void save(Student student) { 45 | // 添加系统时间作为入住时间 46 | Date data = new Date(); 47 | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); // 日期格式转换 48 | student.setCreateDate(dateFormat.format(data)); 49 | try { 50 | this.studentMapper.save(student); 51 | dormitoryMapper.subAvailable(student.getDormitoryId()); 52 | } catch (Exception e) { 53 | throw new RuntimeException(e); 54 | } 55 | } 56 | 57 | @Override 58 | public void update(Student student) { 59 | try { 60 | this.studentMapper.update(student); 61 | if(!student.getDormitoryId().equals(student.getOldDormitoryId())) { 62 | this.dormitoryMapper.subAvailable(student.getDormitoryId()); 63 | this.dormitoryMapper.addAvailable(student.getOldDormitoryId()); 64 | } 65 | } catch (Exception e) { 66 | throw new RuntimeException(e); 67 | } 68 | } 69 | 70 | @Override 71 | public void delete(Student student) { 72 | try { 73 | this.studentMapper.delete(student); 74 | this.dormitoryMapper.addAvailable(student.getDormitoryId()); 75 | } catch (Exception e) { 76 | throw new RuntimeException(e); 77 | } 78 | } 79 | 80 | @Override 81 | public List moveoutList() { 82 | return this.studentMapper.moveoutList(); 83 | } 84 | 85 | @Override 86 | public List searchForMoveoutList(String key, String value) { 87 | if(value.equals("")) return this.studentMapper.list(); 88 | List list = null; 89 | switch (key) { 90 | case "number" : 91 | list = studentMapper.searchForMoveoutByNumber(value); 92 | break; 93 | case "name" : 94 | list = studentMapper.searchForMoveoutByName(value); 95 | break; 96 | } 97 | return list; 98 | } 99 | 100 | @Override 101 | public void moveout(Moveout moveout) { 102 | try { 103 | this.dormitoryMapper.addAvailable(moveout.getDormitoryId()); 104 | this.studentMapper.updateStateById(moveout.getStudentId()); 105 | Date date = new Date(); 106 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); 107 | moveout.setCreateDate(format.format(date)); 108 | this.studentMapper.moveout(moveout); 109 | } catch (Exception e) { 110 | throw new RuntimeException(e); 111 | } 112 | } 113 | 114 | @Override 115 | public List findByDormitory(Integer dormitoryId) { 116 | return studentMapper.findByDormitoryId(dormitoryId); 117 | } 118 | } -------------------------------------------------------------------------------- /src/main/resources/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/main/resources/datasource.properties: -------------------------------------------------------------------------------- 1 | driverName=com.mysql.cj.jdbc.Driver 2 | url=jdbc:mysql://localhost:3306/dormitory?serverTimezone=UTC 3 | user=root 4 | password=zhangyu -------------------------------------------------------------------------------- /src/main/resources/org/zzzzzz/mapper/AbsentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 12 | 13 | 16 | 17 | 18 | insert into absent(building_id,dormitory_id,student_id,dormitory_admin_id,create_date,reason) values(#{buildingId},#{dormitoryId},#{studentId},#{dormitoryAdminId},#{createDate},#{reason}) 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/main/resources/org/zzzzzz/mapper/BuildingMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | insert into building(name, introduction, admin_id) values(#{name}, 7 | #{introduction}, #{adminId}) 8 | 9 | 10 | 11 | update building set name = #{name}, introduction = #{introduction}, admin_id = #{adminId} 12 | where id = #{id} 13 | 14 | 15 | 16 | delete from building where id = #{id} 17 | 18 | 19 | 23 | 24 | 29 | 30 | 35 | -------------------------------------------------------------------------------- /src/main/resources/org/zzzzzz/mapper/DormitoryAdminMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | insert into dormitory_admin values(null, #{username}, 6 | #{password}, #{name}, #{gender}, #{telephone}) 7 | 8 | 9 | 10 | update dormitory_admin set username = #{username}, password = #{password}, 11 | name = #{name}, gender = #{gender}, telephone = #{telephone} 12 | where id = #{id} 13 | 14 | 15 | 16 | delete from dormitory_admin where id = #{id} 17 | 18 | 19 | 22 | 23 | 26 | 27 | 30 | 31 | 34 | 35 | 38 | -------------------------------------------------------------------------------- /src/main/resources/org/zzzzzz/mapper/DormitoryMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | update dormitory set available = available + 1 where id = #{id} 6 | 7 | 8 | 9 | update dormitory set available = available - 1 where id = #{id} 10 | 11 | 12 | 13 | update dormitory set available = 0 where id = #{id} 14 | 15 | 16 | 17 | update dormitory set name = #{name}, telephone = #{telephone} where id = #{id} 18 | 19 | 20 | 21 | insert into dormitory(building_id, name, type, available, telephone) 22 | values(#{buildingId}, #{name}, #{type}, #{type}, #{telephone}) 23 | 24 | 25 | 26 | delete from dormitory where id = #{id} 27 | 28 | 29 | 32 | 33 | 36 | 37 | 42 | 43 | 47 | 48 | 53 | 54 | 59 | 60 | 63 | -------------------------------------------------------------------------------- /src/main/resources/org/zzzzzz/mapper/MoveoutMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | 16 | 17 | 22 | 23 | -------------------------------------------------------------------------------- /src/main/resources/org/zzzzzz/mapper/StudentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | insert into student(number, name, gender, dormitory_id, state, create_date) 7 | values(#{number}, #{name}, #{gender}, #{dormitoryId}, '入住', #{createDate}) 8 | 9 | 10 | 11 | insert into moveout(student_id,dormitory_id,reason,create_date) 12 | values(#{studentId},#{dormitoryId},#{reason},#{createDate}) 13 | 14 | 15 | 16 | update student set number = #{number}, name = #{name}, gender = #{gender}, 17 | dormitory_id = #{dormitoryId} where id = #{id} 18 | 19 | 20 | 21 | update student set dormitory_id = #{dormitory_id} where id = #{id} 22 | 23 | 24 | 25 | update student set state = '迁出' where id = #{id} 26 | 27 | 28 | 33 | 34 | 35 | delete from student set dormitory_id = #{dormitoryId} where id = #{studentId} 36 | 37 | 38 | 43 | 44 | 49 | 50 | 55 | 56 | 59 | 60 | 65 | 66 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /src/main/resources/org/zzzzzz/mapper/SystemAdminMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | -------------------------------------------------------------------------------- /src/main/resources/spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/main/resources/springmvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | Archetype Created Web Application 7 | 8 | 9 | 10 | contextConfigLocation 11 | classpath:spring.xml 12 | 13 | 14 | org.springframework.web.context.ContextLoaderListener 15 | 16 | 17 | 18 | 19 | springmvc 20 | org.springframework.web.servlet.DispatcherServlet 21 | 22 | contextConfigLocation 23 | classpath:springmvc.xml 24 | 25 | 26 | 27 | 28 | springmvc 29 | / 30 | 31 | 32 | 33 | 34 | CharacterEncodingFilter 35 | org.springframework.web.filter.CharacterEncodingFilter 36 | 37 | encoding 38 | utf-8 39 | 40 | 41 | forceRequestEncoding 42 | true 43 | 44 | 45 | forceResponseEncoding 46 | true 47 | 48 | 49 | 50 | CharacterEncodingFilter 51 | /* 52 | 53 | 54 | 55 | 56 | default 57 | *.css 58 | *.js 59 | *.jpg 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /src/main/webapp/absentrecord.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | <%@ page isELIgnored="false" %> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 宿舍管理系统 15 | 16 | 17 |
18 |
19 |
20 | 21 |
22 |
搜索
23 |
24 |
25 |
26 | 27 | 31 |
32 |
33 | 34 | 35 |
36 |
37 | 42 |
43 |
44 |
45 |
46 | 47 |
48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 |
ID楼宇宿舍姓名原因宿管日期
${absent.id}${absent.buildingName}${absent.dormitoryName}${absent.studentName}${absent.reason}${absent.dormitoryAdminName}${absent.createDate}
74 |
75 |
76 |
77 |
78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /src/main/webapp/absentregister.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | <%@ page isELIgnored="false" %> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 宿舍管理系统 19 | 20 | 21 |
22 |
24 |
25 | 91 |
92 | 93 |
94 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /src/main/webapp/adminmanager.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | <%@ page isELIgnored="false" %> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 宿舍管理系统 15 | 16 | 17 |
18 |
19 |
20 | 21 |
22 |
搜索
23 |
24 |
25 |
26 | 27 | 32 |
33 |
34 | 35 | 36 |
37 |
38 | 43 |
44 |
45 | 51 |
52 |
53 |
54 |
55 | 56 |
57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 99 | 100 | 101 | 102 |
ID用户名密码姓名性别联系电话操作
${dormitoryAdmin.id}${dormitoryAdmin.username}${dormitoryAdmin.password}${dormitoryAdmin.name}${dormitoryAdmin.gender}${dormitoryAdmin.telephone} 79 |
80 | 91 | 92 | 97 |
98 |
103 | 104 |
106 |
167 | 168 | 169 | 170 |
172 |
240 | 241 | 242 | 243 |
246 |
276 | 277 |
278 |
279 |
280 |
281 | 282 | 317 | 318 | 319 | 320 | -------------------------------------------------------------------------------- /src/main/webapp/buildingmanager.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | <%@ page isELIgnored="false" %> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 宿舍管理系统 15 | 16 | 17 |
18 |
19 |
20 | 21 |
22 |
搜索
23 |
24 |
25 |
26 | 27 | 31 |
32 |
33 | 34 | 35 |
36 |
37 | 42 |
43 |
44 | 49 |
50 |
51 |
52 |
53 | 54 |
55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 90 | 91 | 92 | 93 |
ID名称介绍管理员
${building.id}${building.name}${building.introduction}${building.adminName} 72 |
73 | 82 | 83 | 88 |
89 |
94 | 95 |
97 |
145 | 146 | 147 | 148 |
150 |
206 | 207 | 208 | 209 |
212 |
242 | 243 |
244 |
245 |
246 |
247 | 248 | 279 | 280 | 281 | 282 | -------------------------------------------------------------------------------- /src/main/webapp/css/style.css: -------------------------------------------------------------------------------- 1 | body{ 2 | background: url("../img/1.jpg"); 3 | animation-name:bg; 4 | animation-duration:20s; 5 | /*变换时间*/ 6 | animation-delay:2s; 7 | /*动画开始时间*/ 8 | animation-iteration-count:infinite; 9 | /*下一周期循环播放*/ 10 | animation-play-state:running; 11 | /*动画开始运行*/ 12 | } 13 | @keyframes bg 14 | { 15 | 0% {background:url("../img/1.jpg");} 16 | 34% {background:url("../img/2.jpg");} 17 | 67% {background:url("../img/3.jpg");} 18 | 100% {background:url("../img/1.jpg");} 19 | } 20 | .form{background: rgba(255,255,255,0.7);width:400px;margin:120px auto;} 21 | 22 | /*阴影*/ 23 | 24 | .fa{display: inline-block;top: 27px;left: 6px;position: relative;color: #ccc;} 25 | input[type="text"],input[type="password"]{padding-left:26px;} 26 | .checkbox{padding-left:21px;} 27 | -------------------------------------------------------------------------------- /src/main/webapp/dormitoryadmin.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | <%@ page isELIgnored="false" %> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 22 | 23 | 24 | 42 |
43 | 61 |
62 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /src/main/webapp/dormitorymanager.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | <%@ page isELIgnored="false" %> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 宿舍管理系统 15 | 16 | 17 |
18 |
19 |
20 | 21 |
22 |
搜索
23 |
24 |
25 |
26 | 27 | 31 |
32 |
33 | 34 | 35 |
36 |
37 | 42 |
43 |
44 | 49 |
50 |
51 |
52 |
53 | 54 |
55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 94 | 95 | 96 | 97 |
ID楼宇名称几人间空余床位电话操作
${dormitory.id}${dormitory.buildingName}${dormitory.name}${dormitory.type}${dormitory.available}${dormitory.telephone} 77 |
78 | 86 | 87 | 92 |
93 |
98 | 99 |
101 |
160 | 161 | 162 | 163 |
165 |
210 | 211 | 212 | 213 |
216 |
246 | 247 |
248 |
249 |
250 |
251 | 252 | 275 | 276 | 277 | 278 | -------------------------------------------------------------------------------- /src/main/webapp/img/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openallzzz/dormitoryms_ssm/f2b5a86da2737a26e062e7ca900304a4341e86bf/src/main/webapp/img/1.jpg -------------------------------------------------------------------------------- /src/main/webapp/img/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openallzzz/dormitoryms_ssm/f2b5a86da2737a26e062e7ca900304a4341e86bf/src/main/webapp/img/2.jpg -------------------------------------------------------------------------------- /src/main/webapp/img/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openallzzz/dormitoryms_ssm/f2b5a86da2737a26e062e7ca900304a4341e86bf/src/main/webapp/img/3.jpg -------------------------------------------------------------------------------- /src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | <%--<%@ page contentType="text/html;charset=UTF-8" language="java" %>--%> 2 | <%--<%@ page isELIgnored="false" %>--%> 3 | <%--<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>--%> 4 | <%----%> 5 | <%----%> 6 | <%----%> 7 | <%--

${systemAdmin.name}

--%> 8 | <%----%> 9 | <%----%> 10 | 13 | -------------------------------------------------------------------------------- /src/main/webapp/login.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | <%@ page isELIgnored="false" %> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | 5 | 6 | 7 | 登录界面 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |
22 |

用户登录

23 |
24 |
25 | 26 | ${usernameError} 27 | 28 |
29 |
30 | 31 | ${passwordError} 32 | 33 |
34 |
35 | 38 | 41 |
42 |
43 | 44 | 45 |
46 |
47 |
48 |
49 |
50 | 51 | -------------------------------------------------------------------------------- /src/main/webapp/moveoutrecord.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | <%@ page isELIgnored="false" %> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 宿舍管理系统 15 | 16 | 17 |
18 |
19 |
20 | 21 | 22 |
23 |
搜索
24 |
25 |
26 |
27 | 28 | 32 |
33 |
34 | 35 | 36 |
37 |
38 | 43 |
44 |
45 |
46 |
47 | 48 |
49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
ID学生宿舍迁出原因迁出日期
${moveout.id}${moveout.studentName}${moveout.dormitoryName}${moveout.reason}${moveout.createDate}
71 | 72 |
73 |
74 |
75 |
76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /src/main/webapp/moveoutregister.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | <%@ page isELIgnored="false" %> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 宿舍管理系统 15 | 16 | 17 |
18 |
19 |
20 | 21 | 22 |
23 |
搜索
24 |
25 |
26 |
27 | 28 | 32 |
33 |
34 | 35 | 36 |
37 |
38 | 43 |
44 |
45 |
46 |
47 | 48 |
49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 81 | 82 | 83 | 84 |
ID宿舍学号姓名性别状态操作
${student.id}${student.dormitoryName}${student.number}${student.name}${student.gender}${student.state} 71 |
72 | 79 |
80 |
85 | 86 | 87 |
90 | 91 |
132 | 133 | 134 |
135 |
136 |
137 |
138 | 139 | 140 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /src/main/webapp/studentmanager.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | <%@ page isELIgnored="false" %> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 宿舍管理系统 15 | 16 | 17 |
18 |
19 |
20 | 21 |
22 |
搜索
23 |
24 |
25 |
26 | 27 | 31 |
32 |
33 | 34 | 35 |
36 |
37 | 42 |
43 |
44 | 49 |
50 |
51 |
52 |
53 | 54 |
55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 101 | 102 | 103 | 104 |
ID宿舍学号姓名性别状态入住时间操作
${student.id}${student.dormitoryName}${student.number}${student.name}${student.gender}${student.state}${student.createDate} 79 |
80 | 91 | 92 | 99 |
100 |
105 | 106 |
108 |
165 | 166 | 167 | 168 |
170 |
246 | 247 | 248 | 249 |
252 |
283 | 284 |
285 |
286 |
287 |
288 | 289 | 331 | 332 | 333 | 334 | -------------------------------------------------------------------------------- /src/main/webapp/systemadmin.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | <%@ page isELIgnored="false" %> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 22 | 23 | 24 | 42 | 87 | 92 | 93 | 94 | --------------------------------------------------------------------------------