简体   繁体   中英

Grails - how to use “OR” in CreateCriteria

I have this Criteria:

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

  carList{ 
      eq("login",login)    
          }

  ccList{
      eq("cmd",false)
        }


  order("date","desc")
}

I want to add also null as a criteria for "cmd". Is there an OR to be used in my case?

Thanks

Yes, there is an OR that you can use in this case.

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

The documentation has this and other options outlined. Further information is also found throughout the rest of the documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM