Grails:主域字段按详细域字段 [hasMany]

发布于 2024-12-12 07:45:10 字数 260 浏览 0 评论 0原文

有域:

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

class Department {
  String name
  ...
}

我想为订单添加布尔签名字段,但按部门添加,因此我需要 execDepartments 为订单添加字段签名。是否可以?请帮忙。

There are domains:

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

class Department {
  String name
  ...
}

I want to add boolean signature field for Order but by Department, so I need field signature by execDepartments for Order. Is it possible? Please help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无名指的心愿 2024-12-19 07:45:10

这是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]
}

然后你可以写belongTo

Is this an m:m relationship?

why not create another domain like

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]
}

Then you can write the belongTo

ら栖息 2024-12-19 07:45:10

您需要的是 Order 域中的签名列表。
可能是一个将签名映射到订单的 OrderSignature 域。

What you need is a list of signatures in the Order domain.
Possibly an OrderSignature domain that maps signatures to orders.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文