武功做网站,.net网站开发文档,网站建设的教学网站,有人说做网站赌博主主页#xff1a;Java旅途 简介#xff1a;分享计算机知识、学习路线、系统源码及教程 文末获取源码 一、项目介绍
教室预约管理系统使用SpringBootMybatis进行开发#xff0c;系统整体分为前台和后台#xff0c;后台主要对教室#xff0c;用户等信息进行管理#xf… 博主主页Java旅途 简介分享计算机知识、学习路线、系统源码及教程 文末获取源码 一、项目介绍
教室预约管理系统使用SpringBootMybatis进行开发系统整体分为前台和后台后台主要对教室用户等信息进行管理前台总共分为学生、教室、辅导员、楼长四种角色通过预约教室多层审批完成教室预约功能。系统详细功能如下
后台功能
用户管理教学楼管理教室管理审批查询班级管理
前台功能 学生 教室预约个人中心留言 教师 教师预约个人中心留言 辅导员 审批个人中心 楼长 审批个人中心留言板
二、技术框架
后端SpringBootMybatis前端jquery
三、安装教程
用idea打开项目在idea中配置jdk环境配置maven环境并下载依赖新建数据库导入数据库文件在application.yml文件中将数据库账号密码改成自己本地的启动运行进行访问。
后台管理员账号密码: admin/123456
前台学生账号密码xx/123456
前台教师账号密码lyc/123456
前台辅导员账号密码zs/123456
前台楼长账号密码wm/123456四、项目截图 五、相关代码
RoomController
package edu.room.manage.controller.console;import com.github.pagehelper.PageInfo;
import edu.room.manage.common.annotation.Operation;
import edu.room.manage.common.controller.BaseController;
import edu.room.manage.common.exception.MessageException;
import edu.room.manage.common.mybatis.condition.MybatisCondition;
import edu.room.manage.common.utils.ReturnUtils;
import edu.room.manage.domain.Room;
import edu.room.manage.dto.RoomDTO;
import edu.room.manage.service.FloorService;
import edu.room.manage.service.RoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;import javax.validation.Valid;/***/
Controller
RequestMapping(/console/room)
public class RoomController extends BaseController {Autowiredprivate RoomService roomService;Autowiredprivate FloorService floorService;Operation(查看教学楼)RequestMapping(value /index, method {RequestMethod.GET})public String index(Model model) {return console/room/index;}Operation(教学楼详情)RequestMapping(value detail/{id}, method {RequestMethod.GET})public String from(PathVariable Integer id, Model model) {Room room;if (id ! 0) {room roomService.selectByPrimaryKey(id);} else {room new Room();}model.addAttribute(room, room);model.addAttribute(floorList, floorService.selectAll());return console/room/detail;}Operation(添加更新教学楼)RequestMapping(value /merge, method {RequestMethod.POST})public String save(Valid Room room, BindingResult result, RedirectAttributes attributes) {if (result.hasErrors()) {throw new MessageException(result.getAllErrors().get(0).getDefaultMessage());}roomService.merge(room);return redirect(/console/room/index, 操作成功, attributes);}Operation(删除教学楼)RequestMapping(value /delete, method {RequestMethod.GET})ResponseBodypublic ModelMap delete(Integer id) {roomService.deleteByPrimaryKey(id);return ReturnUtils.success(操作成功, null, null);}ResponseBodyRequestMapping(value /list, method {RequestMethod.GET})public ModelMap list(RoomDTO room) {ModelMap map new ModelMap();MybatisCondition condition new MybatisCondition().like(r.name, room.getName()).like(f.name, room.getFloorName()).like(r.floor, room.getFloor()).page(room);PageInfoRoomDTO pageInfo roomService.selectDtoPage(condition);map.put(pageInfo, pageInfo);return ReturnUtils.success(加载成功, map);}}
HomeController
package edu.room.manage.controller.console;import edu.room.manage.common.annotation.Operation;
import edu.room.manage.common.context.Constant;
import edu.room.manage.common.controller.BaseController;
import edu.room.manage.common.utils.Md5Utils;
import edu.room.manage.domain.Admin;
import edu.room.manage.domain.Floor;
import edu.room.manage.domain.Room;
import edu.room.manage.domain.User;
import edu.room.manage.service.AdminService;
import edu.room.manage.service.FloorService;
import edu.room.manage.service.RoomService;
import edu.room.manage.service.UserService;
import edu.room.manage.valid.ValidUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;import javax.validation.Valid;
import java.util.HashMap;
import java.util.Map;/***/
Controller
RequestMapping(console)
Slf4j
public class HomeController extends BaseController {Autowiredprivate UserService userService;Autowiredprivate RoomService roomService;Autowiredprivate FloorService floorService;Autowiredprivate AdminService adminService;/*** 首页** param model* return*/RequestMapping(value index, method {RequestMethod.GET})public String index(Model model) {return console/index;}/*** 首页展示** param model* return*/RequestMapping(value main, method {RequestMethod.GET})public String right(Model model) {model.addAllAttributes(this.getTotal());return console/right;}/*** 登录页** return*/RequestMapping(value login, method RequestMethod.GET)public String loginForm() {return console/login;}Operation(登录)RequestMapping(value login, method RequestMethod.POST)public String loginPost(Valid ValidUser validUser, BindingResult bindingResult, RedirectAttributes redirectAttributes) {if (bindingResult.hasErrors()) {redirectAttributes.addFlashAttribute(Constant.ERROR_MESSAGE, bindingResult.getAllErrors().get(0).getDefaultMessage());return redirect:login;}String username validUser.getUsername();Admin admin (Admin) userService.login(validUser.getUsername(), validUser.getPassword(), User.UserRoleEnum.ADMIN);if (null admin) {redirectAttributes.addFlashAttribute(Constant.ERROR_MESSAGE, 用户名或密码不正确);return redirect:login;} else {logger.info(用户[ username ]登录认证通过);session.setAttribute(Constant.SESSION_ADMIN, admin);return redirect:index;}}/*** 退出登录** param redirectAttributes* return*/RequestMapping(value /logout, method RequestMethod.GET)public String logout(RedirectAttributes redirectAttributes) {log.info(【退出登录】 {}, loginAdmin().getUsername());session.removeAttribute(SESSION_ADMIN);redirectAttributes.addFlashAttribute(Constant.ERROR_MESSAGE, 您已安全退出);return redirect:login;}/*** 修改密码** return*/RequestMapping(value /modifyPwd, method {RequestMethod.GET})public String modifyPwd() {return console/modify-pwd;}Operation(修改用户密码)RequestMapping(value /modifyPwd, method {RequestMethod.POST})public String modifyPwd(String pwd, String password, String password2, RedirectAttributes attributes) {if (!password.equals(password2)) {return redirect(/console/modifyPwd, 两次密码不一样, attributes);}Admin user adminService.selectByPrimaryKey(loginAdmin().getId());if (null ! user) {if (!Md5Utils.encode(pwd).equalsIgnoreCase(user.getPassword())) {return redirect(/console/modifyPwd, 原密码错误, attributes);}String newPassword Md5Utils.encode(password);user.setPassword(newPassword);adminService.updateByPrimaryKeySelective(user);return redirect(/console/modifyPwd, 修改成功, attributes);} else {return redirect(/console/modifyPwd, 用户不存在修改失败, attributes);}}/*** 首页展示数据** return*/private MapString, Object getTotal() {Integer userCount userService.selectCount(new User());MapString, Object mp new HashMap(4);mp.put(userCount, userCount);mp.put(roomCount, roomService.selectCount(new Room()));mp.put(floorCount, floorService.selectCount(new Floor()));return mp;}} 大家点赞、收藏、关注、评论啦 、点开下方卡片关注后回复 106