コード例 #1
0
	@Override
	public List<ProductNews> getAllList(PageRequest pageRequst) {
		String columns="a.ProductNewsId,a.ProductNewsId as productNewsIdd,a.Question," +
				"(select b.ReplyContent  from commentreply b where a.ProductNewsId = b.CommentReplyModel ) as ReplyContent,a.QuestionDate," +
				"(select p.ProductName from product p where a.ProductId=p.ProductId) as productName ";
		pageRequst.setsColumns(columns);
		return productNewsMapper.getAllProductNewsList(pageRequst);
	}
コード例 #2
0
  /**
   * @Description: 获取评论信息列表
   *
   * @param: @param request
   * @param: @param response
   * @throws
   */
  @RequestMapping(value = "/GetCommentList", method = RequestMethod.POST)
  public void GetCommentList(
      String id,
      PageRequest pageRequest,
      HttpServletRequest request,
      HttpServletResponse response) {
    try {
      pageRequest.setSearch("");
      if (pageRequest.getsSearch() != null && !"".equals(pageRequest.getsSearch())) {
        pageRequest.setSearch(" and a.content like '%" + pageRequest.getsSearch() + "%'");
      }

      pageRequest.setSearch(pageRequest.getSearch() + " and a.shareId = '" + id + "'");

      List<Map<String, Object>> list = shareCommentService.getList(pageRequest);
      Map<String, Object> result = new HashMap<String, Object>();
      result.put("iTotalRecords", 0);
      int count = shareCommentService.getCount(pageRequest);
      // 总条数
      result.put("iTotalDisplayRecords", count);
      // 内容列表
      result.put("aaData", list);
      String json = com.alibaba.fastjson.JSON.toJSONString(result);
      out(json, response);
    } catch (Exception e) {
      e.printStackTrace();
      log.error(e.getMessage());
    }
  }