22 lines
442 B
Java
22 lines
442 B
Java
package top.rayc.utility.id;
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
public class DistributedId {
|
|
|
|
private static DistributedId instance = new DistributedId();
|
|
|
|
public String getFastSimpleUUID(){
|
|
return IdUtil.fastSimpleUUID();
|
|
}
|
|
|
|
public Long getSnowflake(long workerId, long datacenterId){
|
|
return IdUtil.createSnowflake(workerId, datacenterId).nextId();
|
|
}
|
|
|
|
public static DistributedId getInstance(){
|
|
return instance;
|
|
}
|
|
|
|
}
|