Package com.skyline.wo.model

Examples of com.skyline.wo.model.Category


    List<Article> articles = articleService.getArticleByOwnerId(page, userid, authority);
    mav.addObject("ARTICLES", articles);
    mav.setViewName(ViewPaths.ARTICLE_LISTARTICLE);
    mav.addObject("OWNER_ID", userid);
    List<Category> categories = categoryService.getCategoryByOwnerId(userid);
    Category category = new Category();
    category.setId(Long.valueOf(0));
    category.setCategoryName("全部日志");
    categories.add(0, category);
    mav.addObject("CATEGORIES", categories);
    mav.addObject("AUTHORITY", authority);
    mav.addObject("CURRENT_CATEGORY", Long.valueOf(0));
    mav.addObject("page", page);
View Full Code Here


  }

  @RequestMapping(value = "/list/category/{ownerId}/{categoryId}", method = RequestMethod.GET)
  public ModelAndView listArticleByCategoryId(Page page, @PathVariable Long categoryId, @PathVariable Long ownerId) {
    ModelAndView mav = new ModelAndView();
    Category currentCategory = categoryService.getCategoryById(categoryId);
    if (currentCategory != null) {
      // Page page = new Page();
      page.setSize(listArticlePageSize);
      // page.setCurpage(1);
      Integer authority = AuthorityUtil.getAuthority(null, currentCategory.getId());

      List<Article> articles = articleService.getArticleByCategoryId(page, categoryId, ownerId, authority);
      mav.addObject("ARTICLES", articles);

      mav.setViewName(ViewPaths.ARTICLE_LISTARTICLE);
      mav.addObject("CATEGORY_Id", categoryId);

      List<Category> categories = categoryService.getCategoryByOwnerId(currentCategory.getOwnerId());
      Category category = new Category();
      category.setId(Long.valueOf(0));
      category.setCategoryName("全部日志");
      categories.add(0, category);
      mav.addObject("CATEGORIES", categories);

      mav.addObject("CURRENT_CATEGORY", categoryId);
View Full Code Here

  @RequestMapping(value = "category/modify", method = RequestMethod.POST)
  public ModelAndView modifyCategory(Long id, String categoryName) {

    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    ModelAndView mav = new ModelAndView();
    Category category = categoryService.getCategoryById(id);
    if (user != null && category != null && user.getId().equals(category.getOwnerId())) {
      //FIXME 不要使用redirect
      categoryService.modifyCategory(id, categoryName, user.getId());
      mav.setViewName("redirect:" + "manage" + URL_SUFFIX);
    } else {
      mav.addObject("REQUEST_FROM", requestFrom);
View Full Code Here

  public ModelAndView deleteCategory(@PathVariable Long id) {
    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    // TODO:获取对该分类的访问权限;
    Integer authority = Authority.PRIVATE;
    ModelAndView mav = new ModelAndView();
    Category category = categoryService.getCategoryById(id);
    if (user != null && category != null && user.getId().equals(category.getOwnerId())) {
      // categoryService.modifyCategory(id, authority,
      //FIXME 不要使用redirect
      categoryService.deleteCategory(id, user.getId(), authority);
      mav.setViewName("redirect:" + "../manage" + URL_SUFFIX);
    } else {
View Full Code Here

  public static CategoryMapper getMapper() {
    return MAPPER;
  }

  public Category mapRow(ResultSet rs, int rowNum) throws SQLException {
    Category c = new Category();
    c.setActivity(Activity.valueOf(rs.getString(COLUMN_ACTIVITY)));
    c.setArticleNum(rs.getInt(COLUMN_ARTICLE_NUM));
    c.setAuthority(rs.getInt(COLUMN_AUTHORITY));
    c.setCategoryName(rs.getString(COLUMN_CATEGORY_NAME));
    c.setCommentNum(rs.getInt(COLUMN_COMMENT_NUM));
    c.setCreateTime(rs.getDate(COLUMN_CREATE_TIME));
    c.setDown(rs.getInt(COLUMN_DOWN));
    c.setId(rs.getLong(COLUMN_ID));
    c.setOwnerId(rs.getLong(COLUMN_OWNER_ID));
    c.setOwnerNickname(rs.getString(COLUMN_OWNER_NICKNAME));
    c.setOwnerPortrait(rs.getString(COLUMN_OWNER_PORTRAIT));
    c.setShareNum(rs.getInt(COLUMN_SHARE_NUM));
    c.setUp(rs.getInt(COLUMN_UP));
    c.setUpdateTime(rs.getDate(COLUMN_UPATE_TIME));
    return c;
  }
View Full Code Here

TOP

Related Classes of com.skyline.wo.model.Category

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.