| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- 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<EventLogMapper, EventLogEntity> implements EventLogService {
- @Override
- public List<EventLogEntity> getList(String taskId) {
- return getList(taskId, null);
- }
- @Override
- public List<EventLogEntity> getList(String taskId, List<String> nodeCode) {
- if (StringUtil.isBlank(taskId)) {
- return new ArrayList<>();
- }
- QueryWrapper<EventLogEntity> 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<String> nodeCode) {
- if (StringUtil.isBlank(taskId)) {
- return;
- }
- QueryWrapper<EventLogEntity> 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);
- }
- }
|