作者主页:夜未央5788

简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

本项目分为前后台,前台为用户角色登录,后台为管理员角色登录。

管理员角色包含以下功能:

管理员登录,用户管理,客房类型管理,客房信息管理,预订管理,入住信息管理等功能。

用户角色包含以下功能:
用户首页,查看客房,客房预订,查看客房评价,酒店客房评价等功能。

环境需要

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/8.0版本均可;
6.是否Maven项目:是;

技术栈

1. 后端:Spring+SpringMVC+Mybatis

2. 前端:JSP+CSS+JavaScript+jquery+bootstrap

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入http://localhost:8080/user_main.html 登录前台
用户账号/密码: user/123456

后台管理地址:http://localhost:8080/
管理员账号/密码:admin/123456

运行截图

前台界面-用户角色

后台界面-管理员角色

相关代码

CommentController

package cn.edu.glut.jiudian.controller;import cn.edu.glut.jiudian.entity.Comment;
import cn.edu.glut.jiudian.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;import java.util.HashMap;
import java.util.List;/*** @author stone(huangshizhang) at 2019-06-11 15:59*/
@Controller
public class CommentController {@Autowiredprivate CommentService commentService;private  List<Comment> commentList = null;private  List<Comment> geRoomComment = null;@RequestMapping("roomCommentList")@ResponseBodypublic Object roomCommentList(@RequestParam("roomId") String roomId){commentList = commentService.getRoomComment(roomId);//HashMap<String, List<Comment>> res = new HashMap<>();//res.put("commentList", commentList);return "1";}@RequestMapping("geRoomComment")@ResponseBodypublic Object geRoomComment(@RequestParam("roomId") String roomId){geRoomComment = commentService.getRoomComment(roomId);//HashMap<String, List<Comment>> res = new HashMap<>();//res.put("commentList", commentList);return "1";}@RequestMapping("comment_management.html")public ModelAndView commentManagement(){ModelAndView mav = new ModelAndView("comment_management");mav.addObject("commentList", geRoomComment);return mav;}@RequestMapping("room_comment.html")public ModelAndView modalRoomComment(){ModelAndView mav = new ModelAndView("room_comment");mav.addObject("commentList", commentList);return mav;}@RequestMapping("addRoomComment")@ResponseBodypublic Object addRoomComment(Comment comment){comment.setReleaseTime(new java.sql.Date(new java.util.Date().getTime()));HashMap<String, String> res = new HashMap<>();if (commentService.addComment(comment)) {res.put("stateCode", "1");} else {res.put("stateCode", "0");}return res;}@RequestMapping("write_comment.html")public ModelAndView writeComment(){return new ModelAndView("write_comment");}@RequestMapping("deleteComment")@ResponseBodypublic Object deleteComment(@RequestParam("serNum") Integer serNum, @RequestParam("roomId") String roomId){Comment comment = new Comment();comment.setSerNum(serNum);comment.setContent("");HashMap<String, List<Comment>> res = new HashMap<>();if (commentService.updateByPrimaryKey(comment)) {List<Comment> commentList1 = commentService.getRoomComment(roomId);res.put("commentList", commentList1);return res;} else {return false;}}
}

登录控制器

package cn.edu.glut.jiudian.controller;import cn.edu.glut.jiudian.entity.Admin;
import cn.edu.glut.jiudian.entity.User;
import cn.edu.glut.jiudian.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
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.ModelAndView;import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;/*** @author stone(huangshizhang) at 2019-06-04 09:37*/@Controller
public class LoginController {@Autowiredprivate LoginService loginService;@RequestMapping(value = {"/","adminLogin.html"})public ModelAndView toAdminLogin(HttpServletRequest request) {request.getSession().invalidate();return new ModelAndView("index");}@RequestMapping("adminLogout.html")public String adminLogout(HttpServletRequest request) {request.getSession().invalidate();return "redirect:adminLogin.html";}@RequestMapping(value = {"userLogin.html"})public ModelAndView toUserLogin(HttpServletRequest request) {request.getSession().invalidate();return new ModelAndView("user_main");}@RequestMapping("userLogout.html")public String userLogout(HttpServletRequest request) {request.getSession().invalidate();return "redirect:userLogin.html";}@RequestMapping(value = "/adminLoginCheck", method = RequestMethod.POST)@ResponseBodypublic Object adminLoginCheck(HttpServletRequest request, Admin admin){Admin admin1 = loginService.selectAdmin(admin.getAdminName(), admin.getAdminPwd());HashMap<String, String> res = new HashMap<>();if (admin1 != null){request.getSession().setAttribute("admin", admin1);res.put("stateCode", "1");return res;}else {res.put("stateCode", "0");}return res;}@RequestMapping(value = "/userLoginCheck", method = RequestMethod.POST)@ResponseBodypublic Object userLoginCheck(HttpServletRequest request, User user){User user1 = loginService.selectUser(user.getUserName(), user.getUserPwd());HashMap<String, String> res = new HashMap<>();if (user1 != null){request.getSession().setAttribute("user", user1);res.put("stateCode", "1");return res;}else {res.put("stateCode", "0");}return res;}@RequestMapping("admin_main.html")public ModelAndView adminMain(){return new ModelAndView("admin_main");}@RequestMapping("userRegister")@ResponseBodypublic Object userRegister(User user){HashMap<String, String> res = new HashMap<>();if (loginService.selectUserByName(user.getUserName()) > 0){res.put("registerState", "2");} else {if (loginService.addUser(user)) {res.put("registerState", "1");} else {res.put("registerState", "0");}}return res;}}

订单控制器

package cn.edu.glut.jiudian.controller;import cn.edu.glut.jiudian.entity.Order;
import cn.edu.glut.jiudian.entity.Room;
import cn.edu.glut.jiudian.service.OrderService;
import cn.edu.glut.jiudian.service.RoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;import java.util.HashMap;
import java.util.List;/*** @author stone(huangshizhang) at 2019-06-13 19:55*/
@Controller
public class OrderController {@Autowiredprivate OrderService orderService;@Autowiredprivate RoomService roomService;private Order checkout;@RequestMapping("ruzhu_management.html")public ModelAndView ruzhuManagement(){List<Order> orderList = orderService.selectAll();ModelAndView mav = new ModelAndView("ruzhu_management");mav.addObject("orderList", orderList);return mav;}@RequestMapping("addPayment")@ResponseBodypublic Object addPayment(Order order){order.setEndTime(new java.sql.Date(new java.util.Date().getTime()));HashMap<String, String> res = new HashMap<>();if (orderService.updateByRoomId(order)) {res.put("stateCode", "1");} else {res.put("stateCode", "0");}return res;}@RequestMapping("checkout")@ResponseBodypublic Object checkout(@RequestParam("roomId") String roomId){checkout = orderService.selectByRoomId(roomId);return true;}@RequestMapping("ruzhu_checkout.html")public ModelAndView ruzhuCheckout(){ModelAndView mav = new ModelAndView("ruzhu_checkout");mav.addObject("checkout", checkout);return mav;}@RequestMapping("ruzhu_add.html")public ModelAndView ruzhuAdd(){List<Room> roomList = roomService.selectNotInRuZhu();ModelAndView mav = new ModelAndView("ruzhu_add");mav.addObject("roomList", roomList);return mav;}@RequestMapping("addRuZhu")@ResponseBodypublic Object addRuZhu(Order order){order.setStartTime(new java.sql.Date(new java.util.Date().getTime()));HashMap<String, String> res = new HashMap<>();if (orderService.addOrder(order)) {res.put("stateCode", "1");} else {res.put("stateCode", "0");}return res;}@RequestMapping("deleteRuZhu")@ResponseBodypublic Object deleteRuZhu(@RequestParam("roomId") String roomId){HashMap<String, String> res = new HashMap<>();if (orderService.deleteByRoomId(roomId)) {res.put("stateCode", "1");} else {res.put("stateCode", "0");}return res;}
}

用户控制器

package cn.edu.glut.jiudian.controller;import cn.edu.glut.jiudian.entity.Notice;
import cn.edu.glut.jiudian.entity.Room;
import cn.edu.glut.jiudian.entity.RoomType;
import cn.edu.glut.jiudian.entity.User;
import cn.edu.glut.jiudian.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;import java.util.HashMap;
import java.util.List;/*** @author stone(huangshizhang) at 2019-06-07 20:02*/
@Controller
public class UserController {@Autowiredprivate RoomTypeService roomTypeService;@Autowiredprivate ReserveService reserveService;@Autowiredprivate RoomService roomService;@Autowiredprivate NoticeService noticeService;@Autowiredprivate UserService userService;@RequestMapping("user_main.html")public ModelAndView userMain(){List<RoomType> roomTypeList = roomTypeService.selectAll();ModelAndView mav = new ModelAndView("user_main");mav.addObject("roomTypeList", roomTypeList);List<Room> roomList = roomService.selectAll();mav.addObject("roomList", roomList);List<Notice> noticeList = noticeService.selectAll();mav.addObject("noticeList", noticeList);return mav;}@RequestMapping(value = "room_type.html", method = RequestMethod.GET)public ModelAndView roomType(@RequestParam(value = "typeId") int typeId, @RequestParam(value = "type") String type){List<Room> roomList = reserveService.selectByRoomType(type);ModelAndView mav = new ModelAndView("user_main");mav.addObject("roomList", roomList);return mav;}@RequestMapping("deleteUser")@ResponseBodypublic Object deleteUser(@RequestParam("userName") String userName){HashMap<String, String> res = new HashMap<>();if (userService.deleteUser(userName)){res.put("stateCode", "1");} else {res.put("stateCode", "0");}return res;}@RequestMapping("user_management.html")public ModelAndView toUserInfoManagement(){List<User> userList = userService.selectAll();ModelAndView mav = new ModelAndView("user_management");mav.addObject("userList", userList);return mav;}
}

如果也想学习本系统,下面领取。关注并回复:130ssm

Java项目:SSM酒店客房管理系统相关推荐

