——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
分为前台用户和后台管理员功能
管理员
- 登录、管理用户、管理景点、管理酒店、管理论坛帖子、管理评论等
用户端
- 登录、注册、景点、酒店、论坛、评论等功能的浏览和评论等
idea运行/eclipse/MyEclipse运行


前台








后台







技术框架
JavaBean MVC JSP SSM(Spring SpringMVC MyBatis) Maven MySQL jQuery JavaScript CSS
基于javaweb的SSM+Maven旅游管理系统(前台、后台)(java+jsp+ssm+maven+mysql)
——————————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
|
@Controller @RequestMapping(value = "hotel") public class HotelController { @Autowired private HotelDao hotelDao; @Autowired private ViewPointService viewPointService;
@RequestMapping(value = "index", method = RequestMethod.GET) public String index(Model model) { HotelExample example = new HotelExample(); example.setOrderByClause("hid desc"); String prefix = "/static/upload/hotelAvatar/"; List<Hotel> hotels = hotelDao.selectByExample(example); for (Hotel hotel : hotels) { String suffix = hotel.getImgUrl(); hotel.setImgUrl(prefix + suffix); } model.addAttribute("hotels", hotels); return "proscenium/hotel/index"; }
|
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
| * 后台酒店模糊搜索 */ @RequestMapping(value = "hotelPointSearch", method = RequestMethod.GET) public String hotelPointSearch(String keyword, Model model) { String prefix = "/static/upload/hotelAvatar/";
Hotel hotel = new Hotel();
hotel.setLocal(keyword); hotel.setHouseType(keyword); hotel.setBedType(keyword);
List<Hotel> hotels = hotelDao.hotelPointSearch(hotel);
for (Hotel hotelForEach : hotels){ String imgUrl = hotelForEach.getImgUrl(); hotelForEach.setImgUrl(prefix + imgUrl); }
model.addAttribute("hotels", hotels); model.addAttribute("msg", Msg.success("酒店查询成功!"));
return "admin/hotel_list"; }
@RequestMapping(value = "forumPointSearch", method = RequestMethod.GET) public String forumPointSearch(String keyword, Model model) {
Forum forum = new Forum();
forum.setTpTag(keyword); forum.setTpTitle(keyword); forum.setTpSubTitle(keyword); forum.setTpAuthor(keyword);
List<Forum> forums = forumDao.forumPointSearch(forum);
model.addAttribute("forums", forums); model.addAttribute("msg", Msg.success("论坛查询成功!"));
return "admin/forum_list"; }
|
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
|
@Controller @RequestMapping(value = "traffic") public class TrafficController { @Autowired TrafficDao trafficDao;
@ResponseBody @RequestMapping(value = "selectByCurrentAndDestination", method = RequestMethod.GET) public List<Traffic> traffic(String currentCity, String desCity, Model model) { TrafficExample example = new TrafficExample(); List<Traffic> traffics = trafficDao.selectByExample(example);
List<Traffic> queryTraffics = new ArrayList<>();
for(Traffic traffic : traffics){ if (currentCity.equals(traffic.getTpCurrent()) && desCity.equals(traffic.getTpDestination())){ queryTraffics.add(traffic); } } return queryTraffics; } } package com.demo.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 44 45 46
| lw_list = viewPointService.findByWords(); model.addAttribute("lw_list",lw_list);
lr_list = viewPointService.findByReply(); model.addAttribute("lr_list",lr_list);
Forum forum = forumDao.selectByPrimaryKey(tpFid);
System.out.println("查询到当前文章的ID值:" + forum.getTpFid());
if (forum != null) { model.addAttribute("forum", forum); return "proscenium/forum/content"; } else { return null; } }
@RequestMapping(value="/saveHotelReply") public String saveHotelReply(Reply reply){ if(reply != null){ viewPointService.saveReply(reply); String hid = reply.getLr_hotel_id(); return "redirect:toHotelArticleView.do?hid=" + hid; }else{ return null; } }
@RequestMapping(value="/saveHotelWords") public String saveHotelWords(Words words){ if(words != null){ String hid = words.getLw_hotel_id(); viewPointService.saveWords(words); return "redirect:toHotelArticleView.do?hid=" + hid; }else{
|
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
| } package com.demo.controller;
@Controller @RequestMapping(value = "article") public class ArticleController { private List<Words> lw_list; private List<Reply> lr_list;
@Autowired ViewPointService viewPointService; @Autowired ForumDao forumDao; @Autowired HotelDao hotelDao;
@RequestMapping(value="/saveWords") public String saveWords(Words words){ if(words != null){ String r_id = words.getLw_for_article_id(); viewPointService.saveWords(words); return "redirect:toArticleView.do?r_id="+r_id; }else{ return null; } }
@RequestMapping(value="/saveReply") public String saveReply(Reply reply){
|
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
| model.addAttribute("hotels", hotels); return "proscenium/hotel/index"; }
@RequestMapping(value = "content", method = RequestMethod.GET) public String content(Integer hid, Model model) {
List<Words> lw_list = viewPointService.findByWords(); model.addAttribute("lw_list",lw_list);
List<Reply> lr_list = viewPointService.findByReply(); model.addAttribute("lr_list",lr_list);
Hotel hotel = hotelDao.selectByPrimaryKey(hid); model.addAttribute("hotel", hotel);
return "proscenium/hotel/content"; }
@RequestMapping(value = "hotelPointSearch", method = RequestMethod.GET) public String hotelPointSearch(String keyword, Model model) { String prefix = "/static/upload/hotelAvatar/";
Hotel hotel = new Hotel();
hotel.setLocal(keyword); hotel.setHouseType(keyword); hotel.setBedType(keyword);
List<Hotel> hotels = hotelDao.hotelPointSearch(hotel);
for (Hotel hotelForEach : hotels){ String imgUrl = hotelForEach.getImgUrl(); hotelForEach.setImgUrl(prefix + imgUrl); }
model.addAttribute("hotels", hotels); model.addAttribute("msg", Msg.success("酒店查询成功!"));
return "proscenium/hotel/index"; }
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=331922390502104ad
https://javayms.pages.dev?id=331922390502104ad