Example #1
0
 /** 根据说说id得到它的评论 */
 public Map queryCommentBySid(Long sid, Integer pageSize) {
   Map<String, Object> rtnMap = new HashMap<String, Object>();
   Integer pageNo = null;
   int size = commReplyService.queryPraiseOrCommentCount(1, sid, 1);
   if (pageSize == null) {
     pageSize = 10;
   }
   if (pageSize == -1) {
     pageSize = null;
   } else {
     if (size > pageSize) pageNo = size - pageSize + 1;
     else pageNo = 0;
   }
   List<IpavcommentEntity> list = commReplyService.queryCommentById(1, sid, 1, pageNo, pageSize);
   List<Map> mapList = new ArrayList<Map>();
   for (IpavcommentEntity comment : list) {
     Map map = new HashMap<String, Object>();
     map.put("commuserimg", comment.getCommuserimg());
     map.put("commcontent", comment.getCommcontent());
     map.put("commusername", comment.getCommusername());
     map.put("commuserid", comment.getCommuserid());
     map.put("commentid", comment.getCommentid());
     map.put("replys", comment.getReplys());
     mapList.add(map);
   }
   rtnMap.put("commList", mapList);
   rtnMap.put("sid", sid);
   Integer surplusSize = null;
   if ((pageNo == null || pageNo != 0) && list != null) {
     surplusSize = size - list.size();
   }
   rtnMap.put("surplusSize", surplusSize);
   rtnMap.put("size", size);
   return rtnMap;
 }