最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

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

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

露水小葉 2016-11-23 14:02:00
我現(xiàn)在數(shù)據(jù)庫(kù)的數(shù)據(jù)時(shí)1620條,查詢(xún)用了400ms左右,但是光是循環(huán)讀取數(shù)據(jù)寫(xiě)入excel就用了7000ms左右,實(shí)現(xiàn)太慢了,我也想過(guò)用多線程的方式,但是多線程處理list循環(huán)后會(huì)順序就不是想要的順序了,希望做過(guò)導(dǎo)出excel的大神,可以給我推薦一個(gè)按照模板導(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))); } } //寫(xiě)入序號(hào) et.insertSer(); System.out.println("創(chuàng)建excel耗時(shí)間:"+(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)注
  • 4153 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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