(免费分享)基于ssm酒店管理系统

编程入门 行业动态 更新时间:2024-10-09 13:21:09

(免费分享)基于ssm<a href=https://www.elefans.com/category/jswz/34/1732815.html style=酒店管理系统"/>

(免费分享)基于ssm酒店管理系统

源码获取:关注文末gongzhonghao,输入008领取下载链接
1、项目简述
该项目包含前后端,普通用户登录前台系统可以房间预订,管理员可以登录后台管理系统维护酒店相关信息,并且可以设置多个角色进行管理酒店。
后台包含以下模块:房间管理、楼层管理、房型管理、订单管理、入住管理、营业额报表、
菜单管理、员工管理、角色管理、预订报表、开放报表
图片上传之后需要把D:\project\hotel下的文件夹放在项目文件下这样图就展示啦,正式环境肯定要搭建一个文件服务器的,课设那就存本地了
2、运行环境
Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)
项目技术:
JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui等等
3、项目访问
前台访问地址:http://localhost:8080/index.html 用户名: zhangsan 密码: 123456
后台访问地址: http://localhost:8080/admin/login.html 用户名: admin 密码: admin

 

 

 

 

 

 

 

 

package com.song.controller;import com.song.pojo.Room;
import com.song.pojo.RoomType;
import com.song.service.RoomService;
import com.song.service.RoomTypeService;
import com.song.vo.RoomVo;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;import javax.annotation.Resource;
import java.util.List;/*** @author 宋超* HP - the login name of the current user.* 2020/12/28 - the current system date.* 16:27 - the current system time.*/
@Controller
@RequestMapping("/room")
public class RoomController {@Resourceprivate RoomService roomService;@Resourceprivate RoomTypeService roomTypeService;/*** 查询房间详情* @param id* @param model* @return*/@RequestMapping("/{id}.html")public String detail(@PathVariable Integer id, Model model){//调用查询房间详情的方法Room room = roomService.findById(id);//将数据放到模型中model.addAttribute("room",room);return "detail";}/*** 查询全部房间列表* @param model* @return*/@RequestMapping("/list.html")public String list(Model model){//调用查询所有房型列表的方法List<RoomType> roomTypeList = roomTypeService.findRoomTypeList(null);//创建查询条件类RoomVo roomVo = new RoomVo();roomVo.setStatus(3);//可预订//查询房间列表List<Room> roomList = roomService.findRoomListByPage(roomVo);//将数据放到模型中model.addAttribute("roomTypeList",roomTypeList);model.addAttribute("roomList",roomList);return "hotelList";}/*** 根据房型查询房间列表* @param model* @return*/@RequestMapping("/list/{id}")public String list(@PathVariable Integer id,Model model){//调用查询所有房型列表的方法List<RoomType> roomTypeList = roomTypeService.findRoomTypeList(null);//创建查询条件类RoomVo roomVo = new RoomVo();roomVo.setRoomtypeid(id);//房型IDroomVo.setStatus(3);//可预订//查询房间列表List<Room> roomList = roomService.findRoomListByPage(roomVo);//将数据放到模型中model.addAttribute("roomTypeList",roomTypeList);model.addAttribute("roomList",roomList);model.addAttribute("typeId",id);//将当前选中的房型ID保存到模型中,目的是在页面中回显选中的文本(改变选中的颜色)return "hotelList";}
}

package com.song.controller;

import com.alibaba.fastjson.JSON;
import com.song.dao.UserMapper;
import com.song.pojo.User;
import com.song.service.UserService;
import com.song.utils.SystemConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;

/**
 * @author 宋超
 * HP - the login name of the current user.
 * 2020/12/27 - the current system date.
 * 16:36 - the current system time.
 */
@Controller
@RequestMapping("/user")
public class UserController {
    
    @Autowired
    private UserService userService;

    /**
     * 注册
     * @param user
     * @return
     */
    @RequestMapping("/register")
    @ResponseBody
    public String register(User user){
        Map<String,Object> map = new HashMap<String,Object>();
        //调用注册的方法
        if(userService.addUser(user)>0){
            map.put(SystemConstant.SUCCESS,true);
            map.put(SystemConstant.MESSAGE,"恭喜你,注册成功!");
        }else{
            map.put(SystemConstant.SUCCESS,false);
            map.put(SystemConstant.MESSAGE,"很遗憾,注册失败,请重新尝试!");
        }
        return JSON.toJSONString(map);
    }

    /**
     * 登录
     * @param
     * @return
     */
    @RequestMapping("/login")
    @ResponseBody
    public String login(String loginName, String password, HttpSession Session){
        Map<String,Object> map = new HashMap<String,Object>();

        //调用注册的方法
        User loginUser = userService.login(loginName, password);

        //登录判断
        if(loginUser!=null){
            //将密码清空
            loginUser.setPassword(null);
            map.put(SystemConstant.SUCCESS,true);
            //保存登录用户信息到session中
            Session.setAttribute(SystemConstant.FRONT_LOGIN_USER,loginUser);
        }else{
            map.put(SystemConstant.SUCCESS,false);
            map.put(SystemConstant.MESSAGE,"用户名或密码错误,请重新登录!");
        }
        return JSON.toJSONString(map);
    }

    /**
     * 根据用户名查询用户信息
     * @param loginName
     * @return
     */
    @RequestMapping("/checkName")
    @ResponseBody
    public String checkName(String loginName){
        Map<String,Object> map = new HashMap<String,Object>();
        //调用注册的方法
        if(userService.findUserByName(loginName)!=null){
            map.put(SystemConstant.EXISI,true);
            map.put(SystemConstant.MESSAGE,"用户名存在,请重新输入");
        }else{
            map.put(SystemConstant.EXISI,false);
        }
        return JSON.toJSONString(map);
    }

}
 

更多推荐

(免费分享)基于ssm酒店管理系统

本文发布于:2024-03-13 00:53:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1732816.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:酒店管理系统   ssm

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!