一些标准:联想+不+ ilike不能给出一个好的结果。我仍然会遇到一些我不想在结果中出现的情况。其他方法有什么线索或建议吗?
我在控制器里有这样的信息:
def pgp = [:]
pgp.max = params.max?.toInteger() ?: 20;
pgp.offset = params.offset?.toInteger() ?: 0
pgp.max = 20;
def result = Case.createCriteria().list(pgp) {
actions {
not {
and {
ilike("status","%CLOSED")
ilike("status","%Installed in PRD")
}
}
}
}这是相关的域片段:
class Case {
String caseCode
String caseName
String caseType
static hasMany = [ actions : Action ]我在Grails 2.4.4
发布于 2015-03-03 11:21:30
您的布尔逻辑是错误的- and应该是一个or。您当前的测试对于status的每个可能值都是正确的,因为任何通过ilike("status","%CLOSED")的值都将失败ilike("status","%Installed in PRD"),反之亦然。
https://stackoverflow.com/questions/28829706
复制相似问题