package io.geekidea.springbootplus.framework.shiro.util;

import cn.hutool.core.lang.Snowflake;

/**
 * 雪花算法 获取id工具类
 *
 * @author
 */
public class SnowflakeUtil {

    private static final Snowflake SNOWFLAKE = new Snowflake(1L, 1L);

    /**
     * 多线程中加synchronized 保证不会获取重复id
     *
     * @return
     */
    public static synchronized Long getId() {

        return SNOWFLAKE.nextId();
    }
}
