package com.nuvole.util;
|
|
import cn.hutool.core.lang.Snowflake;
|
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.RandomUtil;
|
|
/**
|
* @author ChenLong
|
* @version 1.0
|
* @ClassName IdGenerator
|
* @Description id生成器
|
* @date 2019/4/18 11:33
|
*/
|
public class IdGenerator {
|
|
private static Snowflake snowflake;
|
|
public static Long getId() {
|
return snowflake.nextId();
|
}
|
|
static {
|
snowflake = IdUtil.createSnowflake(RandomUtil.randomInt(0, 31), RandomUtil.randomInt(0, 31));
|
}
|
|
public static String getUUID() {
|
|
return IdUtil.simpleUUID();
|
}
|
}
|