/**
* uid 生成器
* uid作为数据库主键 最好有序递增
*/
public class IdProvider {
// id类型 0-99
public enum IdType {
PRINCE(1), // 皇子
PRINCE_TALENT(2), // 皇子天赋
PRINCE_FETTER(3), // 皇子羁绊
PRINCE_FETTER_LOG(4), // 皇子羁绊记录
;
final int type;
IdType(int type) {
this.type = type;
}
}
/**
* 原子递增 保证同一时刻唯一(取值范围越大,越唯一)
*/
private static final AtomicInteger FLAG = new AtomicInteger
uid 生成器(数据区主键)
于 2022-12-15 17:31:10 首次发布