2019-08-12 13:46
Page paginate = Article.dao.paginate(pageNumber, pageSize, "select sa.*","from sk_article sa LEFT JOIN sk_replay sr ON sa.id=sr.article_id WHERE sr.user_id=? group by sr.article_id",id);
for (Article article : paginate.getList()) {
String sql="select * from sk_replay where user_id=? and article_id=?";
List replays = Replay.dao.find(sql, article.getId(),id);
article.put("replays", replays);
}
System.out.println(Json.getJson().toJson(paginate.getList()));
最后我用这种办法解决!