gpt4 book ai didi

grails - Grails GORM系列

转载 作者:行者123 更新时间:2023-12-02 15:35:50 24 4
gpt4 key购买 nike

可以说我必须Grails域类:Car和Person。

class Car {
String model
...
Person driver
}

class Person {
String firstName
String lastName
}

我有一组人:
Set < Person >

如何获得具有该集合中驱动程序的所有Car实例的列表?

最佳答案

所以我假设您有一组像这样的人物对象:

def people = [person1, person2, person3]

并且您要检索所有具有以下三个驾驶员之一的汽车:
def cars = Car.findAllByDriverInList(people)

只要人员列表中的对象是人员域的实例,您就应该很好。

关于grails - Grails GORM系列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10834122/

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