——————————DescriptionStart——————————
运行环境 Java≥8、MySQL≥5.7、Tomcat≥8
开发工具 eclipse/idea/myeclipse/sts等均可配置运行
适用 课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM+Maven精品酒店管理系统(java+ssm+mysql+maven+jsp)
一、项目简述
功能:主要功能主要功能会员管理,住客管理,房间管 理,系统管理,以及一些重要数据的展示导出维护等等;
二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等。
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 if (home==null ){ homeList=homeService.queryAllHome(); mv.addObject("error" ,"未查询出结果" ); } mv.addObject("list" ,homeList); mv.setViewName("home_list" ); return mv; } @RequestMapping("/type1") public String type1 (Integer id,Model model) { Home home = homeService.queryHomeById(id); model.addAttribute("h" ,home); return "H_Type_update" ; } @RequestMapping("/type2") public String type2 (Home home) { homeService.updateH_TypeById(home); return "redirect:/home/list" ; } } package com.hotel.controller;@Controller @RequestMapping("/excel") public class ExcelController { @Autowired HomeServiceImpl homeService; @Autowired VipServiceImpl vipService; @RequestMapping("/home")
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 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; } } package com.hotel.controller;@Controller @RequestMapping("/vip") public class VipController { @Autowired VipServiceImpl vipService; @RequestMapping("/add") public ModelAndView add (Vip vip) { ModelAndView mv = new ModelAndView(); vipService.addVip(vip); mv.setViewName("suc_v" ); return mv; } @RequestMapping("/delete") public String delete (int id) {
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 public class HomeController { @Autowired HomeServiceImpl homeService; @RequestMapping("/add") public String add (Home home, Model model,HttpServletRequest request) throws IOException { String sqlPath = null ; String localPath= request.getServletContext().getRealPath("/upload/" ); File filePath = new File(localPath); if (!filePath.exists()) { filePath.mkdirs(); } String filename=null ; if (!home.getFile().isEmpty()){ String uuid = UUID.randomUUID().toString().replaceAll("-" ,"" ); String contentType=home.getFile().getContentType(); String suffixName=contentType.substring(contentType.indexOf("/" )+1 ); filename=uuid+"." +suffixName; System.out.println(filename); home.getFile().transferTo(new File(localPath+filename)); } sqlPath = "/upload/" +filename; System.out.println(sqlPath); home.setImg(sqlPath); homeService.addHome(home); model.addAttribute("home" ,home); return "home_show" ; } @RequestMapping("/delete") public String delete (Integer id) { homeService.deleteHomeById(id); return "redirect:/home/list" ; } @RequestMapping("/list") public ModelAndView list () { ModelAndView mv = new ModelAndView();
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 sqlPath = "/upload/" +filename; System.out.println(sqlPath); h.setImg(sqlPath); homeService.updateHomeById(h); return ("redirect:/home/list" ); } @RequestMapping("/show") public ModelAndView show (Integer id) { ModelAndView mv = new ModelAndView(); Home home=homeService.queryHomeById(id); mv.addObject("home" ,home); mv.setViewName("home_show" ); return mv; } @RequestMapping("/find") public ModelAndView find (int findByNum ) { ModelAndView mv = new ModelAndView(); Home home = homeService.queryHomeByNum(findByNum); List<Home> homeList=new ArrayList<Home>(); homeList.add(home); if (home==null ){ homeList=homeService.queryAllHome(); mv.addObject("error" ,"未查询出结果" ); } mv.addObject("list" ,homeList); mv.setViewName("home_list" ); return mv; } @RequestMapping("/type1") public String type1 (Integer id,Model model) { Home home = homeService.queryHomeById(id); model.addAttribute("h" ,home); return "H_Type_update" ; } @RequestMapping("/type2") public String type2 (Home home) { homeService.updateH_TypeById(home); return "redirect:/home/list" ; } } package com.hotel.controller;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 String sqlPath = null ; String localPath= request.getServletContext().getRealPath("/upload/" ); File filePath = new File(localPath); if (!filePath.exists()) { filePath.mkdirs(); } String filename=null ; if (!home.getFile().isEmpty()){ String uuid = UUID.randomUUID().toString().replaceAll("-" ,"" ); String contentType=home.getFile().getContentType(); String suffixName=contentType.substring(contentType.indexOf("/" )+1 ); filename=uuid+"." +suffixName; System.out.println(filename); home.getFile().transferTo(new File(localPath+filename)); } sqlPath = "/upload/" +filename; System.out.println(sqlPath); home.setImg(sqlPath); homeService.addHome(home); model.addAttribute("home" ,home); return "home_show" ; } @RequestMapping("/delete") public String delete (Integer id) { homeService.deleteHomeById(id); return "redirect:/home/list" ; } @RequestMapping("/list") public ModelAndView list () { ModelAndView mv = new ModelAndView();
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 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; } } package com.hotel.controller;@Controller @RequestMapping("jump") public class JumpController { @RequestMapping("/guests_add") public String guest () { return "guests_add" ; }
——————————PayStart——————————
项目链接: https://javayms.github.io?id=271422322105200kh https://javayms.pages.dev?id=271422322105200kh