首页>代码>基于spring boot+mybatis+mysql开发银杏湖景区旅游系统,包括前台显示和后台管理系统>/travel_platform/src/main/java/hue/edu/xiong/volunteer_travel/controller/StrategyController.java
package hue.edu.xiong.volunteer_travel.controller; import hue.edu.xiong.volunteer_travel.core.Result; import hue.edu.xiong.volunteer_travel.model.TravelStrategy; import hue.edu.xiong.volunteer_travel.model.UserStrategy; import hue.edu.xiong.volunteer_travel.service.StrategyService; 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("/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"; } }
最近下载更多
陈金龙 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日