package cn.axzo.workflow.core.engine.persistence;

import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.flowable.engine.impl.persistence.entity.data.impl.MybatisHistoricProcessInstanceDataManager;

import java.util.List;
import java.util.Map;

/**
 * Native Sql execute keyword `distinct`
 *
 * @author wangli
 * @since 06/03/2024 6:07 pm
 */
public class CustomMybatisHistoricProcessInstanceDataManager extends MybatisHistoricProcessInstanceDataManager {
    public CustomMybatisHistoricProcessInstanceDataManager(ProcessEngineConfigurationImpl processEngineConfiguration) {
        super(processEngineConfiguration);
    }

    @Override
    @SuppressWarnings("unchecked")
    public List<HistoricProcessInstance> findHistoricProcessInstancesByNativeQuery(Map<String, Object> parameterMap) {
        return getDbSqlSession().selectListWithRawParameterNoCacheLoadAndStore(
                "selectHistoricProcessInstanceByNativeQuery", parameterMap);
    }
}
