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
| return "/index/goods.jsp"; }
@RequestMapping("/goods") public String goods(int typeid, @RequestParam(required=false, defaultValue="1")int page, HttpServletRequest request){ request.setAttribute("flag", typeid); request.setAttribute("typeList", typeService.getList()); request.setAttribute("topList", topService.getList(Tops.TYPE_SUPPER, 1, 4)); if (typeid > 0) { request.setAttribute("type", typeService.get(typeid)); } request.setAttribute("goodList", goodService.getListByType(typeid, page, rows)); request.setAttribute("pageHtml", PageUtil.getPageHtml(request, goodService.getTotalByType(typeid), page, rows)); return "/index/goods.jsp"; }
@RequestMapping("/detail") public String detail(int goodid, HttpServletRequest request){ request.setAttribute("typeList", typeService.getList()); request.setAttribute("topList", topService.getList(Tops.TYPE_SUPPER, 1, 4)); Goods good = goodService.get(goodid); request.setAttribute("good", good); request.setAttribute("type", typeService.get(good.getTypeId())); request.setAttribute("colorList", skuService.getColorList(goodid)); request.setAttribute("sizeList", skuService.getSizeList(goodid)); return "/index/detail.jsp"; }
@RequestMapping("/search") public String search(String name, @RequestParam(required=false, defaultValue="1")int page, HttpServletRequest request) { if (Objects.nonNull(name) && !name.trim().isEmpty()) { request.setAttribute("goodList", goodService.getListByName(name, page, rows)); request.setAttribute("pageHtml", PageUtil.getPageHtml(request, goodService.getTotalByName(name), page, rows)); } request.setAttribute("typeList", typeService.getList());
|