酒店管理系统(java+ssm+maven+layui+mysql+jsp)"/>
基于javaweb+mysql的ssm+maven酒店管理系统(java+ssm+maven+layui+mysql+jsp)
基于javaweb+mysql的ssm+maven酒店管理系统(java+ssm+maven+layui+mysql+jsp)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM+Maven酒店管理系统(java+ssm+maven+layui+mysql+jsp)
酒店管理系统-温情小筑后台管理系统
系统概要
项目主要功能包括: 住客管理:住客入住、住客列表; 房间管理:房间列表、添加房间、修改房间状态; 会员管理:新增会员、会员列表; 系统设置:网站信息、修改密码、清除缓存; 数据表:生成Excel并导出等功能,适合java新手学习;
技术选型
1.后台技术选型:SSM(Spring SpringMVC Mybatis)
2.前端技术选型:LayUI
开发环境
1.编程语言:Java 2.开发工具:IDEA/Eclipse、Navicat 3.项目构建:Maven 3.5.2 4.服务器:Tomcat 8.0及以上
5.数据库:MySQL5.7
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置; 3. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行; 4. 运行项目,输入localhost:8080/ 登录
运行
导入项目并运行成功后,在tomcat路径中设置为/,注意路径中不要带有项目名,否则会导致项目运行异常;
@RequestMapping("/update1")public ModelAndView update1(int id){ModelAndView mv = new ModelAndView();Guests guests = guestsService.queryGuestsById(id);mv.addObject("g",guests);mv.setViewName("guests_update");return mv;}@RequestMapping("/update2")public String update2(Guests g ){guestsService.updateGuestsById(g);return ("redirect:/guests/list");}@RequestMapping("/find")public ModelAndView find(String findByPhone){ModelAndView mv = new ModelAndView();Guests guests = guestsService.queryGuestsByPhone(findByPhone);List<Guests> guestsList=new ArrayList<Guests>();guestsList.add(guests);if (guests==null){guestsList=guestsService.queryAllGuests();mv.addObject("error","未查询出结果");}mv.addObject("list",guestsList);mv.setViewName("guests_list");return mv;}
}@Controller
@RequestMapping("/vip")
public class VipController {@Autowired
@RequestMapping("/vip")public void excel_vip(HttpServletResponse response )throws IOException {response.setCharacterEncoding("UTF-8");List<Vip> vipList=vipService.queryAllVip();//创建excel文件HSSFWorkbook wb = new HSSFWorkbook();//创建sheet页HSSFSheet sheet = wb.createSheet("会员信息");//创建标题行HSSFRow titleRow = sheet.createRow(0);titleRow.createCell(0).setCellValue("编号");titleRow.createCell(1).setCellValue("姓名");titleRow.createCell(2).setCellValue("性别");titleRow.createCell(3).setCellValue("身份证号");titleRow.createCell(4).setCellValue("手机号");titleRow.createCell(5).setCellValue("会员类型");titleRow.createCell(6).setCellValue("开通时间");titleRow.createCell(7).setCellValue("到期时间");for(Vip vip:vipList){HSSFRow dataRow = sheet.createRow(sheet.getLastRowNum()+1);dataRow.createCell(0).setCellValue(vip.getId());dataRow.createCell(1).setCellValue(vip.getName());dataRow.createCell(2).setCellValue(vip.getSex());dataRow.createCell(3).setCellValue(vip.getCard());dataRow.createCell(4).setCellValue(vip.getPhone());dataRow.createCell(5).setCellValue(vip.getV_Type());dataRow.createCell(6).setCellValue(vip.getStartTime());dataRow.createCell(7).setCellValue(vip.getEndTime());}// 设置下载时客户端Excel的名称response.setContentType("application/octet-stream;charset=utf-8");response.setHeader("Content-Disposition", "attachment;filename="+ new String("客户会员名单".getBytes(),"iso-8859-1") + ".xls");OutputStream ouputStream = response.getOutputStream();wb.write(ouputStream);ouputStream.flush();ouputStream.close();}}
return "vip_add";}@RequestMapping("/home_add")public String home(){return "home_add";}@RequestMapping("/pwd_update")public String pwd(){return "pwd_update";}@RequestMapping("/excel_down")public String excel(){return "excel_down";}@RequestMapping("/web_cache")public String cache(){return "web_cache";}@RequestMapping("/web_index")public String web_index(){return "web_index";}@RequestMapping("/index")public String index(){return "index";}@RequestMapping("/exit")public String exit(){return "exit";}}@Controller
@RequestMapping("/admin")public class AdminController {
response.setContentType("application/octet-stream;charset=utf-8");response.setHeader("Content-Disposition", "attachment;filename="+ new String("房间信息表".getBytes(),"iso-8859-1") + ".xls");OutputStream ouputStream = response.getOutputStream();wb.write(ouputStream);ouputStream.flush();ouputStream.close();}@RequestMapping("/vip")public void excel_vip(HttpServletResponse response )throws IOException {response.setCharacterEncoding("UTF-8");List<Vip> vipList=vipService.queryAllVip();//创建excel文件HSSFWorkbook wb = new HSSFWorkbook();//创建sheet页HSSFSheet sheet = wb.createSheet("会员信息");//创建标题行HSSFRow titleRow = sheet.createRow(0);titleRow.createCell(0).setCellValue("编号");titleRow.createCell(1).setCellValue("姓名");titleRow.createCell(2).setCellValue("性别");titleRow.createCell(3).setCellValue("身份证号");titleRow.createCell(4).setCellValue("手机号");titleRow.createCell(5).setCellValue("会员类型");titleRow.createCell(6).setCellValue("开通时间");titleRow.createCell(7).setCellValue("到期时间");for(Vip vip:vipList){HSSFRow dataRow = sheet.createRow(sheet.getLastRowNum()+1);dataRow.createCell(0).setCellValue(vip.getId());dataRow.createCell(1).setCellValue(vip.getName());dataRow.createCell(2).setCellValue(vip.getSex());dataRow.createCell(3).setCellValue(vip.getCard());dataRow.createCell(4).setCellValue(vip.getPhone());dataRow.createCell(5).setCellValue(vip.getV_Type());dataRow.createCell(6).setCellValue(vip.getStartTime());dataRow.createCell(7).setCellValue(vip.getEndTime());}// 设置下载时客户端Excel的名称response.setContentType("application/octet-stream;charset=utf-8");response.setHeader("Content-Disposition", "attachment;filename="+ new String("客户会员名单".getBytes(),"iso-8859-1") + ".xls");OutputStream ouputStream = response.getOutputStream();wb.write(ouputStream);
return ("redirect:/vip/list");}@RequestMapping("/find")public ModelAndView find(String findByPhone ){ModelAndView mv = new ModelAndView();Vip vip = vipService.queryVipByPhone(findByPhone);List<Vip> vipList=new ArrayList<Vip>();vipList.add(vip);if (vip==null){vipList=vipService.queryAllVip();mv.addObject("error","未查询出结果");}mv.addObject("list",vipList);mv.setViewName("vip_list");return mv;}
}@Controller
@RequestMapping("jump")
public class JumpController {@RequestMapping("/guests_add")public String guest(){return "guests_add";}@RequestMapping("/vip_add")public String vip(){return "vip_add";}@RequestMapping("/home_add")public String home(){return "home_add";
titleRow.createCell(2).setCellValue("房间类型");titleRow.createCell(3).setCellValue("价格");titleRow.createCell(4).setCellValue("状态");titleRow.createCell(5).setCellValue("描述");//获取需要下载表对应的pojo类for(Home home:homeList){HSSFRow dataRow = sheet.createRow(sheet.getLastRowNum()+1);dataRow.createCell(0).setCellValue(home.getId());dataRow.createCell(1).setCellValue(home.getNum());dataRow.createCell(2).setCellValue(home.getH_Type());dataRow.createCell(3).setCellValue(home.getPrice());dataRow.createCell(4).setCellValue(home.getState());dataRow.createCell(5).setCellValue(home.getText());}// 设置下载时客户端Excel的名称response.setContentType("application/octet-stream;charset=utf-8");response.setHeader("Content-Disposition", "attachment;filename="+ new String("房间信息表".getBytes(),"iso-8859-1") + ".xls");OutputStream ouputStream = response.getOutputStream();wb.write(ouputStream);ouputStream.flush();ouputStream.close();}@RequestMapping("/vip")public void excel_vip(HttpServletResponse response )throws IOException {response.setCharacterEncoding("UTF-8");List<Vip> vipList=vipService.queryAllVip();//创建excel文件HSSFWorkbook wb = new HSSFWorkbook();//创建sheet页HSSFSheet sheet = wb.createSheet("会员信息");//创建标题行HSSFRow titleRow = sheet.createRow(0);titleRow.createCell(0).setCellValue("编号");titleRow.createCell(1).setCellValue("姓名");titleRow.createCell(2).setCellValue("性别");titleRow.createCell(3).setCellValue("身份证号");
mv.addObject("g",guests);mv.setViewName("guests_update");return mv;}@RequestMapping("/update2")public String update2(Guests g ){guestsService.updateGuestsById(g);return ("redirect:/guests/list");}@RequestMapping("/find")public ModelAndView find(String findByPhone){ModelAndView mv = new ModelAndView();Guests guests = guestsService.queryGuestsByPhone(findByPhone);List<Guests> guestsList=new ArrayList<Guests>();guestsList.add(guests);if (guests==null){guestsList=guestsService.queryAllGuests();mv.addObject("error","未查询出结果");}mv.addObject("list",guestsList);mv.setViewName("guests_list");return mv;}
}@Controller
@RequestMapping("/vip")
public class VipController {@AutowiredVipServiceImpl vipService;
dataRow.createCell(0).setCellValue(vip.getId());dataRow.createCell(1).setCellValue(vip.getName());dataRow.createCell(2).setCellValue(vip.getSex());dataRow.createCell(3).setCellValue(vip.getCard());dataRow.createCell(4).setCellValue(vip.getPhone());dataRow.createCell(5).setCellValue(vip.getV_Type());dataRow.createCell(6).setCellValue(vip.getStartTime());dataRow.createCell(7).setCellValue(vip.getEndTime());}// 设置下载时客户端Excel的名称response.setContentType("application/octet-stream;charset=utf-8");response.setHeader("Content-Disposition", "attachment;filename="+ new String("客户会员名单".getBytes(),"iso-8859-1") + ".xls");OutputStream ouputStream = response.getOutputStream();wb.write(ouputStream);ouputStream.flush();ouputStream.close();}}@Controller
@RequestMapping("/guests")
public class GuestsController {@AutowiredGuestsServiceImpl guestsService;
return mv;}@RequestMapping("/update2")public String update2(Vip v){vipService.updateVipById(v);return ("redirect:/vip/list");}@RequestMapping("/find")public ModelAndView find(String findByPhone ){ModelAndView mv = new ModelAndView();Vip vip = vipService.queryVipByPhone(findByPhone);List<Vip> vipList=new ArrayList<Vip>();vipList.add(vip);if (vip==null){vipList=vipService.queryAllVip();mv.addObject("error","未查询出结果");}mv.addObject("list",vipList);mv.setViewName("vip_list");return mv;}
}@Controller
@RequestMapping("jump")
public class JumpController {@RequestMapping("/guests_add")public String guest(){return "guests_add";}@RequestMapping("/vip_add")public String vip(){return "vip_add";}@RequestMapping("/home_add")public String home(){return "home_add";}@RequestMapping("/pwd_update")public String pwd(){return "pwd_update";}
@RequestMapping("/excel")
public class ExcelController {@AutowiredHomeServiceImpl homeService;@AutowiredVipServiceImpl vipService;@RequestMapping("/home")public void excel_home(HttpServletResponse response )throws IOException {response.setCharacterEncoding("UTF-8");List<Home> homeList=homeService.queryAllHome();//创建excel文件HSSFWorkbook wb = new HSSFWorkbook();//创建sheet页HSSFSheet sheet = wb.createSheet("房间信息");//创建标题行HSSFRow titleRow = sheet.createRow(0);titleRow.createCell(0).setCellValue("编号");titleRow.createCell(1).setCellValue("房间号");titleRow.createCell(2).setCellValue("房间类型");titleRow.createCell(3).setCellValue("价格");titleRow.createCell(4).setCellValue("状态");titleRow.createCell(5).setCellValue("描述");//获取需要下载表对应的pojo类for(Home home:homeList){HSSFRow dataRow = sheet.createRow(sheet.getLastRowNum()+1);dataRow.createCell(0).setCellValue(home.getId());dataRow.createCell(1).setCellValue(home.getNum());dataRow.createCell(2).setCellValue(home.getH_Type());dataRow.createCell(3).setCellValue(home.getPrice());dataRow.createCell(4).setCellValue(home.getState());dataRow.createCell(5).setCellValue(home.getText());}// 设置下载时客户端Excel的名称response.setContentType("application/octet-stream;charset=utf-8");response.setHeader("Content-Disposition", "attachment;filename="+ new String("房间信息表".getBytes(),"iso-8859-1") + ".xls");OutputStream ouputStream = response.getOutputStream();wb.write(ouputStream);ouputStream.flush();ouputStream.close();}@RequestMapping("/vip")public void excel_vip(HttpServletResponse response )throws IOException {
ModelAndView mv = new ModelAndView();List<Vip> vipList=vipService.queryAllVip();mv.addObject("list",vipList);mv.setViewName("vip_list");return mv;}@RequestMapping("/update1")public ModelAndView update1(int id){ModelAndView mv = new ModelAndView();Vip vip = vipService.queryVipById(id);mv.addObject("v",vip);mv.setViewName("vip_update");return mv;}@RequestMapping("/update2")public String update2(Vip v){vipService.updateVipById(v);return ("redirect:/vip/list");}@RequestMapping("/find")public ModelAndView find(String findByPhone ){ModelAndView mv = new ModelAndView();Vip vip = vipService.queryVipByPhone(findByPhone);List<Vip> vipList=new ArrayList<Vip>();vipList.add(vip);if (vip==null){vipList=vipService.queryAllVip();mv.addObject("error","未查询出结果");}mv.addObject("list",vipList);mv.setViewName("vip_list");return mv;}
}
response.setCharacterEncoding("UTF-8");List<Home> homeList=homeService.queryAllHome();//创建excel文件HSSFWorkbook wb = new HSSFWorkbook();//创建sheet页HSSFSheet sheet = wb.createSheet("房间信息");//创建标题行HSSFRow titleRow = sheet.createRow(0);titleRow.createCell(0).setCellValue("编号");titleRow.createCell(1).setCellValue("房间号");titleRow.createCell(2).setCellValue("房间类型");titleRow.createCell(3).setCellValue("价格");titleRow.createCell(4).setCellValue("状态");titleRow.createCell(5).setCellValue("描述");//获取需要下载表对应的pojo类for(Home home:homeList){HSSFRow dataRow = sheet.createRow(sheet.getLastRowNum()+1);dataRow.createCell(0).setCellValue(home.getId());dataRow.createCell(1).setCellValue(home.getNum());dataRow.createCell(2).setCellValue(home.getH_Type());dataRow.createCell(3).setCellValue(home.getPrice());dataRow.createCell(4).setCellValue(home.getState());dataRow.createCell(5).setCellValue(home.getText());}// 设置下载时客户端Excel的名称response.setContentType("application/octet-stream;charset=utf-8");response.setHeader("Content-Disposition", "attachment;filename="+ new String("房间信息表".getBytes(),"iso-8859-1") + ".xls");OutputStream ouputStream = response.getOutputStream();wb.write(ouputStream);ouputStream.flush();ouputStream.close();}@RequestMapping("/vip")public void excel_vip(HttpServletResponse response )throws IOException {response.setCharacterEncoding("UTF-8");List<Vip> vipList=vipService.queryAllVip();//创建excel文件HSSFWorkbook wb = new HSSFWorkbook();//创建sheet页
@Controller
@RequestMapping("/excel")
public class ExcelController {@AutowiredHomeServiceImpl homeService;@AutowiredVipServiceImpl vipService;@RequestMapping("/home")public void excel_home(HttpServletResponse response )throws IOException {response.setCharacterEncoding("UTF-8");List<Home> homeList=homeService.queryAllHome();//创建excel文件HSSFWorkbook wb = new HSSFWorkbook();//创建sheet页HSSFSheet sheet = wb.createSheet("房间信息");//创建标题行HSSFRow titleRow = sheet.createRow(0);titleRow.createCell(0).setCellValue("编号");titleRow.createCell(1).setCellValue("房间号");titleRow.createCell(2).setCellValue("房间类型");titleRow.createCell(3).setCellValue("价格");titleRow.createCell(4).setCellValue("状态");titleRow.createCell(5).setCellValue("描述");//获取需要下载表对应的pojo类for(Home home:homeList){HSSFRow dataRow = sheet.createRow(sheet.getLastRowNum()+1);dataRow.createCell(0).setCellValue(home.getId());dataRow.createCell(1).setCellValue(home.getNum());dataRow.createCell(2).setCellValue(home.getH_Type());dataRow.createCell(3).setCellValue(home.getPrice());dataRow.createCell(4).setCellValue(home.getState());dataRow.createCell(5).setCellValue(home.getText());}// 设置下载时客户端Excel的名称response.setContentType("application/octet-stream;charset=utf-8");response.setHeader("Content-Disposition", "attachment;filename="+ new String("房间信息表".getBytes(),"iso-8859-1") + ".xls");OutputStream ouputStream = response.getOutputStream();wb.write(ouputStream);ouputStream.flush();ouputStream.close();}
response.setCharacterEncoding("UTF-8");List<Vip> vipList=vipService.queryAllVip();//创建excel文件HSSFWorkbook wb = new HSSFWorkbook();//创建sheet页HSSFSheet sheet = wb.createSheet("会员信息");//创建标题行HSSFRow titleRow = sheet.createRow(0);titleRow.createCell(0).setCellValue("编号");titleRow.createCell(1).setCellValue("姓名");titleRow.createCell(2).setCellValue("性别");titleRow.createCell(3).setCellValue("身份证号");titleRow.createCell(4).setCellValue("手机号");titleRow.createCell(5).setCellValue("会员类型");titleRow.createCell(6).setCellValue("开通时间");titleRow.createCell(7).setCellValue("到期时间");for(Vip vip:vipList){HSSFRow dataRow = sheet.createRow(sheet.getLastRowNum()+1);dataRow.createCell(0).setCellValue(vip.getId());dataRow.createCell(1).setCellValue(vip.getName());dataRow.createCell(2).setCellValue(vip.getSex());dataRow.createCell(3).setCellValue(vip.getCard());dataRow.createCell(4).setCellValue(vip.getPhone());dataRow.createCell(5).setCellValue(vip.getV_Type());dataRow.createCell(6).setCellValue(vip.getStartTime());dataRow.createCell(7).setCellValue(vip.getEndTime());}// 设置下载时客户端Excel的名称response.setContentType("application/octet-stream;charset=utf-8");response.setHeader("Content-Disposition", "attachment;filename="+ new String("客户会员名单".getBytes(),"iso-8859-1") + ".xls");OutputStream ouputStream = response.getOutputStream();wb.write(ouputStream);ouputStream.flush();ouputStream.close();}}
@RequestMapping("/home")public void excel_home(HttpServletResponse response )throws IOException {response.setCharacterEncoding("UTF-8");List<Home> homeList=homeService.queryAllHome();//创建excel文件HSSFWorkbook wb = new HSSFWorkbook();//创建sheet页HSSFSheet sheet = wb.createSheet("房间信息");//创建标题行HSSFRow titleRow = sheet.createRow(0);titleRow.createCell(0).setCellValue("编号");titleRow.createCell(1).setCellValue("房间号");titleRow.createCell(2).setCellValue("房间类型");titleRow.createCell(3).setCellValue("价格");titleRow.createCell(4).setCellValue("状态");titleRow.createCell(5).setCellValue("描述");//获取需要下载表对应的pojo类for(Home home:homeList){HSSFRow dataRow = sheet.createRow(sheet.getLastRowNum()+1);dataRow.createCell(0).setCellValue(home.getId());dataRow.createCell(1).setCellValue(home.getNum());dataRow.createCell(2).setCellValue(home.getH_Type());dataRow.createCell(3).setCellValue(home.getPrice());dataRow.createCell(4).setCellValue(home.getState());dataRow.createCell(5).setCellValue(home.getText());}// 设置下载时客户端Excel的名称response.setContentType("application/octet-stream;charset=utf-8");response.setHeader("Content-Disposition", "attachment;filename="+ new String("房间信息表".getBytes(),"iso-8859-1") + ".xls");OutputStream ouputStream = response.getOutputStream();wb.write(ouputStream);ouputStream.flush();ouputStream.close();}@RequestMapping("/vip")public void excel_vip(HttpServletResponse response )throws IOException {response.setCharacterEncoding("UTF-8");List<Vip> vipList=vipService.queryAllVip();
@Controller
@RequestMapping("/guests")
public class GuestsController {@AutowiredGuestsServiceImpl guestsService;@RequestMapping("/add")public ModelAndView add(Guests guests){ModelAndView mv = new ModelAndView();guestsService.addGuests(guests);mv.setViewName("suc_g");return mv;}@RequestMapping("/delete")public String delete(int id){guestsService.deleteGuestsById(id);return "redirect:/guests/list";}@RequestMapping("/list")public ModelAndView list(){ModelAndView mv = new ModelAndView();List<Guests> guestsList=guestsService.queryAllGuests();mv.addObject("list",guestsList);mv.setViewName("guests_list");return mv;}@RequestMapping("/update1")public ModelAndView update1(int id){ModelAndView mv = new ModelAndView();Guests guests = guestsService.queryGuestsById(id);mv.addObject("g",guests);mv.setViewName("guests_update");
response.setCharacterEncoding("UTF-8");List<Vip> vipList=vipService.queryAllVip();//创建excel文件HSSFWorkbook wb = new HSSFWorkbook();//创建sheet页HSSFSheet sheet = wb.createSheet("会员信息");//创建标题行HSSFRow titleRow = sheet.createRow(0);titleRow.createCell(0).setCellValue("编号");titleRow.createCell(1).setCellValue("姓名");titleRow.createCell(2).setCellValue("性别");titleRow.createCell(3).setCellValue("身份证号");titleRow.createCell(4).setCellValue("手机号");titleRow.createCell(5).setCellValue("会员类型");titleRow.createCell(6).setCellValue("开通时间");titleRow.createCell(7).setCellValue("到期时间");for(Vip vip:vipList){HSSFRow dataRow = sheet.createRow(sheet.getLastRowNum()+1);dataRow.createCell(0).setCellValue(vip.getId());dataRow.createCell(1).setCellValue(vip.getName());dataRow.createCell(2).setCellValue(vip.getSex());dataRow.createCell(3).setCellValue(vip.getCard());dataRow.createCell(4).setCellValue(vip.getPhone());dataRow.createCell(5).setCellValue(vip.getV_Type());dataRow.createCell(6).setCellValue(vip.getStartTime());dataRow.createCell(7).setCellValue(vip.getEndTime());}// 设置下载时客户端Excel的名称response.setContentType("application/octet-stream;charset=utf-8");response.setHeader("Content-Disposition", "attachment;filename="+ new String("客户会员名单".getBytes(),"iso-8859-1") + ".xls");OutputStream ouputStream = response.getOutputStream();wb.write(ouputStream);ouputStream.flush();ouputStream.close();}}
更多推荐
基于javaweb+mysql的ssm+maven酒店管理系统(java+ssm+maven+layui+mysql+jsp)
发布评论