簡體   English   中英

Grails-如何在CreateCriteria中使用“ OR”

[英]Grails - how to use “OR” in CreateCriteria

我有這個條件:

def myList =  BAS.createCriteria().list () {
  projections { distinct ( "id" ) 
      property("date")
      property("id")
  }

  carList{ 
      eq("login",login)    
          }

  ccList{
      eq("cmd",false)
        }


  order("date","desc")
}

我還想添加null作為“ cmd”的標准。 我是否需要使用OR?

謝謝

是的,在這種情況下可以使用一個OR。

ccList {
  or {
    eq("cmd", false)
    isNull("cmd")
  }
}

文檔中概述了此選項和其他選項。 本文檔其余部分中也可以找到更多信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM