public class BsMatrixConsortiumBo{ private Long id; private String applyScopeConsortium; private String companyPointNo; private String standardPointNo; private String businessProcess; private String sonProcess; private String controlTarget; private String companyPointMessage; private String standardPointMessage; private String controlRate; private String controlType; private String controlClass; private String suggestDutyDept; private String companyDutyDept; private String companyPointUser; private String nkDesignDutyDept; private String nkProcessUser; private String pointExecuteTime; private String itWeldingMode; private String weldingSystem; private String pointClass; private String trajectionTestData; private String referenceFile; private String suggestFollow; private String year; private String matrixType; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | List<BsMatrixConsortiumVo> list = iBsMatrixConsortiumService.queryList(bo); for ( int i = 0 ; i < list.size(); i++) { int index = i + 1 ; list.get(i).setId(Long.parseLong(index + "" )); //序号 } BufferedOutputStream bos = null ; String temPath = fileTemplatesDir + "集团矩阵.xlsx" ; response.setContentType( "application/vnd.ms-excel" ); response.setCharacterEncoding( "utf-8" ); response.setHeader( "Content-disposition" , "attachment;filename=内控矩阵excel" ); try { bos = new BufferedOutputStream(response.getOutputStream()); ExcelWriter excelWriter = EasyExcel.write(bos).withTemplate(temPath).build(); WriteSheet writeSheet = EasyExcel.writerSheet().build(); excelWriter.fill(list,writeSheet); excelWriter.finish(); bos.flush(); } catch (IOException e) { e.printStackTrace(); } |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)