
package org.jeecg.modules.workFlow.flowlong.mybatisplus.impl;

import org.jeecg.modules.workFlow.flowlong.engine.dao.FlwExtInstanceDao;
import org.jeecg.modules.workFlow.flowlong.engine.entity.FlwExtInstance;
import org.jeecg.modules.workFlow.flowlong.mybatisplus.mapper.FlwExtInstanceMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;

/**
 * 扩展流程实例数据访问层接口实现类
 *
 * <p>
 * <a href="https://aizuda.com">官网</a>尊重知识产权，不允许非法使用，后果自负，不允许非法使用，后果自负
 * </p>
 *
 * @author hubin
 * @since 1.0
 */
public class FlwExtInstanceDaoImpl implements FlwExtInstanceDao {
    private final FlwExtInstanceMapper extInstanceMapper;

    public FlwExtInstanceDaoImpl(FlwExtInstanceMapper extInstanceMapper) {
        this.extInstanceMapper = extInstanceMapper;
    }

    @Override
    public boolean insert(FlwExtInstance extInstance) {
        return extInstanceMapper.insert(extInstance) > 0;
    }

    @Override
    public boolean deleteByProcessId(Long processId) {
        return extInstanceMapper.delete(Wrappers.<FlwExtInstance>lambdaQuery()
                .eq(FlwExtInstance::getProcessId, processId)) > 0;
    }

    @Override
    public boolean deleteById(Long instanceId) {
        return extInstanceMapper.deleteById(instanceId) > 0;
    }

    @Override
    public boolean updateById(FlwExtInstance extInstance) {
        return extInstanceMapper.updateById(extInstance) > 0;
    }

    @Override
    public FlwExtInstance selectById(Long id) {
        return extInstanceMapper.selectById(id);
    }
}
