You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
821 B

package com.example.demo.Export;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
public class RefundConverter implements Converter<Integer> {
@Override
public Class<?> supportJavaTypeKey() {
return Integer.class; // 支持的字段类型
}
@Override
public WriteCellData<?> convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
// 将 0 映射为 "否",1 映射为 "是"
String result = (value != null && value == 1) ? "是" : "否";
return new WriteCellData<>(result);
}
}