【问题标题】:Grails where query criteria qualificationGrails where 查询条件限定
【发布时间】:2012-07-19 22:26:15
【问题描述】:

当 Grails where 查询条件中的方法参数与域属性名称相同时,有没有办法对它们进行限定?

例如:

def getPeople(age, sex) {
    People.find { age == age && sex == sex }
}

【问题讨论】:

    标签: grails grails-orm


    【解决方案1】:

    像这样!?

    def getPeople(age, sex) {
        People.find { delegate.age == age && delegate.sex == sex }
    }
    

    【讨论】:

      猜你喜欢
      • 2011-04-26
      • 1970-01-01
      • 2018-08-14
      • 2021-09-18
      • 2014-10-04
      • 1970-01-01
      • 2023-01-25
      • 1970-01-01
      • 2015-08-12
      相关资源
      最近更新 更多