需要有关 Grails 域类设计的帮助

发布于 2024-09-11 19:19:31 字数 186 浏览 8 评论 0原文

我需要创建这样的 grails 域类(参见图片),但我不知道该怎么做。有人可以给我解决方案吗?

图片:http://www.uppicweb.com/x/i/ib/ 6演示.jpg

I need to create grails domain class like this(see image),but I don't know how to do. Can someone please give me the solution,please?

Image : http://www.uppicweb.com/x/i/ib/6demo.jpg

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

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

发布评论

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

评论(3

风透绣罗衣 2024-09-18 19:19:37

另外,如果要求您的 id 名称应该是product_id、cart_id 等,那么您必须查看文档如何做到这一点。否则,在 grails 中,默认情况下 id 字段名称仅为 id。

Also, if there is requirement that name of your id should be product_id, cart_id etc then you have to look at the documentation how to do that. Otherwise, in grails by default the id field name is id only.

趁微风不噪 2024-09-18 19:19:35

这很简单。您需要为图片中的每个框创建一个域类。
这意味着:

  • 客户
  • 购物车
  • 产品
  • Product_comment
  • Product_category
  • Bill
  • Bill_item

查看 GORM 文档

然后您可以使用脚手架创建控制器并开始玩。

It's quite simple. You need to create a domain class for each box in your picture.
That means:

  • Customer
  • Cart
  • Product
  • Product_comment
  • Product_category
  • Bill
  • Bill_item

Take a look on GORM documentation.

Then you can create controllers with scaffolding and start to play.

攒眉千度 2024-09-18 19:19:34

从图中可以看出,您不需要单个域类。您的图像中的每个框都需要一个。因此,您将拥有“Customer”域对象、“ProductComment”、“Product”等,并且您将通过 Grails 文档第 5 章中讨论的技术将它们关联起来。

互联网上应该有很多关于此的信息,您可以从这里开始:

http://grails.org/文档/最新/

From the picture, you don't need a single domain class. You need one for every box in your image. So you would have a 'Customer' domain object, 'ProductComment', 'Product', etc, and you would relate them via the techniques discussed in chapter 5 of the Grails documentaiton.

There should be plenty of information on the interwebs about this, you can start here:

http://grails.org/doc/latest/

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