/**
  * 批量删除
  *
  * @param request
  * @param response
  */
 @RequestMapping("/allDeleteDis")
 public void deleteMore(HttpServletRequest request, HttpServletResponse response) {
   try {
     String sid = request.getParameter("Uid");
     favoriteService.deleteByIds(sid);
   } catch (Exception e) {
     e.printStackTrace();
     request.setAttribute("InfoMessage", "信息载入失败!具体异常信息:" + e.getMessage());
   }
 }
 /**
  * 收藏列表
  *
  * @param page
  * @param userID
  * @param model
  * @return
  */
 @RequestMapping("/favoriteList")
 public String productsList(Page page, HttpServletRequest request) {
   try {
     Users user = (Users) request.getSession().getAttribute("userInfo");
     Map<String, Object> map = new HashMap<String, Object>();
     map.put("page", page);
     map.put("userID", user.getId());
     List<Favorite> favorites = favoriteService.getAlls(map);
     request.setAttribute("favorites", favorites);
     int rows = favoriteService.findRows(user.getId());
     page.setRows(rows);
     request.setAttribute("page", page);
     return "Manager/products/favoriteList";
   } catch (Exception e) {
     e.printStackTrace();
     request.setAttribute("InfoMessage", "信息载入失败!具体异常信息:" + e.getMessage());
     return "error";
   }
 }
 /**
  * 删除收藏
  *
  * @param id
  * @param userID
  * @return
  */
 @RequestMapping("favoriteDelete")
 public String favoriteDelete(Integer id, Model model) {
   try {
     favoriteService.delete(id);
     return "redirect:favoriteList.do";
   } catch (Exception e) {
     e.printStackTrace();
     model.addAttribute("InfoMessage", "信息载入失败!具体异常信息:" + e.getMessage());
     return "error";
   }
 }
 /**
  * 进入修改页面
  *
  * @param id
  * @param model
  * @return
  */
 @RequestMapping("tofovoriteUpdate")
 public String tofovoriteUpdate(Integer id, Model model) {
   try {
     Favorite favorite = favoriteService.findbyId(id);
     model.addAttribute("favorite", favorite);
     return "Manager/products/favoriteUpdate";
   } catch (Exception e) {
     e.printStackTrace();
     model.addAttribute("InfoMessage", "信息载入失败!具体异常信息:" + e.getMessage());
     return "error";
   }
 }
 /**
  * 添加收藏
  *
  * @param favorite
  * @return
  */
 @RequestMapping("favoriteAdd")
 public String favoriteAdd(Favorite favorite, HttpServletRequest request) {
   try {
     Users user = (Users) request.getSession().getAttribute("userInfo");
     favorite.setUserId(user.getId());
     favoriteService.add(favorite);
     return "redirect:favoriteList.do";
   } catch (Exception e) {
     e.printStackTrace();
     request.setAttribute("InfoMessage", "信息载入失败!具体异常信息:" + e.getMessage());
     return "error";
   }
 }