删除流程数据表
<h2>脱敏SQL- 流程-请注意删除后无法恢复</h2>
<hr />
<h2>!!!请注意,删除后无法恢复流程,请慎用!!!</h2>
<h3>1.脱敏语句</h3>
<pre><code>truncate table workflow_requestbase
truncate table workflow_requestbase_dellog
truncate table workflow_form
truncate table workflow_formdetail
truncate table workflow_nownode
truncate table workflow_nownode_dellog
truncate table workflow_requestlog
truncate table workflow_requestLog_dellog
truncate table workflow_currentoperator
truncate table workflow_curroperator_dellog
truncate table workflow_requestoperatelog
truncate table workflow_requestselectnextflow
truncate table workflow_requestflowinfo
truncate table workflow_requestflowlog
truncate table workflow_requestviewlog
truncate table workflow_requestdeletelog
truncate table Workflow_SharedScope
truncate table workflow_logviewusers</code></pre>
<p>流程的数据也要清除,formtable<em>main</em>?等表的数据,方法:</p>
<p>1、先清空workflow_form表数据;</p>
<p>2、查询workflow_bill,得到所有的tablename(注意,不是清空该表!!!!)</p>
<p>3、删除步骤2获得的table表数据;</p>
<p>4、查询workflow_billdetailtable 表, 得到detailtable;(注意,不是清空该表!!!!)</p>
<p>5、删除步骤4查询来的table表数据;</p>
<h3>2.保留指定分部流程相关数据处理方式(实现效果,但不是完全清理数据)</h3>
<pre><code>---执行前先备份
---1.清理掉非当前分部人员参与的所有流程基础信息表数据
delete from workflow_requestbase where requestid not in (select requestid from workflow_currentoperator where userid in (select id from hrmresource where subcompanyid1='分部ID'));
---2.清理流程表单数据(可选择不清理)
--查询流程对应数据表
select a.id,workflowname,workflowdesc,workflowtype,version 版本,activeVersionID 活动版本ID,b.tablename from workflow_base a,workflow_bill b where a.formid=b.id order by a.workflowname;
--根据对应查询到的tablename ,不需要保留的流程,删除对应formtable_main_XX表数据即可
truncate table formtable_main_XX;
---3.清理后台流程
--查询所有流程路径设置信息,注意一个流程多个版本的情况
select id,workflowname,workflowdesc,workflowtype,version 版本,activeVersionID 活动版本ID from workflow_base order by workflowname;
--将该分部下的需要保留的路径信息数据的id 用逗号分隔放入括号中,执行下面语句清理掉其他流程,多版本流程ID都要写
delete from workflow_base where id not in (xxx,xxx,xx);</code></pre>