ny
昨天 b6f169fe43a2b13f351aefc152374fc7f0bc8cb7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package jnpf.flowable.mapper;
 
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import jnpf.base.mapper.SuperMapper;
import jnpf.flowable.entity.EventLogEntity;
import jnpf.util.RandomUtil;
import jnpf.util.StringUtil;
 
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
 
public interface EventLogMapper extends SuperMapper<EventLogEntity> {
 
    default List<EventLogEntity> getList(String taskId) {
        return getList(taskId, null);
    }
 
    default 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.selectList(queryWrapper);
    }
 
    default 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.delete(queryWrapper);
    }
 
    default void create(EventLogEntity entity) {
        if (StringUtil.isEmpty(entity.getId())) {
            entity.setId(RandomUtil.uuId());
        }
        entity.setCreatorTime(new Date());
        entity.setSortCode(0L);
        this.insert(entity);
    }
}