基于javaweb的自习室图书馆座位预约管理系统(java+ssm+jsp+easyui+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的自习室图书馆座位预约管理系统(java+SSM+JSP+easyUI+mysql)
项目介绍
一款由jsp+ssm+mysql实现的图书馆预约占座管理系统,前端采用的是当下最流行的easyui框架,后台用的ssm(spring、springMVC、mybaits)框架.添加学生和教师时会自动在用户表中注册,定时任务会定时生成座位信息,阅览室分类中可设置信用等级,学生被扣分后信用等级低于相应的值后不能预约相应的阅览室座位.本项目分为管理员、教师、学生三种角色。
管理员角色包含以下功能: 管理员登陆,用户管理,师生信息管理,阅览室管理,信用积分管理,交流管理,信息统计,图书推荐等功能。
教师角色包含以下功能: 教师角色登陆,个人信息管理,管理学生的信用积分等功能。
学生角色包含以下功能: 学生账号登陆,阅览室信息查看,信息积分查看,选座位,选座管理,通知信息管理,信息交流,图书推荐等功能。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本; 6.是否Maven项目:否;
技术栈
使用说明
用户管理控制层:
@Controller
public class UserController {
@Autowired
UserServiceImpl userService;
/*
queryUserlike 通过用户姓名进行模糊查询
*/
@GetMapping(“/queryUserlike/{username}”)
@ResponseBody
public Msg queryUserlikeId(@RequestParam(value = “pn”,defaultValue = “1”) Integer pn,
@PathVariable(“username”) String username){
PageHelper.startPage(pn,20);
List users = userService.queryByUserName(username);
PageInfo page=new PageInfo(users,5);
return Msg.success().add(“pageInfo”,page);
/*
前端发送请求后端分页数据,
*/
@GetMapping(“/userTables”)
@ResponseBody
public Msg userTables(@RequestParam(value = “pn”,defaultValue = “1”) Integer pn){
PageHelper.startPage(pn,7);
List users = userService.getAll();
PageInfo page=new PageInfo(users,5);
return Msg.success().add(“pageInfo”,page);
//到tables页面
@RequestMapping(“/usertables”)
public String toUserTables(Map
List users = userService.getAll();
map.put(“users”,users);
return “Tables”;
//点击编辑按键传入userid查询用户,返回用户信息
@GetMapping(“/queryUserByID/{userid}”)
@ResponseBody
public Msg queryUserID(@PathVariable(“userid”) Integer userid,Map
User users = userService.getUserByID(userid);
return Msg.success().add(“users”,users);
/*
*/
/*@GetMapping(“/user22”)
public String getAllUser(Map
List users = userService.getAll();
map.put(“users”,users);
return “Dashboard”;
}*/
/*
*/
@DeleteMapping(value = “/user/{ids}”)
@ResponseBody
public Msg delEmp(@PathVariable(“ids”) String ids) {
if(ids.contains(“-”)) {
List delids = new ArrayList();
String[] split = ids.split(“-”);
for (String string : split) {
delids.add(Integer.parseInt(string));
userService.batchUser(delids);
}else {
int id = Integer.parseInt(ids);
userService.deleteUser(id);
return Msg.success();
/*
*/
@PutMapping(value = “/user/{userID}”)
@ResponseBody
public Msg saveEmp(User user) {
System.out.println(user);
userService.updateUser(user);
return Msg.success();
/*
*/
@GetMapping(value = “user/{id}”)
@ResponseBody
public Msg getEmp(@PathVariable(value = “id”)Integer userID) {
User user = userService.getUserByID(userID);
return Msg.success().add(“user”, user);
/*
*/
@RequestMapping(value = “/checkAddUser”)
@ResponseBody
public Msg checkAddUser(@RequestParam(“username”)String userName) {
//先判断用户名是否合法的表达式
String regex = “(1{6,16} ) ∣ ( [ u 2 E 80 − u 9 F F F ] + )|(^[\\u2E80-\\u9FFF]+ )∣([u2E80−u9FFF]+)”;
boolean c = userName.matches(regex);
if(!c) {
return Msg.fail().add(“va_msg”, “用户名可以是2-5位中文,或者6-16位英文和数字的组合”);
//数据库用户名重复校验
boolean b = userService.checkUserName(userName);
if(b) {
return Msg.success().add(“va_msg”, “用户名可用”);
}else {
return Msg.fail().add(“va_msg”, “用户名已存在”);
/校验手机号码格式/
@RequestMapping(“/checkAddTel”)
@ResponseBody
public Msg checkAddTel(@RequestParam(value = “usertel”)String userTel1) {
String userTel = userTel1.trim();
String regex = “(^1\d{10}$)”;
boolean matches = userTel.matches(regex);
if(matches == true){
return Msg.success().add(“va_msg”,“”);
}else{
return Msg.fail().add(“va_msg”,“手机号必须以1开头,11位的数字!”);
/校验年龄码格式/
@RequestMapping(“/checkAddAge”)
@ResponseBody
public Msg checkAddAge(@RequestParam(value = “userage”)Integer userAge1) {
String s = userAge1.toString();
String userTel = s.trim();
String regex = “(^\d{1,3}$)”;
boolean matches = userTel.matches(regex);
if(matches == true){
return Msg.success().add(“va_msg”,“”);
}else{
return Msg.fail().add(“va_msg”,“请输入数字”);
/校验密码格式/
@RequestMapping(“/checkAddPwd”)
@ResponseBody
public Msg checkAddPwd(@RequestParam(value = “userpwd”)String userPwd1) {
String userPwd = userPwd1.trim();
String regex = “(2{6,16}$)”;
boolean matches = userPwd.matches(regex);
if(matches == true){
return Msg.success().add(“va_msg”,“”);
}else{
return Msg.fail().add(“va_msg”,“密码格式不正确:必须超过6位,小于16位的英文和数字!”);
/*******************************************插入
点击保存按钮,新增用户
*/
@PostMapping(“/insertUser”)
@ResponseBody
public Msg insertUser(User user){
user.setUserid(null);
userService.insertUser(user);
return Msg.success().add(“va_msg”,“插入成功!”);
//点击更新按钮,更新修改的数据
@PutMapping(“/updateUser”)
@ResponseBody
public Msg updateUser(User user){
userService.updateUser(user);
return Msg.success().add(“va_msg”,“插入成功!”);
//用户删除
@DeleteMapping(“/deleteUser/{userid}”)
@ResponseBody
public Msg deleteEmployee(@PathVariable(“userid”) Integer userid){
boolean b = userService.deleteUser(userid);
if (b){
return Msg.success().add(“va_msg”,“用户删除成功!”);
}else {
return Msg.fail().add(“va_msg”,“用户删除失败!”);
/*
前端ajax请求,查询userid是否在表中存在
*/
@GetMapping(“/checkUserID”)
@ResponseBody
public Msg checkUserID(@RequestParam(“userid”) Integer userid){
boolean b = userService.checkUserID(userid);
if(b){
return Msg.success().add(“va_msg”,“用户名存在!”);
}else {
return Msg.fail().add(“va_msg”,“用户名不存在,重新输入!”);
预约作为管理控制层:
@Controller
public class SeatResverController {
@Autowired
SeatResverServiceImpl seatResverService;
/*
点击预约信息的提交按钮,保存该预约信息
*/
@PostMapping(“/insertSeatResver”)
@ResponseBody
public Msg insertSeatResver(SeatResver seatResver,@RequestParam(“status”) String status){
seatResver.setResverid(null);
seatResverService.insertSeatResver(seatResver,status);
return Msg.success().add(“va_msg”,“预约座位信息插入成功!”);
/*
点击预约信息的提交按钮,校验该用户是否已经预约
*/
@GetMapping(“/checkSeatResverUserID/{userid}”)
@ResponseBody
public Msg checkSeatResverUserID(@PathVariable(“userid”) Integer userid){
boolean b = seatResverService.checkUserID(userid);
if (b){
return Msg.fail().add(“va_msg”,“该用户已预约或已上座,请重新输入!”);
}else {
return Msg.success().add(“va_msg”,“”);
/*
点击取消按钮,删除预约信息(根据座位号)
*/
@DeleteMapping(“/deleteSeatResver/{seatid}”)
@ResponseBody
public Msg deleteSeatResver(@PathVariable(“seatid”) Integer seatid){
boolean b = seatResverService.deleteSeatResver(seatid);
if (b){
return Msg.success().add(“va_msg”,“删除预约信息成功!”);
}else {
return Msg.fail().add(“va_msg”,“删除预约信息失败!”);
/*
获取全部预约信息,返回到前端展示再页面中
*/
@GetMapping(“/getSeatResverInfo”)
@ResponseBody
public Msg getSeatResverInfo(@RequestParam(value = “pn”,defaultValue = “1”)Integer pn){
PageHelper.startPage(pn,6);
List all = seatResverService.getAll();
PageInfo page=new PageInfo(all,5);
return Msg.success().add(“pageInfo”,page);
/*
模糊查询,seatid
*/
@GetMapping(“/querySeatlike/{seatid}”)
@ResponseBody
public Msg getSeatResver(@PathVariable(“seatid”) Integer seatid
,@RequestParam(value = “pn”,defaultValue = “1”)Integer pn){
PageHelper.startPage(pn,20);
List all = seatResverService.getSeatAll(seatid);
PageInfo page=new PageInfo(all,5);
return Msg.success().add(“pageInfo”,page);
管理员管理控制层:
@Controller
public class ManagerController {
@Autowired
ManagerServiceImpl managerService;
//进入忘记密码页面
@RequestMapping(“/forgotPwd”)
public String toForgotPage(){
return “ForgotPassword”;
@RequestMapping(“/forgotPwd2”)
public String toForgotPage2(){
return “ForgotPassword2”;
@RequestMapping(“/logout”)
public String toLoginPage(HttpSession session){
Enumeration attributeNames = session.getAttributeNames();
while (attributeNames.hasMoreElements()) {
session.removeAttribute(attributeNames.nextElement());
return “Login”;
//进入重置密码页面
@RequestMapping(“/register”)
public String toRegisterPage(){
return “Register”;
//登陆和忘记密码==》检查用户名是否存在
@GetMapping(“/checkLoginManagerName”)
@ResponseBody
public Msg checkLoginManagerName(@RequestParam(“managername”) String managername1){
String managername = managername1.trim();
String regex = “(3{6,16} ) ∣ ( [ u 2 E 80 − u 9 F F F ] + )|(^[\\u2E80-\\u9FFF]+ )∣([u2E80−u9FFF]+)”;
boolean c = managername.matches(regex);
if(!c) {
return Msg.fail().add(“va_msg”, “用户名是2-5位中文,或者6-16位英文和数字的组合”);
boolean b = managerService.checkManagerName(managername);
if (b==true){
return Msg.fail().add(“va_msg”,“用户名不存在!”);
}else {
return Msg.success().add(“va_msg”,“”);
//注册检查用户名是否存在
@GetMapping(“/checkManagerName”)
@ResponseBody
public Msg checkManagerName(@RequestParam(“managername”) String managername1){
String managername = managername1.trim();
String regex = “(4{6,16} ) ∣ ( [ u 2 E 80 − u 9 F F F ] + )|(^[\\u2E80-\\u9FFF]+ )∣([u2E80−u9FFF]+)”;
boolean c = managername.matches(regex);
if(!c) {
return Msg.fail().add(“va_msg”, “用户名可以是2-5位中文,或者6-16位英文和数字的组合”);
boolean b = managerService.checkManagerName(managername);
if (b==true){
return Msg.success().add(“va_msg”,“用户名可用!”);
}else {
return Msg.fail().add(“va_msg”,“用户名已存在!”);
//检查手机号是否是十一位
@GetMapping(“/checkManagerTel”)
@ResponseBody
public Msg checkManagerTel(@RequestParam(“managertel”) String managertel1){
String managertel = managertel1.trim();
String regex = “(^1\d{10}$)”;
boolean matches = managertel.matches(regex);
if(matches == true){
return Msg.success().add(“va_msg”," ");
}else{
return Msg.fail().add(“va_msg”,“手机号必须以1开头,11位的数字!”);
//登陆检查密码
@GetMapping(“/checkLoginManagerPwd”)
@ResponseBody
public Msg checkLoginManagerPwd(@RequestParam(“managerpwd”) String managerpwd1){
String managerpwd = managerpwd1.trim();
String regex = “(5{6,16}$)”;
boolean matches = managerpwd.matches(regex);
if(matches == true){
return Msg.success().add(“va_msg”," ");
}else{
return Msg.fail().add(“va_msg”,“密码格式不正确:必须超过6位,小于16位!”);
//注册检查密码
@GetMapping(“/checkManagerPwd”)
@ResponseBody
public Msg checkManagerPwd(@RequestParam(“managerpwd”) String managerpwd1){
String managerpwd = managerpwd1.trim();
String regex = “(6{6,16}$)”;
boolean matches = managerpwd.matches(regex);
if(matches == true){
return Msg.success().add(“va_msg”," ");
}else{
return Msg.fail().add(“va_msg”,“密码格式不正确:必须超过6位,小于16位!”);
/*新增管理员
**/
@PostMapping(“/registerManager”)
public String registerManger(Manager manager,Map
manager.setManagerid(null);
boolean flag = managerService.createManager(manager);
if(flag == true){
map.put(“msg”,“插入成功!”);
return “redirect:share.html”;
}else{
map.put(“msg”,“插入失败!”);
return “Register”;
//点击进入按钮校验用户名和密码是否正确
@PostMapping(“/loginD”)
public String loginDashboard(@RequestParam(“managername”) String managername1,
@RequestParam(“managerpwd”) String managerpwd1,
Map
/*
==true没有该用户
==false 用户存在
*/
String managername = managername1.trim();
String managerpwd = managerpwd1.trim();
if(managername != “” && managerpwd!=“”){
boolean name = managerService.checkManagerName(managername);
boolean pwd = managerService.checkManagerPwd(managerpwd);
if(name == false && pwd ==false ){
// System.out.println(“用户名或密码正确!”);
session.setAttribute(“username”,managername);
return “redirect:/user22”;
}else{
// System.out.println(“密码错误!”);
map.put(“msg”,“账号密码错误,请重新输入账号和密码!”);
return “Login”;
}else {
map.put(“msg”,“请输入账号or密码!”);
return “Login”;
/*resetpwd
@PutMapping(“/resetpwd”)
public String backLogin(@RequestParam(“managername”) String managername1,
@RequestParam(“managerpwd”) String managerpwd1,
Map
String managername = managername1.trim();
String managerpwd = managerpwd1.trim();
if (managername != “” && managerpwd != “”){
boolean tel = managerService.checkManagerName(managername);
if(tel == true){
map.put(“msg”,“账号不存在,请重新输入!”);
return “ForgotPassword”;
}else {
int i = managerService.updateUserPwd(managername,managerpwd);
map.put(“msg”,“reset success!”);
if(i>0){
return “redirect:/share.html”;
}else {
return “ForgotPassword”;
}else {
map.put(“msg”,“账号或新密码为空,请输入!”);
return “ForgotPassword”;
@PutMapping(“/resetpwd2”)
public String backLogin2(@RequestParam(“managername”) String managername1,
@RequestParam(“managerpwd”) String managerpwd1,
Map
String managername = managername1.trim();
String managerpwd = managerpwd1.trim();
if (managername != “” && managerpwd != “”){
boolean tel = managerService.checkManagerName(managername);
if(tel == true){
map.put(“msg”,“账号不存在,请重新输入!”);
return “ForgotPassword2”;
}else {
int i = managerService.updateUserPwd(managername,managerpwd);
map.put(“msg”,“reset success!”);
if(i>0){
return “redirect:/forgotPwd2”;
}else {
return “ForgotPassword2”;
}else {
map.put(“msg”,“账号或新密码为空,请输入!”);
return “ForgotPassword2”;
a-zA-Z0-9_- ↩︎
a-zA-Z0-9_- ↩︎
a-zA-Z0-9_- ↩︎
a-zA-Z0-9_- ↩︎
a-zA-Z0-9_- ↩︎
a-zA-Z0-9_- ↩︎