/** * 分页获取最新求译列表 登录后文档首页的转发 * * @param session * @param model * @param paraPage * @return */ @RequestMapping(params = "method=index", method = RequestMethod.GET) public String index(HttpSession session, Model model, Pager<Document> paraPage) { User user = (User) session.getAttribute("user"); if (paraPage == null) paraPage = new Pager<Document>(); if (user != null) { int totleCount = documentService.getAllCount(); Pager<Document> page = new Pager<Document>(totleCount, paraPage.getCurPage(), paraPage.getCountPerPage()); List<Document> documentList = documentService.getByPage(page.getStartCount(), page.getCountPerPage()); page.settList(documentList); model.addAttribute("hotDocList", getHotDoc()); model.addAttribute("hotComList", getHotCom()); model.addAttribute("user", user); model.addAttribute("page", page); return "user/index"; } return "error"; }
/** * vo分页获取文档列表 * * @param session * @param model * @param curPage * @param countPerPage * @return */ @RequestMapping(params = "method=list", method = RequestMethod.GET) public String list(HttpSession session, Model model, Pager<Document> paraPage, String target) { User user = (User) session.getAttribute("user"); // 默认情况 if (paraPage == null) { paraPage = new Pager<Document>(); } if (user != null) { int totleCount = documentService.getAllCount(user.getUserid()); Pager<Document> page = new Pager<Document>(totleCount, paraPage.getCurPage(), paraPage.getCountPerPage()); List<Document> documentList = documentService.getByPage(page.getStartCount(), page.getCountPerPage(), user.getUserid()); page.settList(documentList); model.addAttribute("user", user); model.addAttribute("page", page); model.addAttribute("target", target); return "user/vo_index"; } else return "error"; }
/** * 获取其他用户document列表 * * @param model * @param userid * @return */ @RequestMapping(params = "method=guest_user_list", method = RequestMethod.GET) public String guestUserList(Model model, Integer userid) { List<Document> guestDocumentList = documentService.getByPage(0, maxCount, userid); model.addAttribute("guestDocumentList", guestDocumentList); return "templet/guest_user/document"; }