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

时间:2014-01-16 11:10:47

标签: hibernate grails gorm 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?

由于

1 个答案:

答案 0 :(得分:4)

是的,在这种情况下你可以使用OR。

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

documentation概述了此选项和其他选项。在rest of the documentation中也可以找到更多信息。

相关问题