一级节点 -> 二级节点
节点一 : 节点任务一 、 节点任务二 、 节点任务三
节点二 : 节点任务一 、 节点任务二 、 节点任务三 、 节点任务四 、 节点任务五 、 节点任务六
节点三 : 节点任务一 、 节点任务二
节点四 : 节点任务一
节点五 : 节点任务一 、 节点任务二 、 节点任务三 、 节点任务四业务模式是这样的:节点分为两级,一级节点下设有多个并联的二级节点(二级节点数量不定)
每一个业务都要按照一级节点顺序来走,每个节点都必须走,每个节点中的任务也是必须走的,但是可以不按顺序,也就是说二级节点的所有任务可以并发执行,该节点下的所有任务都执行完了就可以跳到下一个节点以前的设计是只有一级节点,其中关于业务的许多报表不能统计
现在想升级一下换个模式,但不知如何设计数据库结构比较合理?
解决方案 »
- [Help]ActiveX可以通过回调函数,来向JS发消息么?
- asp.net站点发布的两种编译方式
- [高分求解]我的asp.net ajax中的accordion控件总是会出问题,说是没有初始化什么的?
- 请教怎么在原来的项目中使用atlas
- datagrid 取值
- ●●●● 如何实现B/S结构网站即时通讯功能 ●●●●
- 哪里有《ASP.NET技术内幕》的源代码?
- 利用 SharpZipLib解压缩 int size = 2048 啥意思
- 微软太强!一个小问题!
- 高手们.谁给我一个有关ASP.NET开发的电子书下载的地址啊.顺变再帮我解决一个问题?*^_^*
- ASP.NET怎样判断操作系统版本?
- ajax中的AutoComplete控件问题
--参考一下Oracle树型查找的例子:drop table test_tree;
create table test_tree
(
userid number(8) not null primary key,
username varchar2(18) not null,
p_username varchar2(18),
num number(10,2)
);
insert into test_tree values(1,'1000',null,null);
insert into test_tree values(2,'1100','1000',null);
insert into test_tree values(3,'1200','1000',null);
insert into test_tree values(4,'1101','1100',100);
insert into test_tree values(5,'1102','1100',200);
insert into test_tree values(6,'1104','1100',250);
insert into test_tree values(7,'1201','1200',150);
insert into test_tree values(8,'1205','1200',200);
insert into test_tree values(9,'1207','1200',150);
commit; select * from test_tree;
select b.username,
b.p_username,
(select distinct sum(nvl(a.num, 0))
from test_tree a
start with a.username = b.username
connect by a.p_username = prior a.username) sum
from test_tree b
start with username = '1000'
connect by p_username = prior username;
--楼主是不是这个意思?SQL> select * from test_tree; USERID USERNAME P_USERNAME NUM
--------- ------------------ ------------------ ------------
1 1000
2 1100 1000
3 1200 1000
4 1101 1100 100.00
5 1102 1100 200.00
6 1104 1100 250.00
7 1201 1200 150.00
8 1205 1200 200.00
9 1207 1200 150.009 rows selectedSQL>
SQL> select b.username,
2 b.p_username,
3 (select distinct sum(nvl(a.num, 0))
4 from test_tree a
5 start with a.username = b.username
6 connect by a.p_username = prior a.username) sum
7 from test_tree b
8 start with username = '1000'
9 connect by p_username = prior username;USERNAME P_USERNAME SUM
------------------ ------------------ ----------
1000 1050
1100 1000 550
1101 1100 100
1102 1100 200
1104 1100 250
1200 1000 500
1201 1200 150
1205 1200 200
1207 1200 1509 rows selectedSQL>
实际业务就是这样的,只不过在每个节点再附带一些业务信息而已
保存业务的每个节点提交信息以前的思路是这样的:流程表(以前只有一级节点):
ID,顺序编号
yName,节点名称
yOrder,节点顺序业务表
ID,自动编号
yName,所处节点
...,各种业务信息每条业务记录都会按照流程表中的节点顺序把所有节点走完,不过节点只有一级
现在想再细化一下每个节点的任务,就是增加二级节点
不知道这个表怎么设计比较合适
应该说业务节点只有一级节点,所有的任务可以被称为二级节点
这样的话,是不是那个从表就不用了?!
id(本节点) pid(父节点)
1 0
2 1
3 1
4 1
5 0
6 5
7 5
......节点与任务节点的区别是
节点的父节点是NULL 或 0 ;
任务节点的父节点是具体值