【问题标题】:how can set where condition in list() method in grails如何在 grails 的 list() 方法中设置 where 条件
【发布时间】:2015-08-14 18:02:07
【问题描述】:

我正在使用 list() 方法来获取数据。

<g:select id="complaint" class="form-control chosen-select" multiple="true" name="complaint" from="${settings.Complaint.list()}"optionKey="id" optionValue="name"/>

现在我想获取状态为活动状态的数据作为列表。有没有办法在 list() 中使用条件?

【问题讨论】:

标签: grails grails-orm


【解决方案1】:
def c = vaccination.VaccineBrand.createCriteria()
    def vaccineBrandList = c.list {
        eq("status", "Active")
    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-11-14
    • 2021-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多