EasyExcel导出报串换一场的错误

错误提示:com.alibaba.fastjson.JSONObject cannot be cast to com.alibaba.excel.metadata.BaseRowModel
意思是在导出转换的过程中出错了

出错的代码:

 List<Object> objectList=ret.getRows();
                List<ExportYearMonthDto> exportYearMonthDtoList =null;
                if(CollectionUtils.isNotEmpty(objectList)){
                    exportYearMonthDtoList = (List<ExportYearMonthDto>) ret.getRows();
                }

修改过后的代码:

 List<ExportYearMonthDto> exportYearMonthDtoList =null;
                if(CollectionUtils.isNotEmpty(objectList)){
                    exportYearMonthDtoList = JSON.parseArray(JSON.toJSONString(objectList), ExportYearMonthDto.class);
发布了33 篇原创文章 · 获赞 0 · 访问量 1422

猜你喜欢

转载自blog.csdn.net/m0_46086429/article/details/105397045