package com.tykj.base.entity;

import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.id.SequenceGenerator;

import java.io.Serializable;
import java.util.HashMap;

/**
 * @author HuangXiahao
 * @version V1.0
 * @class UUIDHexGenerator
 * @packageName com.tykj.base.entity
 **/
public class XMQGenerator extends SequenceGenerator {

    public XMQGenerator () {
        super();
    }

    @Override
    public Serializable generate(SharedSessionContractImplementor s, Object obj) {
        if (obj instanceof HashMap){
            HashMap hashMap = (HashMap) obj;
            if (hashMap.containsKey("id")){
                return (Serializable) hashMap.get("id");
            };
        }
        return super.generate(s, obj);
    }

}
