package com.yunzhupaas.engine.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.engine.entity.FlowEventLogEntity;
import com.yunzhupaas.engine.mapper.FlowEventLogMapper;
import com.yunzhupaas.engine.service.FlowEventLogService;
import com.yunzhupaas.util.RandomUtil;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 流程事件日志
 *
 * @author 云筑产品开发平台组
 * @version V3.1.0
 * @copyright 深圳市乐程软件有限公司
 */
@Service
public class FlowEventLogServiceImpl extends SuperServiceImpl<FlowEventLogMapper, FlowEventLogEntity> implements FlowEventLogService {


    @Override
    public void create(FlowEventLogEntity entity) {
        entity.setId(RandomUtil.uuId());
        this.save(entity);
    }

    @Override
    public List<FlowEventLogEntity> getList(List<String> nodeIdList) {
        QueryWrapper<FlowEventLogEntity> queryWrapper = new QueryWrapper<>();
        if (nodeIdList.size() > 0) {
            queryWrapper.lambda().in(FlowEventLogEntity::getTaskNodeId, nodeIdList);
        }
        return this.list(queryWrapper);
    }
}

