wang-hao-jie
2021-10-19 e48043a2df9ca0c73fe18298bab3c4d42ca5c0c7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package cn.exrick.xboot.core.common.utils;
 
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import lombok.extern.slf4j.Slf4j;
 
/**
 * @author Exrickx
 */
@Slf4j
public class SnowFlakeUtil {
 
    /**
     * 派号器workid:0~31
     * 机房datacenterid:0~31
     */
    private static Snowflake snowflake = IdUtil.createSnowflake(1, 1);
 
    public static Long nextId() {
        return snowflake.nextId();
    }
}