作者主页:Java毕设网
简介: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)
}