package jnpf.flowable.service.impl; import cn.hutool.core.collection.CollectionUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import jnpf.base.service.SuperServiceImpl; import jnpf.flowable.entity.EventLogEntity; import jnpf.flowable.mapper.EventLogMapper; import jnpf.flowable.service.EventLogService; import jnpf.util.RandomUtil; import jnpf.util.StringUtil; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Date; import java.util.List; @Service public class EventLogServiceImpl extends SuperServiceImpl implements EventLogService { @Override public List getList(String taskId) { return getList(taskId, null); } @Override public List getList(String taskId, List nodeCode) { if (StringUtil.isBlank(taskId)) { return new ArrayList<>(); } QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().eq(EventLogEntity::getTaskId, taskId); if (CollectionUtil.isNotEmpty(nodeCode)) { queryWrapper.lambda().in(EventLogEntity::getNodeCode, nodeCode); } queryWrapper.lambda().orderByDesc(EventLogEntity::getCreatorTime); return this.list(queryWrapper); } @Override public void delete(String taskId, List nodeCode) { if (StringUtil.isBlank(taskId)) { return; } QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().eq(EventLogEntity::getTaskId, taskId); if (CollectionUtil.isNotEmpty(nodeCode)) { queryWrapper.lambda().in(EventLogEntity::getNodeCode, nodeCode); } this.remove(queryWrapper); } @Override public void create(EventLogEntity entity) { if (StringUtil.isEmpty(entity.getId())) { entity.setId(RandomUtil.uuId()); } entity.setCreatorTime(new Date()); entity.setSortCode(0L); this.save(entity); } }