Exemplo n.º 1
0
  @RequestMapping("")
  public String list(
      ModelMap model,
      HttpSession session,
      @RequestParam(value = "page", defaultValue = "0") int page) {

    NewsCategorySearch catNewsSearch = new NewsCategorySearch();

    if (session.getAttribute("catNewsSearch") != null && page != 0) {
      catNewsSearch = (NewsCategorySearch) session.getAttribute("catNewsSearch");

    } else {
      session.setAttribute("catNewsSearch", catNewsSearch);
    }
    if (page > 0) {
      catNewsSearch.setPageIndex(page - 1);
    } else {
      catNewsSearch.setPageIndex(0);
    }
    catNewsSearch.setLevel(-1);
    catNewsSearch.setPageSize(200);

    DataPage<NewsCategory> categoryNewsPage = newsCategoryService.search(catNewsSearch);
    model.put("catNewsSearch", catNewsSearch);
    model.put("categoryNewsPage", categoryNewsPage);
    return "cp.newscategory";
  }
Exemplo n.º 2
0
 @ModelAttribute
 public void init(ModelMap map) {
   NewsCategorySearch critSearch = new NewsCategorySearch();
   critSearch.setLevel(0);
   critSearch.setPageIndex(0);
   critSearch.setPageSize(5);
   DataPage<NewsCategory> allNewsCate = newsCategoryService.search(critSearch);
   map.put("newsCate", allNewsCate.getData());
   map.put(
       "clientScript",
       "listCate=" + gson.toJson(allNewsCate.getData()) + "; newscategory.init();");
 }
Exemplo n.º 3
0
  @RequestMapping(
      value = {""},
      method = RequestMethod.POST)
  public String search(
      ModelMap model, HttpSession session, @ModelAttribute NewsCategorySearch catNewsSearch) {

    session.setAttribute("catNewsSearch", catNewsSearch);
    catNewsSearch.setPageIndex(0);
    catNewsSearch.setPageSize(200);
    DataPage<NewsCategory> categoryNewsPage = newsCategoryService.search(catNewsSearch);
    model.put("catNewsSearch", catNewsSearch);
    model.put("categoryNewsPage", categoryNewsPage);
    return "cp.newscategory";
  }