简体   繁体   English

数据库表设计问题

[英]Database Table design problem

Scenario: There is a hierarchy of PROCESS . Scenario:存在PROCESS的层次结构。 Like 喜欢

PR-2, PR-3 are children of Pr-1 , PR-2, PR-3 are children of Pr-1

PR-4, PR-5 are children of PR-2

Now the leaf processes (in our case PR-3, PR-4 and PR-5 can be described in terms of series of ACTIVITY 现在, leaf processes (in our case PR-3, PR-4 and PR-5可以按照ACTIVITY系列进行描述

Now, ACTIVITY is just a child of PROCESS but has some extra attributes, so 现在, ACTIVITY只是PROCESS的子级,但具有一些额外的属性,因此

Should I make two diff. 我应该做两个比较。 tables in the database (one for ACTIVITY and one for PROCESS )? 数据库中的表(一个用于ACTIVITY ,一个用于PROCESS )?

or 要么

Should I add some fields (for extra attributes of ACTIVITIY ) in the PROCESS table and store the ACTIVITY in PROCESS table. 我应该在PROCESS表中添加一些字段(用于ACTIVITIY额外属性),并将ACTIVITY存储在PROCESS表中。

=================================== EDITED ====================================== ==================================已编辑=============== ========================

Actually, here PROCESS AND ACTIVITY are the one's that involved in BPM (Businees Process Management) 实际上,这里的PROCESSACTIVITY是BPM(业务流程管理)所涉及的PROCESSACTIVITY

Those who have knowledge of BPM can figure out what ACTIVITY AND PROCESS are. 那些了解BPM的人可以弄清楚什么是ACTIVITYPROCESS

Those who don't know BPM , I explain you what I mean by PROCESS and ACTIVITY . 那些不知道BPM ,我向您解释PROCESSACTIVITY含义。

Any enterprise has various PROCESS es (like CustomerOrderPlaced, CustomerOrderCancelled etc.) and ACTIVIT ies are like parts of a process which are to be performed to complete the process. 任何企业都具有各种PROCESS (例如CustomerOrderPlaced,CustomerOrderCancelled等),而ACTIVIT就像流程的一部分,将执行该流程以完成流程。

So, ACTIVITY is a child of PROCESS with some extra attributes. 因此, ACTIVITYPROCESS的子级,具有一些额外的属性。

Or in terms of Java, ACTIVITY extends PROCESS 或就Java而言,ACTIVITY扩展了PROCESS

As soon as you say " ACTIVITY are like parts of a process", " ACTIVITY extends PROCESS " is no longer a valid statement. 只要你说“ ACTIVITY就像是过程的一部分 ”,“ ACTIVITY扩展PROCESS ”不再是一个有效的语句。 It's not an is-a relationship. 这不是一种关系。 It's a has-a relationship. 这是一种有关系的关系。

In ER terms there is a one-to-many relationship between Process and Activity. 用ER术语来说,流程和活动之间存在一对多的关系。 Or possibly a many-to-many relationship if one Activity belongs to multiple Processes. 如果一个活动属于多个流程,则可能是多对多关系。

For example, CustomerPlacesOrder is a Process. 例如,CustomerPlacesOrder是一个流程。 The Activities are: 这些活动是:

  • Customer fills shopping Cart; 客户填充购物车;
  • Customer checks out; 客户结帐;
  • Customer enters delivery and billing info, registering if necessary; 客户输入交货和账单信息,必要时进行注册;
  • Worker receives order; 工人接到命令;
  • If the items are in stock, the Worker selects an appropriate packing container and fills it; 如果物品有库存,则工人选择合适的包装容器并填充;
  • Worker send it on the daily deliveries. 工人每天交货时发送。

Or however complicated you want to get. 或无论您想要变得多么复杂。 Inheritance this is not. 继承不是。

You should have multiple tables. 您应该有多个表。 The tables can be like below: 表格如下所示:

ProcessTable 工艺表

ID (Primary Key) ID (主密钥)
ProcessName 流程名称
ProcessCode ... ProcessCode ...

ActivityTable 活动表

ID (Primary Key) ID (主密钥)
ActivityName 活动名称
ActivityCode 活动代码
ActivityDesc 活动描述
ProcessID (Foreign Key to ProcessTable) ... ProcessID (ProcessTable的外键)...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM