class Book {
String title
Date releaseDate
String author
static constraints = {
releaseDate nullable: true
}
}
findAllWhere
目的
使用對應於網域類別屬性名稱的名稱參數,執行查詢傳回所有符合的結果。
範例
假設有網域類別
你可以使用以下形式查詢
def books = Book.findAllWhere(author: "Stephen King", title: "The Stand")
def unreleasedBooks = Book.findAllWhere(releaseDate: null)
說明
參數
-
queryParams
- 要用於查詢的鍵值對 Map