第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

java apache poi 根據(jù)模板導(dǎo)出excel效率問題

java apache poi 根據(jù)模板導(dǎo)出excel效率問題

露水小葉 2016-11-23 14:02:00
我現(xiàn)在數(shù)據(jù)庫的數(shù)據(jù)時1620條,查詢用了400ms左右,但是光是循環(huán)讀取數(shù)據(jù)寫入excel就用了7000ms左右,實(shí)現(xiàn)太慢了,我也想過用多線程的方式,但是多線程處理list循環(huán)后會順序就不是想要的順序了,希望做過導(dǎo)出excel的大神,可以給我推薦一個按照模板導(dǎo)出excel高效的代碼,謝謝。private?ExcelTemplate?handlerObj2Excel?(String?template,List?objs,Class?clz,boolean?isClasspath)??{ ExcelTemplate?et?=?ExcelTemplate.getInstance(); try?{ if(isClasspath)?{ et.readTemplateByClasspath(template); }?else?{ et.readTemplateByPath(template); } List<ExcelHeader>?headers?=?getHeaderList(clz); Collections.sort(headers); //輸出標(biāo)題 et.createNewRow(); for(ExcelHeader?eh:headers)?{ et.createCell(eh.getTitle()); } //輸出值 long?start?=??System.currentTimeMillis(); for(Object?obj:objs)?{ et.createNewRow(); for(ExcelHeader?eh:headers)?{ et.createCell(BeanUtils.getProperty(obj,getMethodName(eh))); } } //寫入序號 et.insertSer(); System.out.println("創(chuàng)建excel耗時間:"+(System.currentTimeMillis()?-?start)); }?catch?(IllegalAccessException?e)?{ e.printStackTrace(); }?catch?(InvocationTargetException?e)?{ e.printStackTrace(); }?catch?(NoSuchMethodException?e)?{ e.printStackTrace(); } return?et; }
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 4132 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號