package com.zd.common.core.utils;

import java.util.UUID;

/**
 * id生成工具类
 * @author Administrator
 */
public class IdGen {
    private IdGen() {
        throw new IllegalStateException("IdGen class");
    }
    /**
     * 封装JDK自带的UUID, 中间无-分割.
     */
    public static String uuid() {
        return UUID.randomUUID().toString().replace("-", "");
    }
    /**
     * 基于snowflake算法生成ID
     * @return String
     */
    public static long snowflakeId() {
        return SpringUtils.getApplicationContext().getBean(SnowflakeIdWorker.class).nextId();
    }
}