forked from sfms3.0/sfms3.0
4 changed files with 60 additions and 4 deletions
@ -0,0 +1,34 @@ |
|||||
|
package com.win.framework.excel.core.convert; |
||||
|
|
||||
|
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 com.win.framework.common.enums.CommonStatusEnum; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
|
||||
|
@Slf4j |
||||
|
public class CommonStatusConverter implements Converter<Object> { |
||||
|
|
||||
|
@Override |
||||
|
public Class<?> supportJavaTypeKey() { |
||||
|
throw new UnsupportedOperationException("暂不支持,也不需要"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public CellDataTypeEnum supportExcelTypeKey() { |
||||
|
throw new UnsupportedOperationException("暂不支持,也不需要"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Integer convertToJavaData(ReadConverterContext<?> context) { |
||||
|
return CommonStatusEnum.convert(context.getReadCellData().getStringValue()).getStatus(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public WriteCellData<Object> convertToExcelData(WriteConverterContext<Object> context) { |
||||
|
return new WriteCellData<>(CommonStatusEnum.convert(Integer.parseInt(String.valueOf(context.getValue()))).getName()); |
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue