首页>代码>基于spring boot+mybatis+mysql开发银杏湖景区旅游系统,包括前台显示和后台管理系统>/travel_platform/src/main/java/hue/edu/xiong/volunteer_travel/controller/ReserveController.java
package hue.edu.xiong.volunteer_travel.controller; import hue.edu.xiong.volunteer_travel.core.Result; import hue.edu.xiong.volunteer_travel.model.Attractions; import hue.edu.xiong.volunteer_travel.model.Hotel; import hue.edu.xiong.volunteer_travel.model.UserAttractions; import hue.edu.xiong.volunteer_travel.model.UserHotel; import hue.edu.xiong.volunteer_travel.service.ReserveService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableDefault; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; import java.util.List; @Controller @RequestMapping("/reserve") public class ReserveController { @Autowired private ReserveService reserveService; @RequestMapping("/reserveHotelListUI") public String reserveHotelListUI(Model model, @ModelAttribute("searchName") String searchName, @PageableDefault(size = 10) Pageable pageable) { Page<Hotel> page = reserveService.reserveHotelListUI(searchName, pageable); List<Hotel> top10Hotel = reserveService.getTop10Hotel(); List<Attractions> top10Attractions = reserveService.getTop10Attractions(); model.addAttribute("top10Hotel", top10Hotel); model.addAttribute("top10Attractions", top10Attractions); model.addAttribute("page", page); return "reserve/reserve-hotel"; } @RequestMapping("/hotelDetailsUI") public String hotelDetailsUI(Model model, HttpServletRequest request, @RequestParam(name = "id") String id) { Hotel hotel = reserveService.findHotelById(id); //如果用户显示已经预约,就是查看预约列表 Boolean flag = reserveService.isReserveHotel(request, id); List<Hotel> top10Hotel = reserveService.getTop10Hotel(); List<Attractions> top10Attractions = reserveService.getTop10Attractions(); model.addAttribute("top10Hotel", top10Hotel); model.addAttribute("top10Attractions", top10Attractions); model.addAttribute("hotel", hotel); model.addAttribute("flag", flag); return "reserve/reserve-hotel-details"; } @RequestMapping("/reserveManageUI") public String reserveManageUI(Model model, HttpServletRequest request) { List<UserHotel> userHotelList = reserveService.getReserveHotelByUser(request); List<UserAttractions> userAttractionsList = reserveService.getReserveAttractionsByUser(request); model.addAttribute("userHotelList", userHotelList); model.addAttribute("userAttractionsList",userAttractionsList); return "reserve/reserve-user-manage"; } @RequestMapping("/cancelReserve") @ResponseBody public Result cancelReserve(HttpServletRequest request,String id) { return reserveService.cancelReserve(request,id); } @RequestMapping("/reserveAttractionsListUI") public String reserveAttractionsListUI(Model model, @ModelAttribute("searchName") String searchName, @PageableDefault(size = 10) Pageable pageable) { Page<Attractions> page = reserveService.reserveAttractionsListUI(searchName,pageable); List<Hotel> top10Hotel = reserveService.getTop10Hotel(); List<Attractions> top10Attractions = reserveService.getTop10Attractions(); model.addAttribute("top10Hotel", top10Hotel); model.addAttribute("top10Attractions", top10Attractions); model.addAttribute("page", page); return "reserve/reserve-attractions"; } @RequestMapping("/attractionsDetailsUI") public String attractionsDetailsUI(Model model, HttpServletRequest request, @RequestParam(name = "id") String id) { Attractions attractions = reserveService.findAttractionsById(id); //如果用户显示已经预约,就是查看预约列表 Boolean flag = reserveService.isReserveAttractions(request, id); List<Hotel> top10Hotel = reserveService.getTop10Hotel(); List<Attractions> top10Attractions = reserveService.getTop10Attractions(); model.addAttribute("top10Hotel", top10Hotel); model.addAttribute("top10Attractions", top10Attractions); model.addAttribute("attractions", attractions); model.addAttribute("flag", flag); return "reserve/reserve-attractions-details"; } @RequestMapping("/cancelAttractionsReserve") @ResponseBody public Result cancelAttractionsReserve(HttpServletRequest request,String id) { return reserveService.cancelAttractionsReserve(request,id); } }
最近下载更多
陈金龙 LV7
昨天
wuying8208 LV15
10月23日
微信网友_7134912998903808 LV9
8月29日
krispeng LV13
8月26日
TY0165 LV20
6月21日
yuquanzuo LV2
5月17日
李朝磊 LV18
4月22日
zolscy LV24
4月21日
1098774122 LV6
4月6日
微信网友_6935352109010944 LV2
4月4日
最近浏览更多
陈金龙 LV7
昨天
citybird LV4
11月20日
微笑刺客 LV20
11月19日
wuying8208 LV15
10月23日
xinxin23383 LV7
9月13日
微信网友_7134912998903808 LV9
8月29日
krispeng LV13
8月26日
edpwyg LV14
7月28日
asdfgh112
7月4日
暂无贡献等级
TY0165 LV20
6月21日