基于JSP的宿舍管理系统的设计与实现
摘要:伴随着科技的发展,互联网已慢慢加入到大家的日常日常生活和学习中。大学生宿舍管理系统的运用愈来愈广泛,宿舍管理系统的功能也更加健全。伴随着社会的发展趋势,愈来愈多的宿舍管理系统运用到学生的生活中。与此同时也便捷了对学生的管理方法。文中主要是阐述了学生宿舍管理系统的功能以及建立的整个过程。
学生宿舍管理系统根据B/S方式,SSM架构,JSP[1]科研开发,MYSQL[2]数据存储数据信息。在网站建设全过程中,最先剖析基本上功能,根据人物角色完成功能,分成普通用户和管理员,普通用户和管理员各自进到操作系统开展实际操作。随后依据人物角色完成实际功能,普通用户可以登陆查询信息,管理员可以实际完成登陆功能和一系列管理方法功能。最终,对学生宿舍管理系统的功能开展了测试流程,并对检测结论做好了汇总。学生宿舍管理系统功能齐备,页面合理布局,使用方便,管理方法便捷,市场前景无尽。
【633】基于springboot学生宿舍管理系统源码和论文
关键词:宿舍管理 JSP技术 B/S架构 MYSQL数据库
Design and Implementation Of Dormitory Management System Based On JSP
Abstract: With the development of science and technology, the Internet has gradually joined everyone's daily life and study. College Students' dormitory management system is more and more widely used, and the function of dormitory management system is also more perfect. With the development trend of society, more and more dormitory management systems are applied to students' life. At the same time, it also facilitates the management of students. This paper mainly expounds the function of student dormitory management system and the whole process of its establishment.
The student dormitory management system is based on B / S mode, SSM architecture, JSP [1] scientific research and development, and MySQL [2] data to store data information. In the whole process of website construction, the basic functions are analyzed first, and the functions are divided into ordinary users and administrators according to the personas. Ordinary users and administrators enter the operating system to carry out practical operation. Then, according to the actual functions of personas, ordinary users can log in and query information, and administrators can actually complete the login function and a series of management method functions. Finally, the function of the student dormitory management system is tested, and the test conclusions are summarized. The student dormitory management system has complete functions, reasonable page layout, convenient use, convenient management methods and endless market prospects.
Keywords: dormitory management JSP technology B/S structure MYSQL database
package com.boot.controller;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.boot.entity.Clazz;
import com.boot.entity.Dept;
import com.boot.entity.Health;
import com.boot.entity.Rooms;
import com.boot.entity.Teacher;
import com.boot.service.ClazzService;
import com.boot.service.DeptService;
import com.boot.service.HealthService;
import com.boot.service.RoomsService;
import com.boot.service.TeacherService;
import com.boot.util.PageHelper;
import com.boot.util.VeDate;
//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/health", produces = "text/plain;charset=utf-8")
public class HealthController extends BaseController {
// 注入Service 由于标签的存在 所以不需要getter setter
@Autowired
private HealthService healthService;
@Autowired
private DeptService deptService;
@Autowired
private ClazzService clazzService;
@Autowired
private RoomsService roomsService;
@Autowired
private TeacherService teacherService;
// 准备添加数据
@RequestMapping("createHealth.action")
public String createHealth() {
Rooms rooms = new Rooms();
String adminid = (String) this.getSession().getAttribute("adminid");
rooms.setTeacherid(adminid);
List<Rooms> roomsList = this.roomsService.getRoomsByCond(rooms);
this.getRequest().setAttribute("roomsList", roomsList);
return "admin/addhealth";
}
// 添加数据
@RequestMapping("addHealth.action")
public String addHealth(Health health) {
Rooms rooms = this.roomsService.getRoomsById(health.getRoomsid());
Clazz clazz = this.clazzService.getClazzById(rooms.getClazzid());
String adminid = (String) this.getSession().getAttribute("adminid");
health.setAddtime(VeDate.getStringDateShort());
health.setTeacherid(adminid);
health.setDeptid(clazz.getDeptid());
health.setClazzid(rooms.getClazzid());
this.healthService.insertHealth(health);
return "redirect:/health/createHealth.action";
}
// 通过主键删除数据
@RequestMapping("deleteHealth.action")
public String deleteHealth(String id) {
this.healthService.deleteHealth(id);
return "redirect:/health/getAllHealth.action";
}
// 批量删除数据
@RequestMapping("deleteHealthByIds.action")
public String deleteHealthByIds() {
String[] ids = this.getRequest().getParameterValues("healthid");
for (String healthid : ids) {
this.healthService.deleteHealth(healthid);
}
return "redirect:/health/getAllHealth.action";
}
// 更新数据
@RequestMapping("updateHealth.action")
public String updateHealth(Health health) {
this.healthService.updateHealth(health);
return "redirect:/health/getAllHealth.action";
}
// 显示全部数据
@RequestMapping("getAllHealth.action")
public String getAllHealth(String number) {
List<Health> healthList = this.healthService.getAllHealth();
PageHelper.getPage(healthList, "health", null, null, 10, number, this.getRequest(), null);
return "admin/listhealth";
}
@RequestMapping("getManagerHealth.action")
public String getManagerHealth(String number) {
String adminid = (String) this.getSession().getAttribute("adminid");
Health health = new Health();
health.setTeacherid(adminid);
List<Health> healthList = this.healthService.getHealthByCond(health);
PageHelper.getUserPage(healthList, "health", "getManagerHealth", 10, number, this.getRequest());
return "admin/xlisthealth";
}
@RequestMapping("getTeacherHealth.action")
public String getTeacherHealth(String number) {
String adminid = (String) this.getSession().getAttribute("adminid");
Health health = new Health();
health.setTid(adminid);
List<Health> healthList = this.healthService.getHealthByCond(health);
PageHelper.getUserPage(healthList, "health", "getManagerHealth", 10, number, this.getRequest());
return "admin/zlisthealth";
}
// 按条件查询数据 (模糊查询)
@RequestMapping("queryHealthByCond.action")
public String queryHealthByCond(String cond, String name, String number) {
Health health = new Health();
if (cond != null) {
if ("deptid".equals(cond)) {
health.setDeptid(name);
}
if ("clazzid".equals(cond)) {
health.setClazzid(name);
}
if ("roomsid".equals(cond)) {
health.setRoomsid(name);
}
if ("resultx".equals(cond)) {
health.setResultx(name);
}
if ("addtime".equals(cond)) {
health.setAddtime(name);
}
if ("teacherid".equals(cond)) {
health.setTeacherid(name);
}
if ("memo".equals(cond)) {
health.setMemo(name);
}
}
List<String> nameList = new ArrayList<String>();
List<String> valueList = new ArrayList<String>();
nameList.add(cond);
valueList.add(name);
PageHelper.getPage(this.healthService.getHealthByLike(health), "health", nameList, valueList, 10, number,
this.getRequest(), "query");
name = null;
cond = null;
return "admin/queryhealth";
}
// 按主键查询数据
@RequestMapping("getHealthById.action")
public String getHealthById(String id) {
Health health = this.healthService.getHealthById(id);
this.getRequest().setAttribute("health", health);
List<Dept> deptList = this.deptService.getAllDept();
this.getRequest().setAttribute("deptList", deptList);
List<Clazz> clazzList = this.clazzService.getAllClazz();
this.getRequest().setAttribute("clazzList", clazzList);
List<Rooms> roomsList = this.roomsService.getAllRooms();
this.getRequest().setAttribute("roomsList", roomsList);
List<Teacher> teacherList = this.teacherService.getAllTeacher();
this.getRequest().setAttribute("teacherList", teacherList);
return "admin/edithealth";
}
public HealthService getHealthService() {
return healthService;
}
public void setHealthService(HealthService healthService) {
this.healthService = healthService;
}
}
// 程序开发 QQ 709664889 可以付费修改
package com.boot.controller;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.boot.entity.Beds;
import com.boot.entity.Clazz;
import com.boot.entity.Rooms;
import com.boot.entity.Teacher;
import com.boot.service.BedsService;
import com.boot.service.ClazzService;
import com.boot.service.RoomsService;
import com.boot.service.TeacherService;
import com.boot.util.PageHelper;
import com.boot.util.VeDate;
//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/rooms", produces = "text/plain;charset=utf-8")
public class RoomsController extends BaseController {
// 注入Service 由于标签的存在 所以不需要getter setter
@Autowired
private RoomsService roomsService;
@Autowired
private TeacherService teacherService;
@Autowired
private ClazzService clazzService;
@Autowired
private BedsService bedsService;
// 准备添加数据
@RequestMapping("createRooms.action")
public String createRooms() {
Teacher teacher = new Teacher();
teacher.setRole("宿管");
List<Teacher> teacherList = this.teacherService.getTeacherByCond(teacher);
this.getRequest().setAttribute("teacherList", teacherList);
List<Clazz> clazzList = this.clazzService.getAllClazz();
this.getRequest().setAttribute("clazzList", clazzList);
this.getRequest().setAttribute("roomsid", "R" + VeDate.getStringDatex());
return "admin/addrooms";
}
// 添加数据
@RequestMapping("addRooms.action")
public String addRooms(Rooms rooms) {
Beds beds = new Beds();
beds.setRoomsid(rooms.getRoomsid());
List<Beds> list = this.bedsService.getBedsByCond(beds);
System.out.println(list.size());
if (list.size() == 0) {
this.getSession().setAttribute("message", "请配置床位");
return "redirect:/rooms/createRooms.action";
}
rooms.setNum("" + list.size());
rooms.setUsenum("0");
this.roomsService.insertRooms(rooms);
return "redirect:/rooms/createRooms.action";
}
// 通过主键删除数据
@RequestMapping("deleteRooms.action")
public String deleteRooms(String id) {
this.roomsService.deleteRooms(id);
return "redirect:/rooms/getAllRooms.action";
}
// 批量删除数据
@RequestMapping("deleteRoomsByIds.action")
public String deleteRoomsByIds() {
String[] ids = this.getRequest().getParameterValues("roomsid");
for (String roomsid : ids) {
this.roomsService.deleteRooms(roomsid);
}
return "redirect:/rooms/getAllRooms.action";
}
// 更新数据
@RequestMapping("updateRooms.action")
public String updateRooms(Rooms rooms) {
this.roomsService.updateRooms(rooms);
return "redirect:/rooms/getAllRooms.action";
}
// 显示全部数据
@RequestMapping("getAllRooms.action")
public String getAllRooms(String number) {
List<Rooms> roomsList = this.roomsService.getAllRooms();
PageHelper.getPage(roomsList, "rooms", null, null, 10, number, this.getRequest(), null);
return "admin/listrooms";
}
@RequestMapping("getManagerRooms.action")
public String getManagerRooms(String number) {
Rooms rooms = new Rooms();
String adminid = (String) this.getSession().getAttribute("adminid");
rooms.setTeacherid(adminid);
List<Rooms> roomsList = this.roomsService.getRoomsByCond(rooms);
PageHelper.getUserPage(roomsList, "rooms", "getManagerRooms", 10, number, this.getRequest());
return "admin/xlistrooms";
}
@RequestMapping("getTeacherRooms.action")
public String getTeacherRooms(String number) {
Rooms rooms = new Rooms();
String adminid = (String) this.getSession().getAttribute("adminid");
rooms.setTid(adminid);
List<Rooms> roomsList = this.roomsService.getRoomsByCond(rooms);
PageHelper.getUserPage(roomsList, "rooms", "getManagerRooms", 10, number, this.getRequest());
return "admin/zlistrooms";
}
// 按条件查询数据 (模糊查询)
@RequestMapping("queryRoomsByCond.action")
public String queryRoomsByCond(String cond, String name, String number) {
Rooms rooms = new Rooms();
if (cond != null) {
if ("rno".equals(cond)) {
rooms.setRno(name);
}
if ("floor".equals(cond)) {
rooms.setFloor(name);
}
if ("sex".equals(cond)) {
rooms.setSex(name);
}
if ("teacherid".equals(cond)) {
rooms.setTeacherid(name);
}
if ("clazzid".equals(cond)) {
rooms.setClazzid(name);
}
if ("num".equals(cond)) {
rooms.setNum(name);
}
if ("usenum".equals(cond)) {
rooms.setUsenum(name);
}
if ("memo".equals(cond)) {
rooms.setMemo(name);
}
}
List<String> nameList = new ArrayList<String>();
List<String> valueList = new ArrayList<String>();
nameList.add(cond);
valueList.add(name);
PageHelper.getPage(this.roomsService.getRoomsByLike(rooms), "rooms", nameList, valueList, 10, number,
this.getRequest(), "query");
name = null;
cond = null;
return "admin/queryrooms";
}
// 按主键查询数据
@RequestMapping("getRoomsById.action")
public String getRoomsById(String id) {
Rooms rooms = this.roomsService.getRoomsById(id);
this.getRequest().setAttribute("rooms", rooms);
Teacher teacher = new Teacher();
teacher.setRole("宿管");
List<Teacher> teacherList = this.teacherService.getTeacherByCond(teacher);
this.getRequest().setAttribute("teacherList", teacherList);
List<Clazz> clazzList = this.clazzService.getAllClazz();
this.getRequest().setAttribute("clazzList", clazzList);
return "admin/editrooms";
}
public RoomsService getRoomsService() {
return roomsService;
}
public void setRoomsService(RoomsService roomsService) {
this.roomsService = roomsService;
}
}