-
-
Save geosmart/5413041 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 更改流程实例的流程定义ID | |
* @param processInstanceId | |
* @param processDefinitionId | |
*/ | |
@Transactional | |
public void changeProcessDefinitionId(String processInstanceId, String processDefinitionId) { | |
long count = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).count(); | |
if (count == 0) { | |
throw new ServiceException("指定的流程定义不存在!"); | |
} | |
Session session = processInstanceDao.getSession(); | |
session.createSQLQuery("update ACT_RU_EXECUTION set PROC_DEF_ID_ = ? where PROC_INST_ID_ = ?").setParameter(0, processDefinitionId).setParameter(1, processInstanceId).executeUpdate(); | |
session.createSQLQuery("update ACT_RU_TASK set PROC_DEF_ID_ = ? where PROC_INST_ID_ = ?").setParameter(0, processDefinitionId).setParameter(1, processInstanceId).executeUpdate(); | |
session.createSQLQuery("update ACT_HI_PROCINST set PROC_DEF_ID_ = ? where PROC_INST_ID_ = ?").setParameter(0, processDefinitionId).setParameter(1, processInstanceId).executeUpdate(); | |
session.createSQLQuery("update ACT_HI_TASKINST set PROC_DEF_ID_ = ? where PROC_INST_ID_ = ?").setParameter(0, processDefinitionId).setParameter(1, processInstanceId).executeUpdate(); | |
session.createSQLQuery("update ACT_HI_ACTINST set PROC_DEF_ID_ = ? where PROC_INST_ID_ = ?").setParameter(0, processDefinitionId).setParameter(1, processInstanceId).executeUpdate(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment