gpt4 book ai didi

grails - 从Groovy中的对象列表中收集值

转载 作者:行者123 更新时间:2023-12-02 14:53:52 28 4
gpt4 key购买 nike

我有这样的方法

static getList (long colorid) {
ColorShades.findAll 'from ColorShades where color.id = :colorid', [colorid: colorid]
}

我正在这样使用它:
def shadeIdsForAColor = ColorShades.getList(colorid as long)

问题

该方法返回 ArrayList对象的 ColorShade,每个对象都带有一个 shadeId

如何将这些ID作为整数列表放入 shadeIdsForAColor变量中?

最佳答案

这不是吗?

def shadeIdsForAColor = ColorShades.getList(colorid as long).shadeId

关于grails - 从Groovy中的对象列表中收集值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14983850/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com