• ssm+mysql实现的JavaWeb酒店管理系统


    作者主页:夜未央5788

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

    文末获取源码

    项目介绍

    本项目为基于ssm+mysql实现的JavaWeb酒店管理系统;
    主要功能包括:

    管理员登录,收入统计,客房管理,商品管理,客房预订,住宿登记,财务统计,旅客管理,接待对象管理等功能。

    环境需要

    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项目:否;

    技术栈

    1. 后端:Spring+SpringMVC+Mybatis

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

    使用说明

    1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
    2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
    若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
    3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置;

    4. 运行项目,输入localhost:8080/ 登录

    运行截图

    相关代码

     登录控制器

    1. @Controller
    2. @RequestMapping("/Login")
    3. public class Login {
    4. @Autowired
    5. private UserService userService;
    6. @Autowired
    7. private StayRegisterService stayRegisterService;
    8. @RequestMapping("/tologin")
    9. public String tologin(){
    10. return "/login/login";
    11. }
    12. @RequestMapping("/tomain")
    13. public ModelAndView tomain(UserPo user){
    14. ModelAndView mv=null;
    15. double zongFeiYongOne=0;
    16. double zongFeiYongTwo=0;
    17. UserPo u=userService.selectLogin(user);
    18. List<StayRegisterPo> list=stayRegisterService.selectAll();
    19. for (int i = 0; i < list.size(); i++) {
    20. if (list.get(i).getReceiveTargetID()==2) {
    21. zongFeiYongOne+=list.get(i).getSumConst();
    22. }else {
    23. zongFeiYongTwo+=list.get(i).getSumConst();
    24. }
    25. }
    26. if (u!=null) {
    27. mv=new ModelAndView("/main/main");
    28. }else {
    29. mv=new ModelAndView("/login/login");
    30. }
    31. mv.addObject("zongFeiYongOne",zongFeiYongOne);
    32. mv.addObject("zongFeiYongTwo",zongFeiYongTwo);
    33. return mv;
    34. }
    35. }

    房间控制器

    1. @Controller
    2. @RequestMapping("/RoomSet")
    3. public class RoomSet {
    4. @Autowired
    5. private AttributeService attributeService;
    6. @Autowired
    7. private RoomSetService roomSetService;
    8. /* @RequestMapping("/tolist")
    9. public ModelAndView tolist(){
    10. ModelAndView mv=null;
    11. List<RoomSetPo> list=roomSetService.selectAll();
    12. mv=new ModelAndView("/roomset/roomset");
    13. mv.addObject("list",list);
    14. return mv;
    15. }*/
    16. //分页和模糊查询
    17. @RequestMapping("/tolist")
    18. public ModelAndView list(HttpServletRequest request,Integer currentPage,String txtname){
    19. ModelAndView mv=null;
    20. mv=new ModelAndView("/roomset/roomset");
    21. Page<RoomSetPo> vo=new Page<RoomSetPo>();
    22. if (currentPage==null) {
    23. currentPage=1;
    24. }else if (currentPage==0) {
    25. currentPage=1;
    26. }
    27. if(txtname==null)
    28. {
    29. txtname="";
    30. }
    31. vo.setCurrentPage(currentPage);
    32. vo=this.roomSetService.pageFuzzyselect(txtname, vo);
    33. mv.addObject("list",vo);
    34. mv.addObject("txtname",txtname);
    35. return mv;
    36. }
    37. @RequestMapping("/toadd")
    38. public ModelAndView toadd(){
    39. ModelAndView mv=null;
    40. List<AttributePo> listOne=attributeService.selectGuestRoomLevel();
    41. List<AttributePo> listTwo=attributeService.selectRoomState();
    42. mv=new ModelAndView("/roomset/add");
    43. mv.addObject("listOne",listOne);
    44. mv.addObject("listTwo",listTwo);
    45. return mv;
    46. }
    47. @RequestMapping("/add")
    48. public ModelAndView add(RoomSetPo roomSetPo){
    49. ModelAndView mv=null;
    50. roomSetService.insertAll(roomSetPo);
    51. mv=new ModelAndView("redirect:/RoomSet/tolist.do");
    52. return mv;
    53. }
    54. @RequestMapping("/toupdate")
    55. public ModelAndView toupdate(int id){
    56. ModelAndView mv=null;
    57. List<AttributePo> listOne=attributeService.selectGuestRoomLevel();
    58. List<AttributePo> listTwo=attributeService.selectRoomState();
    59. RoomSetPo listPo=roomSetService.selectById(id);
    60. mv=new ModelAndView("/roomset/update");
    61. mv.addObject("listOne",listOne);
    62. mv.addObject("listTwo",listTwo);
    63. mv.addObject("listPo",listPo);
    64. return mv;
    65. }
    66. @RequestMapping("/update")
    67. public ModelAndView update(RoomSetPo roomSetPo){
    68. ModelAndView mv=null;
    69. roomSetService.updateById(roomSetPo);
    70. mv=new ModelAndView("redirect:/RoomSet/tolist.do");
    71. return mv;
    72. }
    73. @RequestMapping("/delete")
    74. public ModelAndView delete(String id){
    75. ModelAndView mv=null;
    76. String[] FenGe=id.split(",");
    77. for (int i = 0; i < FenGe.length; i++) {
    78. roomSetService.deleteById(Integer.parseInt(FenGe[i]));
    79. }
    80. mv=new ModelAndView("redirect:/RoomSet/tolist.do");
    81. return mv;
    82. }
    83. @ResponseBody
    84. @RequestMapping(value="/YZ")
    85. public Object YZ(String roomNumber){
    86. int YorN=roomSetService.selectYZ(roomNumber);
    87. Gson gson =new Gson();
    88. return gson.toJson(YorN);
    89. }
    90. javascript:void(0)
    91. }

    如果也想学习本系统,下面领取。回复:145ssm

  • 相关阅读:
    进行基于fluent的山地风场仿真模拟与深度学习卷积神经网络结合的流场预测与误差评估
    Rust中的函数指针
    HTTP 与 HTTPS-HTTP 与 HTTPS 有哪些区别?
    电脑桌面便签工具选择哪一款?
    tensorflow2.0 mnist手写数字识别 并验证几张图片以查看效果
    Linux查看日志常用命令
    JMeter VS RunnerGo :两大主流性能测试工具对比
    (1)设计模式之责任链模式
    系统移植——开发阶段部署
    STM32F103标准库硬件IIC+DMA连续数据发送、接收
  • 原文地址:https://blog.csdn.net/hanyunlong1989/article/details/125472162