0

一些标准如何:关联+不+我喜欢并没有给出好的结果。我仍然会收到具有我不希望在结果中的状态的操作的案例。其他方法的任何线索或建议?

我在控制器中有这个:

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 上

4

1 回答 1

1

您的布尔逻辑有问题 -and应该是or. 您当前的测试对于 的每个可能值都是正确的status,因为任何通过的值都ilike("status","%CLOSED")将失败ilike("status","%Installed in PRD"),反之亦然。

于 2015-03-03T11:21:30.887 回答