门店管理-excel类型转换
This commit is contained in:
		| @ -0,0 +1,43 @@ | ||||
| package cn.iocoder.yudao.framework.excel.core.convert; | ||||
|  | ||||
| import cn.hutool.core.convert.Convert; | ||||
| import cn.iocoder.yudao.framework.ip.core.Area; | ||||
| import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; | ||||
| import com.alibaba.excel.converters.Converter; | ||||
| import com.alibaba.excel.enums.CellDataTypeEnum; | ||||
| import com.alibaba.excel.metadata.GlobalConfiguration; | ||||
| import com.alibaba.excel.metadata.data.ReadCellData; | ||||
| import com.alibaba.excel.metadata.data.WriteCellData; | ||||
| import com.alibaba.excel.metadata.property.ExcelContentProperty; | ||||
|  | ||||
| /** | ||||
|  * @Author:qjq | ||||
|  * @Date:2024/3/28 18:17 | ||||
|  */ | ||||
| public class BoolenConvert implements Converter<Boolean> { | ||||
|     @Override | ||||
|     public Class<?> supportJavaTypeKey() { | ||||
|         throw new UnsupportedOperationException("暂不支持,也不需要"); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public CellDataTypeEnum supportExcelTypeKey() { | ||||
|         throw new UnsupportedOperationException("暂不支持,也不需要"); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public WriteCellData<String> convertToExcelData(Boolean value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { | ||||
|         if(Boolean.TRUE.equals(value)){ | ||||
|             return new WriteCellData<>("已启用") ; | ||||
|         }else{ | ||||
|             return  new WriteCellData<>("已禁用"); | ||||
|         } | ||||
|  | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public Boolean convertToJavaData(ReadCellData readCellData, ExcelContentProperty contentProperty, | ||||
|                                     GlobalConfiguration globalConfiguration) { | ||||
|         return readCellData.getBooleanValue(); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 qjq
					qjq