国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術(shù)文章
文章詳情頁

Java使用easyExcel導(dǎo)出excel數(shù)據(jù)案例

瀏覽:165日期:2022-05-25 17:49:28

easyExcel簡介:

Java領(lǐng)域解析、生成Excel比較有名的框架有Apache poi、jxl等。但他們都存在一個(gè)嚴(yán)重的問題就是非常的耗內(nèi)存。如果你的系統(tǒng)并發(fā)量不大的話可能還行,但是一旦并發(fā)上來后一定會(huì)OOM或者JVM頻繁的full gc。easyExcel是阿里巴巴開源的一個(gè)excel處理框架,以使用簡單、節(jié)省內(nèi)存著稱。easyExcel采用一行一行的解析模式,并將一行的解析結(jié)果以觀察者的模式通知處理easyExcel能大大減少占用內(nèi)存的主要原因是在解析Excel時(shí)沒有將文件數(shù)據(jù)一次性全部加載到內(nèi)存中,而是從磁盤上一行行讀取數(shù)據(jù),逐個(gè)解析。

1.導(dǎo)入依賴【poi不能低于3.17,不然可能會(huì)報(bào)錯(cuò)】

<dependency><groupId>org.apache.poi</groupId><artifactId>poi</artifactId><version>3.17</version></dependency><dependency><groupId>org.apache.poi</groupId><artifactId>poi-ooxml</artifactId><version>3.17</version></dependency><dependency><groupId>com.alibaba</groupId><artifactId>easyexcel</artifactId><version>1.1.2-beta5</version></dependency>

2.控制層

<dependency><groupId>org.apache.poi</groupId><artifactId>poi</artifactId><version>3.17</version></dependency><dependency><groupId>org.apache.poi</groupId><artifactId>poi-ooxml</artifactId><version>3.17</version></dependency><dependency><groupId>com.alibaba</groupId><artifactId>easyexcel</artifactId><version>1.1.2-beta5</version></dependency>

3.導(dǎo)出模型

package com.iflytek.edu.hnezxjgl.model;import com.alibaba.excel.annotation.ExcelProperty;import com.alibaba.excel.metadata.BaseRowModel;import lombok.Data;@Datapublic class ExportModel extends BaseRowModel{ /** * 賬號(hào) */ @ExcelProperty(value = {'賬號(hào)'}, index = 0) private String platformNum; /** * 姓名 */ @ExcelProperty(value = {'姓名'}, index = 1) private String name; /** * 身份證號(hào) */ @ExcelProperty(value = {'身份證號(hào)'}, index = 2) private String idCardNum; /** * 性別 */ @ExcelProperty(value = {'性別'}, index = 3) private String sexName; /** * 年級(jí) */ @ExcelProperty(value = {'年級(jí)'}, index = 4) private String gradeName;/** * 班級(jí) */@ExcelProperty(value = {'班級(jí)'}, index = 5)private String className; /** * 學(xué)費(fèi)繳費(fèi)狀態(tài)名稱 */ @ExcelProperty(value = '學(xué)費(fèi)繳費(fèi)狀態(tài)名稱',index = 6) private String studyFeeStatusName; /** * 書本費(fèi)繳費(fèi)狀態(tài)名稱 */ @ExcelProperty(value = '書本費(fèi)繳費(fèi)狀態(tài)名稱',index = 7) private String bookFeeStatusName; }

4.幾萬條數(shù)據(jù)實(shí)現(xiàn)秒導(dǎo)

Java使用easyExcel導(dǎo)出excel數(shù)據(jù)案例

到此這篇關(guān)于Java使用easyExcel導(dǎo)出excel數(shù)據(jù)案例的文章就介紹到這了,更多相關(guān)Java easyExcel導(dǎo)出excel內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

標(biāo)簽: excel
相關(guān)文章:
主站蜘蛛池模板: 通江县| 塔城市| 和静县| 涟源市| 台南县| 汝南县| 蓬安县| 彭州市| 古田县| 琼结县| 玛曲县| 会同县| 香港 | 永德县| 化隆| 永兴县| 呼伦贝尔市| 隆回县| 防城港市| 娄烦县| 上蔡县| 阜宁县| 贵港市| 拜泉县| 镇赉县| 蒙城县| 方正县| 哈密市| 禄丰县| 修武县| 佛教| 彰化县| 绥阳县| 宁城县| 行唐县| 永康市| 青龙| 明星| 寻甸| 金平| 怀集县|