簡體   English   中英

Grails-createCriteria:關聯+不+ ilike

[英]Grails - createCriteria: associations + not + ilike

一些條件如何:關聯+不+ 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上

您的布爾邏輯有誤- and應為or 當前的測試對於status 每個可能值都是正確的,因為任何通過ilike("status","%CLOSED")都將失敗ilike("status","%Installed in PRD") ,反之亦然。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM