作者主页:夜未央5788
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
项目介绍
springboot景区管理系统。该项目分为前台网站展示与后台管理。
前台网站主要功能有:用户登录、注册;首页有热门酒店、热门景点、景区游玩攻略、热门路线等模块;其次导航栏有景区游玩路线、我关注的路线;景区游玩攻略、我发布的攻略、我关注的攻略;在线酒店预订、景点预订、我的预订等;
后台管理主要功能有:用户管理、酒店管理、景点管理、攻略管理、路线管理等;
环境需要
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.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
6.数据库:MySql 5.7版本;
技术栈
1. 后端:SpringBoot
2. 前端:html+layui+bootstrap+jQuery
使用说明
1. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,下载所需jar包;
2. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置
4. 配置tomcat,然后运行项目,输入localhost:8087/travel 登录
5. 后台管理员账户:admin 密码:admin
前台普通用户账户:user 密码:123456
运行截图
前台界面
后台界面
代码相关
路线管理控制器
@Controller
@RequestMapping("/route")
public class RouteController {
@Autowired
private RouteService routeService;
@RequestMapping("/travelRouteListUI")
public String travelRouteListUI(Model model, @ModelAttribute("searchName") String searchName, @PageableDefault(size = 10) Pageable pageable) {
Page<TravelRoute> page = routeService.TravelRouteListUI(searchName, pageable);
List<TravelRoute> top10Route = routeService.findTop10Route();
model.addAttribute("top10Route", top10Route);
model.addAttribute("page", page);
return "route/travelRoute";
}
@RequestMapping("/travelRouteDetailsUI")
public String travelRouteDetailsUI(Model model, HttpServletRequest request, @RequestParam(name = "id") String id) {
TravelRoute travelRoute = routeService.findTravelRouteById(id);
//如果用户显示已经关注,就是查看关注列表
Boolean flag = routeService.isRoute(request, id);
List<TravelRoute> top10Route = routeService.findTop10Route();
model.addAttribute("top10Route", top10Route);
model.addAttribute("travelRoute", travelRoute);
model.addAttribute("flag", flag);
return "route/travelRoute-details";
}
@RequestMapping("/routeManageUI")
public String routeManageUI(Model model, HttpServletRequest request) {
List<UserRoute> userRouteList = routeService.getTravelRouteByUser(request);
model.addAttribute("userRouteList", userRouteList);
return "route/route-user-manage";
}
@RequestMapping("/cancelTravelRouteReserve")
@ResponseBody
public Result cancelTravelRouteReserve(HttpServletRequest request, String id) {
return routeService.cancelTravelRouteReserve(request, id);
}
}
用户管理控制器
@Controller
@RequestMapping("/user")
public class UserCenterController {
@Autowired
private UserCenterService userCenterService;
@RequestMapping("/centerUI")
public String centerUI(Model model, HttpServletRequest request) {
User user = userCenterService.getUser(request);
model.addAttribute("user", user);
return "center/user-center";
}
@RequestMapping("/centerEditUI")
public String centerEditUI(Model model, HttpServletRequest request) {
User user = userCenterService.getUser(request);
model.addAttribute("user", user);
return "center/user-center-edit";
}
@RequestMapping("/centerEdit")
@ResponseBody
public Result centerEdit(Model model, User user) {
return userCenterService.centerEdit(user);
}
@RequestMapping("/centerEditPWUI")
public String centerEditPWUI(Model model, HttpServletRequest request) {
User user = userCenterService.getUser(request);
model.addAttribute("id", user.getId());
return "center/user-center-editpw";
}
@RequestMapping("/centerEditPW")
@ResponseBody
public Result centerEditPW(HttpServletRequest request, HttpServletResponse response, Model model, @RequestParam("id") String id, @RequestParam("oldPassword") String oldPassword, @RequestParam("newPassword") String newPassword) {
return userCenterService.centerEditPW(request, response, id, oldPassword, newPassword);
}
}
路线管理控制器
@Controller
@RequestMapping("/strategy")
public class StrategyController {
@Autowired
private StrategyService strategyService;
@RequestMapping("/travelStrategyListUI")
public String travelStrategyListUI(Model model, @ModelAttribute("searchName") String searchName, @PageableDefault(size = 10) Pageable pageable) {
Page<TravelStrategy> page = strategyService.TravelStrategyListUI(searchName, pageable);
List<TravelStrategy> top10Strategy = strategyService.findTop10Strategy();
model.addAttribute("top10Strategy", top10Strategy);
model.addAttribute("page", page);
return "strategy/travelStrategy";
}
@RequestMapping("/travelStrategyDetailsUI")
public String travelStrategyDetailsUI(Model model, HttpServletRequest request, @RequestParam(name = "id") String id) {
TravelStrategy travelStrategy = strategyService.findTravelStrategyById(id);
//如果用户显示已经关注,就是查看关注列表
Boolean flag = strategyService.isStrategy(request, id);
List<TravelStrategy> top10Strategy = strategyService.findTop10Strategy();
model.addAttribute("top10Strategy", top10Strategy);
model.addAttribute("travelStrategy", travelStrategy);
model.addAttribute("flag", flag);
return "strategy/travelStrategy-details";
}
@RequestMapping("/cancelTravelStrategyReserve")
@ResponseBody
public Result cancelTravelStrategyReserve(HttpServletRequest request, String id) {
return strategyService.cancelTravelStrategyReserve(request, id);
}
@RequestMapping("/strategyManageUI")
public String strategyManageUI(Model model, HttpServletRequest request) {
List<UserStrategy> userStrategyList = strategyService.getTravelStrategyByUser(request);
List<TravelStrategy> top10Strategy = strategyService.findTop10Strategy();
model.addAttribute("top10Strategy", top10Strategy);
model.addAttribute("userStrategyList", userStrategyList);
return "strategy/strategy-manage";
}
@RequestMapping("/saveTravelStrategy")
@ResponseBody
public Result saveTravelStrategy(HttpServletRequest request, TravelStrategy travelStrategy) {
return strategyService.saveTravelStrategy(request, travelStrategy);
}
@RequestMapping("/pushStrategyListUI")
public String pushStrategyListUI(HttpServletRequest request, Model model, @ModelAttribute("searchName") String searchName, @PageableDefault(size = 10) Pageable pageable) {
Page<TravelStrategy> page = strategyService.PushStrategyListUI(request,searchName, pageable);
List<TravelStrategy> top10Strategy = strategyService.findTop10Strategy();
model.addAttribute("top10Strategy", top10Strategy);
model.addAttribute("page", page);
return "strategy/pushStrategy";
}
}
如果也想学习本系统,下面领取。回复:035springboot