我想在findAll查詢中整合排序,順序,最大值和偏移量。以下工作正常:Grails findAll具有排序,順序,最大和偏移量?
def books = Book.findAll("from Book as b where b.approved=true order by b.dateCreated desc", [max: max, offset: offset])
但我想要的是:
def books = Book.findAll("from Book as b where b.approved=true", [sort: 'dateCreated', order: 'desc', max: max, offset: offset])
這是行不通的。我該如何重寫這個?
這不回答這個問題。如何在此查詢中包含排序和順序作爲變量? – confile
@userWebMobile請參閱編輯。 –
你爲什麼要用:''? – confile