基于springboot学生宿舍管理系统源码和论文

本文详细描述了一种基于JSP、B/S架构和SSM模式的学生宿舍管理系统的设计与实现,涉及用户角色划分、功能模块开发(如登录查询、管理操作)、数据库MySQL的应用以及系统测试。
摘要由CSDN通过智能技术生成

基于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;
	}

}

  • 20
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
基于Spring Boot的宿舍管理系统源码通常会使用关系型数据库来存储和管理数据。常见的数据库选择有MySQL、Oracle、SQL Server等。下面以MySQL为例,简要介绍宿舍管理系统数据库的设计。 在MySQL中,我们可以创建一个名为dormitory的数据库来存储宿舍管理系统的相关数据。该数据库中通常会包含以下表: 1. 学生表(students):记录学生信息,包括学生ID、姓名、性别、年龄、班级等字段。 2. 宿舍表(dormitories):记录宿舍信息,包括宿舍ID、宿舍楼号、宿舍房间号、床位数等字段。 3. 管理员表(administrators):记录管理员信息,包括管理员ID、姓名、密码等字段。 4. 入住记录表(check_ins):记录学生的入住情况,包括学生ID、宿舍ID、入住时间等字段。 5. 物品借用表(borrow_items):记录学生借用宿舍物品的情况,包括学生ID、物品名称、借用时间、归还时间等字段。 基于Spring Boot的宿舍管理系统源码中,我们会使用Spring Data JPA来进行数据库的操作。借助于Spring Data JPA的注解和编程规范,可以方便地进行数据的增删改查操作。 此外,为了增强系统的性能和安全性,我们还可以考虑在数据库中添加索引、设置外键约束等。例如,在学生表中可以添加学生ID的唯一索引,以加快学生信息的查询速度;在宿舍表中,可以设置外键约束,确保学生ID和宿舍ID的关联关系的完整性。 综上所述,基于Spring Boot的宿舍管理系统源码通常会使用关系型数据库,如MySQL,来存储和管理数据。通过合理的数据库设计和Spring Data JPA的使用,能够实现系统数据的高效管理和操作。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序猿毕业分享网

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值