公司及 联系人对象设计帮助

发布于 2024-07-17 23:39:33 字数 636 浏览 9 评论 0原文

我希望有人(或某些人)可以帮助我们解决我们已经争论了几天的问题。 给定附图,如何组织我们的业务对象?

我们正在寻求任何帮助(关于在哪里或如何搜索我们可以使用的设计模式/对象模型来解决此问题的想法。我们的情况稍微复杂一些,但我们已尝试为了提出这个问题,我们可以尽可能地简化它

: 有些公司有产品线,有些则没有。
每家公司都有一份联系人名单。 如果一家公司至少拥有一条产品线,则其中一些公司联系人也与至少一条产品线相关联。
一些联系人是其他联系人的参考(业务/个人)。
每个公司和每个联系人可以有零个或多个地址。

感谢您帮助寻找更合适的解决方案(我的假设是我们需要使用多个模型/模式)。

实体图

图表大视图 (flickr.com)

**(来自图表)我们公司的员工/内部应用程序用户包含在联系人中,因为他们也可以作为参考资料等。

I am hoping that someone (or some people) could help us with a problem that we have wrangled with for a few days. How to organize our business objects given the attached diagram?

We are looking for any assistance (ideas about where to or how to search for the design pattern(s)/object model(s) we could use in order to solve this problem. Our situation is slightly more complex, but we have tried to simplify it best we could for the purposes of asking this question.

Some Details:
Some companies have product lines and some don't.
Each company has a list of contacts. If a company has at least one product line, some of those company contacts are ALSO associated with at least one product line.
A few of the contacts are references (business/personal) for other contacts.
Each company and each contact can have zero or more addresses.

Thank you for any assistance finding a more appropriate solution (My assumption is that we will need to use multiple models/patterns).

Entity Diagram

Larger view of diagram (flickr.com)

** (from the diagram) Our company has employees/internal application users who are included with contacts because they can also be references, etc.

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

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

发布评论

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

评论(3

墨洒年华 2024-07-24 23:39:33

您可以使用以下对象模型:

Organization
-id
-name
-description
-productLines ( collection object consisting of products)
-orgcontacts ( collection object consisting of contacts)
-addresses (of type Address, can be a collection depends on business rule)

Contact
-id
-name
-type (Business, personal, etc)
-parentID (null if no reference)
-adresses (Address or collection)

ProductLine
-id
-name
-prLineContacts ( collection object consisting of contacts)

您可以在我能想到的这个基本模型上进行构建。 你有数据模式吗? 如果是这样,您应该决定从哪里开始。 有些人喜欢对象和数据模型之间的一对一映射,有些人希望根据性能设计数据模式,然后在对象和数据库之间有另一个抽象映射。

You can use the following object model:

Organization
-id
-name
-description
-productLines ( collection object consisting of products)
-orgcontacts ( collection object consisting of contacts)
-addresses (of type Address, can be a collection depends on business rule)

Contact
-id
-name
-type (Business, personal, etc)
-parentID (null if no reference)
-adresses (Address or collection)

ProductLine
-id
-name
-prLineContacts ( collection object consisting of contacts)

You can build on this basic model that I can think of. Do you have a data schema? if so, you should decide where to start. Some people like 1-1 mapping between their object and data model and some want to design their data schema based on performance and then have another abstraction mapping between objects and database.

为你拒绝所有暧昧 2024-07-24 23:39:33

如果您尝试设计数据库,我会这样做:

Companies = [id, name]
Contacts = [id, name]
Products = [id, name]
Adresses = [id, details]

CompaniesContacts = [contact_id, company_id]
CompaniesProducts = [product_id, company_id]
AdressesContacts = [contact_id, address_id]

References = [contact_id, referenced] // referenced is also a contact_id

另外,我建议使用 UML。 这只是一个快速回答,请尝试更新您的问题,我会稍微更新一下。

If you are trying to desing a database, I'd do it that way :

Companies = [id, name]
Contacts = [id, name]
Products = [id, name]
Adresses = [id, details]

CompaniesContacts = [contact_id, company_id]
CompaniesProducts = [product_id, company_id]
AdressesContacts = [contact_id, address_id]

References = [contact_id, referenced] // referenced is also a contact_id

Also, I'd recommend using UML. It's just a quick answer, try to update your question and I'll update it a bit.

手长情犹 2024-07-24 23:39:33

我们的应用程序中有类似的结构,并且它对我们来说效果很好。
我们有两个额外的表

我们有公司和地址之间的站点概念,人们可以在我们的架构中附加一个或多个站点,这样可以节省存储数千个重复地址。 您也可以直接在地址簿中引用客户地址。

您在哪里存储联系方式?

We have a similar structure in our application and it works well for us.
We have two extra tables

We have the concept of Sites between the company and addresses people can be attached one or more sites in our schema and that saves storing thousands of duplicate addresses. You could reference the client address direct in an addressbook too.

Where are you storing contact details ?

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