package com.tofly.feesapi.common.constant;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.converters.ReadConverterContext;
import com.alibaba.excel.converters.WriteConverterContext;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.data.WriteCellData;

public class JmyjEnumConverter implements Converter<JmyjEnum> {
    @Override
    public Class<?> supportJavaTypeKey() {
        return JmyjEnum.class;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }

    @Override
    public JmyjEnum convertToJavaData(ReadConverterContext<?> context) {
        // 导入时处理（按需实现）
        return null;
    }

    @Override
    public WriteCellData<?> convertToExcelData(WriteConverterContext<JmyjEnum> context) {
        // 导出时返回desc
        return new WriteCellData<>(context.getValue().getDesc());
    }
}