  1. 【源码及课件分享】Java实战项目之酒店客房管理系统_Java项目开发_Java项目实战

    Java实战项目又双叒叕来咯~小伙伴们请查收~酒店客房管理系统![源码及课件分享]Java实战项目之酒店客房管理系统_Java项目开发_Java项目实战_Java毕业设计https://www.bil ...

  2. Java项目ssm企业工资管理系统源码

    Java版ssm企业工资管理系统,源码免费分享,需要可私信. 项目技术:jsp+mysql+Spring+mybatis 运行环境:最好是java jdk 1.8,我们在这个平台上运行的.其他版本理论 ...

  3. (精品)基于Web的酒店客房管理系统的设计与实现毕业论文+开题报告+项目源码(SSM)及数据库+查重报告

     源码获取:我的博客资源页面可以下载!!!! 项目名称 (精品)基于Web的酒店客房管理系统的设计与实现毕业论文+开题报告+项目源码(SSM)及数据库+查重报告 视频介绍 (精品)基于Web的酒店客房 ...

  4. java做一个客房管理系统定制_开题报告基于Java的酒店客房管理系统的设计与实现.doc...

    开题报告基于Java的酒店客房管理系统的设计与实现 毕业设计开题报告 课 题 名 称:基于Java的酒店客房管理系统的 设计与实现 姓 名: 班 级: 指 导 教 师: 所 在 系 部: 专 业 名 ...

