Top n 动态查询

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

def bjSectionInstance = BjSection.get(params.id)
if (!bjSectionInstance) {
    flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'bjSection.label', default: 'BjSection'), params.id])}"
    redirect(action: "list")
}
else {
  bjSectionInstance.bjSubjects.each {
    //查询效率???         n+1 ~
     it.bjArticles = BjArticle.findAllByAuditAndBjSubject('true',it, [max:10,order:'asc' ,sort: 'dateIssued'])
  }
    [bjSectionInstance: bjSectionInstance]
}