package com.kym.common.config;

import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.kym.common.utils.IDGenerator;
import org.springframework.stereotype.Component;

/**
 * @author skyline
 * @description 数据库自定义ID生成
 * @date 2023-08-12 15:28
 */
@Component
public class CustomIdGenerator implements IdentifierGenerator {

    private IDGenerator idGenerator;

    public CustomIdGenerator() {
        this.idGenerator = new IDGenerator(0, 0);
    }

    @Override
    public Long nextId(Object entity) {
        final long id = idGenerator.nextId();
        return id;
    }
}