背景:
因为垃圾数据太大,导致流程引擎查询待办查询超过3S,用户取消的数据也需要进行硬删除,减少流程引擎数据占用,加快查询速度
删除流程引擎数据相关表:
–查询已有工作流数据
select * from act_evt_log where proc_inst_id_ = '实例id';
select * from act_hi_actinst where proc_inst_id_ = '实例id';
select * from act_hi_attachment where proc_inst_id_ = '实例id';
select * from act_hi_comment where proc_inst_id_ = '实例id';
select * from act_hi_detail where proc_inst_id_ = '实例id';
select * from act_hi_identitylink where proc_inst_id_ = '实例id';
select * from act_hi_procinst where proc_inst_id_ = '实例id';
select * from act_hi_taskinst where proc_inst_id_ = '实例id';
select * from act_hi_varinst where proc_inst_id_ = '实例id';
select * from act_ru_event_subscr where proc_inst_id_ = '实例id';
select * from act_ru_execution where proc_inst_id_ = '实例id';
select * from act_ru_identitylink where proc_inst_id_ = '实例id';
select * from act_ru_task where proc_inst_id_ = '实例id';
select * from act_ru_variable where proc_inst_id_ = '实例id';
因为数据量太大,只能输入proc_inst_id_ 跑代码来进行删除
代码如下:
@Autowired
private RuntimeService runtimeService;
@Autowired
private HistoryService historyService;
// 执行此方法后未审批的任务 act_ru_task 会被删除,流程历史 act_hi_taskinst 不会被删除,并且流程历史的状态为finished完成
runtimeService.deleteProcessInstance(id, "用户撤销");
//删除流程历史信息 该接口流程数据会直接硬删除,包括历史数据,调用请慎重
historyService.deleteHistoricProcessInstance(id);
引用:
Activiti;如何删除工作流/流程引擎 act_hi_procinst 错误实例数据 proc_inst_id_
activiti 撤销