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/ 登录

运行截图

相关代码

 登录控制器

@Controller
@RequestMapping("/Login")
public class Login {
	
	@Autowired
	private UserService userService;
	
	@Autowired
	private StayRegisterService stayRegisterService;
	
	@RequestMapping("/tologin")
	public String tologin(){
		return "/login/login";
	}
	
	@RequestMapping("/tomain")
	public ModelAndView tomain(UserPo user){
		ModelAndView mv=null;
		double zongFeiYongOne=0;
		double zongFeiYongTwo=0;
		UserPo u=userService.selectLogin(user);
		List<StayRegisterPo> list=stayRegisterService.selectAll();
		for (int i = 0; i < list.size(); i++) {
			if (list.get(i).getReceiveTargetID()==2) {
				zongFeiYongOne+=list.get(i).getSumConst();
			}else {
				zongFeiYongTwo+=list.get(i).getSumConst();
			}
		}
		
		if (u!=null) {
			mv=new ModelAndView("/main/main");
		}else {
			mv=new ModelAndView("/login/login");
		}
		mv.addObject("zongFeiYongOne",zongFeiYongOne);
		mv.addObject("zongFeiYongTwo",zongFeiYongTwo);
		return mv;
	}
	

}

房间控制器

@Controller
@RequestMapping("/RoomSet")
public class RoomSet {
	
	@Autowired
	private AttributeService attributeService;
	
	@Autowired
	private RoomSetService roomSetService;
	
/*	@RequestMapping("/tolist")
	public ModelAndView tolist(){
		ModelAndView mv=null;
		List<RoomSetPo> list=roomSetService.selectAll();
		mv=new ModelAndView("/roomset/roomset");
		mv.addObject("list",list);
		return mv;
	}*/
	
	//分页和模糊查询
	@RequestMapping("/tolist")
	public ModelAndView list(HttpServletRequest request,Integer currentPage,String txtname){
		ModelAndView mv=null;
		mv=new ModelAndView("/roomset/roomset");
		Page<RoomSetPo> vo=new Page<RoomSetPo>();
		if (currentPage==null) {
			currentPage=1;
		}else if (currentPage==0) {
			currentPage=1;
		}
		if(txtname==null)
		{
			txtname="";
		}
		vo.setCurrentPage(currentPage);
		vo=this.roomSetService.pageFuzzyselect(txtname, vo);
		mv.addObject("list",vo);
		mv.addObject("txtname",txtname);
		return mv;
	}
	

	@RequestMapping("/toadd")
	public ModelAndView toadd(){
		ModelAndView mv=null;
		List<AttributePo> listOne=attributeService.selectGuestRoomLevel();
		List<AttributePo> listTwo=attributeService.selectRoomState();
		mv=new ModelAndView("/roomset/add");
		mv.addObject("listOne",listOne);
		mv.addObject("listTwo",listTwo);
		return mv;
	}
	
	@RequestMapping("/add")
	public ModelAndView add(RoomSetPo roomSetPo){
		ModelAndView mv=null;
		roomSetService.insertAll(roomSetPo);
		mv=new ModelAndView("redirect:/RoomSet/tolist.do");
		return mv;
	}
	
	@RequestMapping("/toupdate")
	public ModelAndView toupdate(int id){
		ModelAndView mv=null;
		List<AttributePo> listOne=attributeService.selectGuestRoomLevel();
		List<AttributePo> listTwo=attributeService.selectRoomState();
		RoomSetPo listPo=roomSetService.selectById(id);
		mv=new ModelAndView("/roomset/update");
		mv.addObject("listOne",listOne);
		mv.addObject("listTwo",listTwo);
		mv.addObject("listPo",listPo);
		return mv;
	}
	
	@RequestMapping("/update")
	public ModelAndView update(RoomSetPo roomSetPo){
		ModelAndView mv=null;
		roomSetService.updateById(roomSetPo);
		mv=new ModelAndView("redirect:/RoomSet/tolist.do");
		return mv;
	}
	
	@RequestMapping("/delete")
	public ModelAndView delete(String id){
		ModelAndView mv=null;
		String[] FenGe=id.split(",");
		for (int i = 0; i < FenGe.length; i++) {
			roomSetService.deleteById(Integer.parseInt(FenGe[i]));
		}
		mv=new ModelAndView("redirect:/RoomSet/tolist.do");
		return mv;
	}
	
	
	
	@ResponseBody
	@RequestMapping(value="/YZ")
	public Object YZ(String roomNumber){
		int YorN=roomSetService.selectYZ(roomNumber);
		Gson gson =new Gson();
		return gson.toJson(YorN);
	}
	
	javascript:void(0)
}

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

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

夜未央5788

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值