【请教】Grails中createCriteria怎么实现查询或关系。

sgq0085 2010-09-28

有如下一段代码,
results = Customer.createCriteria().list() {
                  
                    if (params.emailAddr)
                    like("emailAddr", "%" + params.emailAddr.replace("_","\\_") + "%")
                    if (params.name)
                    like("name", "%" + params.name.replace("_","\\_") + "%")
                    if (params.gender)
                    eq("gender",params.gender)
                    if (params.age)
                    eq("age",params.age)
                    if (params.city)
                    eq("city",params.city)
                }

查询结果是安装条件查询出 “and”关系的联系人
现在想将此查询改为查询“or”关系(满足一项条件即可),应该怎么写?
xiaobo_ 2010-09-29
results = Customer.createCriteria().list() {
      or{
           //然后是你的代码,它们之间的关系就是or
      }
}
Global site tag (gtag.js) - Google Analytics