package com.ruoyi.common.enums.serializer;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.ruoyi.common.enums.IIntegerEnum;

import java.io.IOException;

public class IIntegerEnumSerializer extends JsonSerializer<IIntegerEnum> {
    @Override
    public void serialize(IIntegerEnum iIntegerEnum, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
        jsonGenerator.writeNumber(Integer.parseInt(iIntegerEnum.getCode().toString()));
    }
}
