我能够使用 grails/Hibernate 创建条件进行 3 个条件查询,如下所示
def c = Domain.createCriteria()
c.list(max: map.max ?: 10, offset: map.offset ?: 0) {
and {
"colStatus" in status
"code" in codes
}
and {
or {
ilike("pCode", pCode)
ilike("pDesc", pCode)
}
}
order("DateCol3", "desc")
}
现在我有额外的 3 个带有内部 OR 条件的添加条件,我需要添加到查询中。我尝试跟随但没有成功
def c = Domain.createCriteria()
c.list(max: map.max ?: 10, offset: map.offset ?: 0) {
and {
"colStatus" in status
"code" in codes
}
and {
or {
ilike("pCode", pCode)
ilike("pDesc", pCode)
}
}
and {
or {
ilike("eCode", eCode)
ilike("eDesc", eCode)
}
}
and {
or {
ilike("oCode", oCode)
ilike("oDesc", oCode)
}
}
order("DateCol3", "desc")
}
请建议并帮助我如何添加多个 AND/OR 条件。