package com.kcim.common.util;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;

/**
 * @desc 雪花生成主键id可以拓展
 * @version 1.0
 * @Author hhz
 * @time 2020/6/23
 */
public class SnowflakeUtil {
    //成本 workid 3
    // workId 和 datacenterId 暂定1
    public static Long getId(){
        Snowflake snowflake = IdUtil.getSnowflake(3, 1);
        return snowflake.nextId();
    }

    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            System.out.println(getId());
        }
    }


}