  5. 基于 SpringBoot+Vue+Java 实现酒店客房管理系统

    文章目录 一.前言介绍 二.系统结构 三.系统详细实现 3.1用户信息管理 3.2会员信息管理 3.3客房信息管理 3.4收藏客房管理 3.5用户入住管理 3.6客房清扫管理 四.部分核心代码 源码下 ...

  6. 基于Java+SQLServer2017实现(Web)酒店客房管理系统【100010327】

    酒店客房管理系统 一. 概述 1.1.数据库课程设计题目 此次程序设计选题为酒店客房管理系统. 1.2.项目背景 随着社会的发展,普通人工酒店客房管理已经难以适应.酒店需要一个信息管理系统对旅客住宿情 ...

  7. 基于javaweb的酒店客房管理系统(java+jsp+html+bootstrap+jquery+servlet+mysql)

    基于javaweb的酒店客房管理系统(java+jsp+html+bootstrap+jquery+servlet+mysql) 运行环境 Java≥8.MySQL≥5.7.Tomcat≥8 开发工具 ...

  8. java做一个客房管理系统定制_Java实现酒店客房管理系统

    本文实例为大家分享了Java实现酒店客房管理系统的具体代码,供大家参考,具体内容如下 LoginFrame.java package loginManage; import java.awt.Colo ...

  9. 基于JAVA+SpringMVC+MYSQL的酒店客房管理系统

    项目功能: 酒店客房管理系统包括普通用户登录注册,管理员登录两种角色,其中用户可以修改密码,预定房间,预定记录查询,管理员可以修改自己密码,用户管理,房间分类管理,客房信息管理,开房管理,退房管理,开 ...

  10. java做一个客房管理系统定制_基于JAVA酒店客房管理系统的设计与实现(JSP,MySQL)(含录像)...

    基于JAVA酒店客房管理系统的设计与实现(JSP,MySQL)(含录像)(毕业论文12000字,程序代码,MySQL数据库) 本酒店管理系统在功能模块主要分为两大方面,即用户功能模块和管理员功能模块. ...

最新文章

  1. 六大重点工程构筑兰州大数据产业
  2. python3.7安装包-Python3.7.6下载
  3. 云上的精准医疗——公有云、私有云案例分析和比较
  4. 【持续..】WEB前端面试知识梳理 - CSS部分
  5. axure如何实现跳转_Axure教程:网易云音乐首页原型设计
  6. 浙江计算机二级报名步骤,浙江2016年9月计算机二级考生报名流程
  7. 使用FormData进行Ajax请求上传文件
  8. ctags的如何生成tags文件
  9. 几种直方图均衡方法汇总
  10. win10 查看版本信息(家庭版 专业版 企业版)
  11. 基于android的手机选课系统的实现
  12. 【ORM】TypeORM 与 Prisma 的详细对比
  13. Pend Lists
  14. 线下活动受阻?打造线上会议方案势在必行
  15. Godot Engine:格斗游戏中的必杀技(大招/绝招/特殊技/Special Move )输入系统实现
  16. 卷积神经网络结构示意图,卷积神经网络的结构图
  17. 老司机揭秘手机定位技术,实在是精彩!
  18. Lucene学习总结
  19. 超人微信投票v6.5.21
  20. DeepARG——一种基于深度学习更加准确预测ARG的方法

热门文章

  1. Android学习教程之idea和海马玩模拟器搭建调试
  2. java实现光盘摆渡_一种光盘摆渡机的制作方法
  3. 字节序Endian与字节序标记BOM详解
  4. medusa详细使用教程
  5. 供应链金融业务信息化平台搭建要点分享
  6. 网站安全防护措施有哪些
  7. 20sccm_sccm是什么单位-简短介绍
  8. 动态Web-JSP和tomcat
  9. 捕捉百合网的女同志和echarts展示
  10. 保护用户隐私 VS 反对不正当竞争