Open jet-789 opened 1 year ago
@Override
public WriteCellData<?> convertToExcelData(WriteConverterContext context) {
if (commonService != null) {
Map<String, String> categoryMap = commonService.categoryMap();
if (categoryMap.containsKey(context.getValue())) {
WriteCellData writeCellData = new WriteCellData<>(categoryMap.get(context.getValue()));
return writeCellData;
}
}
return new WriteCellData<>("");
}
package org.jeecg.modules.aq.vo;
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; import org.jeecg.modules.aq.service.CommonService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component;
/**
@author Jiaju Zhuang */ @Component public class CustomStringStringConverter implements Converter {
@Autowired private CommonService commonService;
@Override public Class<?> supportJavaTypeKey() { return String.class; }
@Override public CellDataTypeEnum supportExcelTypeKey() { return CellDataTypeEnum.STRING; }
/**
/**
}