作者:努力的蚂蚁 | 来源:互联网 | 2023-10-17 17:56
Iwanttointegratesort,order,maxandoffsetinafindAllquery.Thefollowingworksfine:我想在fin
I want to integrate sort, order, max and offset in a findAll query. The following works fine:
我想在findAll查询中集成排序、顺序、最大值和偏移量。以下工作正常:
def books = Book.findAll("from Book as b where b.approved=true order by b.dateCreated desc", [max: max, offset: offset])
But what I want is:
但我想要的是:
def books = Book.findAll("from Book as b where b.approved=true", [sort: 'dateCreated', order: 'desc', max: max, offset: offset])
This does not work. How do I have to rewrite this?
这并不工作。我怎么重写这个呢?
4 个解决方案