Ejemplo n.º 1
0
  // 获得所有帖子
  public PageReturn<ChineseForumTopicVo> getAllChineseForumTopicPage(
      int pageSize, int pageIndex, String sort) {

    PageReturn<ChineseForumTopicVo> chineseForumTopicVoPageReturn =
        new PageReturn<ChineseForumTopicVo>();
    if (sort != null && sort.equals("reply")) {
      chineseForumTopicVoPageReturn =
          chineseForumTopicDao.getAllChineseForumTopicPageByReplyCount(pageSize, pageIndex);
    } else {
      chineseForumTopicVoPageReturn =
          chineseForumTopicDao.getAllChineseForumTopicPage(pageSize, pageIndex);
    }

    List<ChineseForumTopicVo> chineseForumTopicVoList = chineseForumTopicVoPageReturn.getData();
    for (int i = 0; i < chineseForumTopicVoList.size(); i++) {
      ChineseForumTopicVo chineseForumTopicVo =
          new ChineseForumTopicVo(chineseForumTopicVoList.get(i));
      User user = userDao.getUser(chineseForumTopicVo.getUserId());
      chineseForumTopicVo.setReplyCount(
          chineseForumTopicDao.getTopicReplyCount(chineseForumTopicVo.getId()));
      chineseForumTopicVo.setUser(user);
      chineseForumTopicVoList.set(i, chineseForumTopicVo);
    }

    return chineseForumTopicVoPageReturn;
  }
Ejemplo n.º 2
0
  // 获得所有帖子回复
  public PageReturn<ChineseForumTopicReplyVo> getAllChineseForumTopicReplyPage(
      int topicId, int pageSize, int pageIndex) {
    PageReturn<ChineseForumTopicReplyVo> chineseForumTopicReplyVoPageReturn =
        new PageReturn<ChineseForumTopicReplyVo>();
    chineseForumTopicReplyVoPageReturn =
        chineseForumTopicDao.getAllChineseForumTopicReplyPage(topicId, pageSize, pageIndex);

    List<ChineseForumTopicReplyVo> chineseForumTopicReplyVoList =
        chineseForumTopicReplyVoPageReturn.getData();
    for (int i = 0; i < chineseForumTopicReplyVoList.size(); i++) {
      ChineseForumTopicReplyVo chineseForumTopicReplyVo =
          new ChineseForumTopicReplyVo(chineseForumTopicReplyVoList.get(i));
      User user = userDao.getUser(chineseForumTopicReplyVo.getUserId());
      chineseForumTopicReplyVo.setUser(user);
      chineseForumTopicReplyVoList.set(i, chineseForumTopicReplyVo);
    }

    return chineseForumTopicReplyVoPageReturn;
  }