gpt4 book ai didi

grails - Grails:按详细信息域字段控制主域字段[hasMany]

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

有域:

class Order {
static hasMany = [execDepartments: Department]
String orderNo
//boolean signature
...
}

class Department {
String name
...
}

我想为Order添加 bool(boolean) 签名字段,但是要按部门添加,因此我需要为execDepartments添加字段签名。可能吗?请帮忙。

最佳答案

这是m:m关系吗?

为什么不创建另一个域,如

class Order {
static hasMany = [execDepartments: DepartmentOrder]
String orderNo
//boolean signature
...
}

class DepartmentOrder{
boolean signature
Order order
Department department
}

class Department {
String name
static hasMany = [execOrders: DepartmentOrder]
}

然后你可以写belongeTo

关于grails - Grails:按详细信息域字段控制主域字段[hasMany],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7887809/

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