摘要
本研究旨在设计并实现一个基于Java, Spring Boot和HTML的实验室预约管理系统,以解决实验室资源分配不均、管理混乱和预约流程繁琐等问题。系统采用B/S架构设计,后端使用Spring Boot框架进行开发,前端使用HTML进行页面设计,实现了用户登录、实验室预约、查看预约状态以及管理员对实验室的管理等功能。
首先,系统通过Spring Boot实现了快速开发和部署,简化了项目的配置和管理。同时,利用Spring Boot的自动装配特性,方便地集成了MyBatis、MySQL数据库等技术,实现了数据持久化存储。
其次,系统前端采用HTML进行页面设计,结合CSS和JavaScript实现了友好的用户界面。用户可以通过网页进行实验室预约,查看预约状态,取消预约等操作。同时,系统提供了管理员角色,管理员可以对实验室进行管理,如添加、修改实验室信息,查看所有预约记录等。
最后,系统采用了分层架构设计,将业务逻辑层、数据访问层和表示层分离,降低了模块间的耦合度,提高了代码的可维护性和可扩展性。此外,系统还实现了权限控制和异常处理机制,保证了系统的安全性和稳定性。
总之,本研究设计的基于Java, Spring Boot和HTML的实验室预约管理系统,不仅解决了实验室资源分配和管理的问题,还为用户提供了便捷的预约服务,具有较高的实用价值和推广前景。
实现的功能
管理员、教师、学生三种角色;
管理员:用户管理(学生管理、教师管理)、实验室管理、教务管理(班级管理、课程管理)、预约(个人预约、教师预约、预约列表、审核列表);
学生:实验室列表、预约(我的预约、个人预约);
教师:班级管理、实验室列表、预约(教师预约、我的预约)。
用户在预约的时候可以看到实验室的预约人数状态是否满了,也可以在实验室列表查看预约状态。
使用的技术
后端:JAVA开发语言,SpringBoot框架,MySql数据库,Maven;
前端:layUI框架、HTML页面。
部分代码展示
java
public String toTeacherIndexHtml(Model model) {
Map weeks = ConstantUtils.initWeeks();
Map days = ConstantUtils.initDays();
Map parts = ConstantUtils.initParts();
model.addAttribute("weeks", weeks);
model.addAttribute("days", days);
model.addAttribute("parts", parts);
return "/reservation/teacher/index.html";
}
@GetMapping("/individual/index.html")
public String toIndividualIndexHtml(Model model) {
Map weeks = ConstantUtils.initWeeks();
Map days = ConstantUtils.initDays();
Map parts = ConstantUtils.initParts();
model.addAttribute("weeks", weeks);
model.addAttribute("days", days);
model.addAttribute("parts", parts);
return "/reservation/individual/index.html";
}
@GetMapping("/index.html")
public String toReservationIndexHtml() {
return "/reservation/index.html";
}
@GetMapping("/lib")
@ResponseBody
public ResultVO getLibList(int startWeek, int day, int part) {
List<Lib> labList = libService.getCurrentlyUnusedLabList(startWeek, day, part);
return ResultVO.SUCCESS(labList);
}
@GetMapping("/libNum")
@ResponseBody
public ResultVO getLibList() {
List<Lib> labList = libService.getCurrentlyLabUsedNumList();
return ResultVO.SUCCESS(labList);
}
@GetMapping("/grade")
@ResponseBody
public ResultVO getGradeList(int teacherId,int startWeek, int day, int part) {
List<Grade> gradeList = gradeService.getCurrentGradeOfTeacher(teacherId, startWeek, day, part);
return ResultVO.SUCCESS(gradeList);
}
/**
* 添加预约
* */
@PostMapping("/teacher")
@ResponseBody
public ResultVO addReservation(Reservation reservation, HttpSession session) {
long userId = (long)session.getAttribute("userInfo");
reservation.setUserId(userId);
reservationService.save(reservation);
return ResultVO.SUCCESS();
}
/**
* 获取所有预约单
* */
@GetMapping
@ResponseBody
public ResultVO getReservationList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit) {
page -= 1;
long total = reservationService.count();
List<Reservation> reservationList = reservationService.getReservationList(page,limit);
HashMap<String,Object> data = new HashMap<>();
data.put("total",total);
data.put("reservationList",reservationList);
return ResultVO.SUCCESS(0,data);
}
/**
* 获取个人预约单
* */
@GetMapping("/individual/mine")
@ResponseBody
public ResultVO getStudentReservationList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit,
HttpSession session) {
page -= 1;
long userId = (long)session.getAttribute("userInfo");
long total = reservationService.studentCount(userId);
List<Reservation> reservationList = reservationService.getStudentReservationList(page,limit,userId);
HashMap<String,Object> data = new HashMap<>();
data.put("total",total);
data.put("reservationList",reservationList);
return ResultVO.SUCCESS(0,data);
}
/**
* 获取教师预约单
* */
@GetMapping("/teacher/mine")
@ResponseBody
public ResultVO getTeacherReservationList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit,
HttpSession session) {
page -= 1;
long userId = (long)session.getAttribute("userInfo");
long total = reservationService.teacherCount(userId);
List<Reservation> reservationList = reservationService.getTeacherReservationList(page,limit,userId);
HashMap<String,Object> data = new HashMap<>();
data.put("total",total);
data.put("reservationList",reservationList);
return ResultVO.SUCCESS(0,data);
}
/**
* 学生预约列表
* individual/mine.html
* */
@GetMapping("/individual/mine.html")
public String toIndividualMineHtml() {
return "/reservation/individual/mine.html";
}
/**
* 教师预约列表
* teacher/mine.html
* */
@GetMapping("/teacher/mine.html")
public String toTeacherMineHtml() {
return "/reservation/teacher/mine.html";
}
/**
* 获取未深刻预约单
* */
@GetMapping("/audit")
@ResponseBody
public ResultVO getNoneAuditReservationList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit) {
page -= 1;
long total = reservationService.noneAuditCount();
List<Reservation> reservationList = reservationService.getNoneAuditReservationList(page,limit);
HashMap<String,Object> data = new HashMap<>();
data.put("total",total);
data.put("reservationList",reservationList);
return ResultVO.SUCCESS(0,data);
}
@GetMapping("/Audit.html")
public String toAuditReservationIndexHtml() {
return "/reservation/Audit.html";
}
@GetMapping("update/audit")
@ResponseBody
public ResultVO UpdateReservation(long reservationId) {
Reservation reservation = reservationService.getReservationId(reservationId);
reservation.setStatus(1);
reservationService.save(reservation);
System.out.println(reservationId);
return ResultVO.SUCCESS(200);
}
@PostMapping("/delete")
@ResponseBody
public ResultVO deleteReservation(Reservation reservation) {
reservationService.delete(reservation);
return ResultVO.SUCCESS(200);
}
演示视频
基于JAVA,SpringBoot和HTML实验室预约管理系