--主表单
select * from ce_administration_procure t where t.id ='HZe992733d668dc6013d671df4760349';
--流程实例表:记录创建的流程基本信息与当前表单名称的信息
select * from TW_HORIZON_Instance t where t.id = 'HZe992733d668dc6013d671df4600347';
--节点表:记录节点状态、节点名称、节点编码等信息;workid为TW_HORIZON_Instance的id
select * from  tw_horizon_author t where t.workid = 'HZe992733d668dc6013d671df4600347';
--主表单与流程表、节点表的中间关系表;workid为TW_HORIZON_Instance的id,dataid为ce_administration_procure的id
select * from twr_horizon_instance t where t.dataid = 'HZe992733d668dc6013d671df4760349';
--记录流程走向与审批流向过程信息:例如上一节点办理人、当前节点办理人;DATAID为TW_HORIZON_Instance的id
select a.* from vd_horizon_todo a  where a.DATAID='HZe992733d668dc6013d671df4600347';

--中间表:TW_HORIZON_Instance与vd_horizon_todo的中间表,
--TW_HORIZON_Instance A 、vd_horizon_todo  B 、 TD_HORIZON_User C
--A.id = B.dataid   A.id = C.dataid  B.id = C.todoid
--由于A、B表可以不通过C表关联,并且中间表的流程状态、当前办理人id在B表中已经存在,所以可以不使用C表
select * from TD_HORIZON_User E where dataid='HZe992733d668dc6013d671df4600347';

--与vd_horizon_todo表存储的信息基本相同,不过没有realuserid字段(当前办理人id);DATAID为TW_HORIZON_Instance的id
select * from TD_HORIZON_Info a where a.DATAID='HZe992733d668dc6013d671df4600347';
--当前流程所处节点的实例信息; id为TW_HORIZON_Instance表的id
select * from vd_horizon_instance d where id='HZe992733d668dc6013d671df4600347';

--状态:TD_HORIZON_User、tw_horizon_author
--status状态:1为待办,2、6为待阅,3为已办,4为已阅,5为删除
--TW_HORIZON_AUTHOR D d.flowstatus = 0
--flowstatus状态:0=起草,1=正常,2=会签,3=退回,4=拿回,5=子流程启动中,7=正常结束,8=异常结束,900X=暂停中(X 表示暂停前的流程状态),1000X=已撤销(X 表示撤销前的流程状态)

--使用到的表:A ce_administration_procure(使用id)、B TW_HORIZON_Instance(使用id)、C twr_horizon_instance(中间表使用workid、dataid)、D tw_horizon_author(使用flowstatus)、E TD_HORIZON_User(使用userid、status)
--A.id = C.dataid  B.id = C.workid  C.workid=D.workid  C.workid=E.dataid

--<input type=checkbox name=ids value='|b.id|'>

--ce_administration_procure A,TW_HORIZON_Instance B,TWR_HORIZON_Instance C,TW_HORIZON_AUTHOR D,TD_HORIZON_User E

--a.id = c.dataid and b.id = c.workid and c.workid = d.workid and c.workid = e.dataid and d.flowstatus !='0' and a.apply_type != '区域保洁' and e.userid='|userid|' and (e.status='2' or  e.status='6')

delete from ce_administration_detail

--删除某条业务数据
--1、查询业务表id
select a.id  from ce_administration_procure a;
--2、查询中间表C表的workid
select c.workid from twr_horizon_instance c where c.dataid='';
--3、删除B、D、E表数据
delete from TW_HORIZON_Instance b where b.id='';
delete from tw_horizon_author d where d.workid='';
delete from TD_HORIZON_User e where e.dataid='';
--4、删除中间表C表数据
delete from twr_horizon_instance c where c.dataid='';
--5、删除业务表A表数据
delete from ce_administration_procure a where a.id='';

--删除所有业务数据
--1、查询业务表id
select a.id  from ce_administration_procure a;
--2、查询中间表C表的workid
select c.workid from twr_horizon_instance c where c.dataid in(select a.id  from ce_administration_procure a);
--3、删除B、D、E表数据
delete from TW_HORIZON_Instance b where b.id in(select c.workid from twr_horizon_instance c where c.dataid in(select a.id  from ce_administration_procure a));
delete from tw_horizon_author d where d.workid  in(select c.workid from twr_horizon_instance c where c.dataid in(select a.id  from ce_administration_procure a));
delete from TD_HORIZON_User e where e.dataid  in(select c.workid from twr_horizon_instance c where c.dataid in(select a.id  from ce_administration_procure a));
--4、删除中间表C表数据
delete from twr_horizon_instance c where c.dataid in(select a.id  from ce_administration_procure a);
--5、删除业务表A表数据
delete from ce_administration_procure a;

04-24 20:48