自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

JeecgBoot 單表數(shù)據(jù)導(dǎo)出多sheet實(shí)例

數(shù)據(jù)庫(kù)
本篇給大家介紹JeecgBoot 單表數(shù)據(jù)導(dǎo)出多sheet實(shí)例,希望對(duì)你有所幫助!

[[386529]]

 現(xiàn)在要導(dǎo)出格式如下:


實(shí)體如下:

  1. public class TestEntity{ 
  2.  
  3.     @Excel(name = "姓名", width = 15) 
  4.     private String username; 
  5.      
  6.     @Excel(name = "年齡", width = 15) 
  7.     private int age; 
  8.  
  9. .....省略后續(xù)getset 

 數(shù)據(jù)格式如下:

  1. //多個(gè)map,對(duì)應(yīng)了多個(gè)sheet 
  2. List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); 
  3.  
  4. for(int i=0;i<3;i++){ 
  5.     Map<String, Object> map = new HashMap<String, Object>(); 
  6.     map.put("title",getExportParams("測(cè)試"+i));//表格title 
  7.     map.put("entity",TestEntity.class);//表格對(duì)應(yīng)實(shí)體 
  8.  
  9.     //數(shù)據(jù)封裝方式一:map數(shù)據(jù),手動(dòng)封裝ExcelExportEntity集合 
  10.     List<Map> ls=new ArrayList<Map> (); 
  11.     for(int j=0;j<10;j++){ 
  12.         Map map = new HashMap(); 
  13.         map1.put("name","李四"+j); 
  14.         map1.put("age",18+j); 
  15.         ls.add(map); 
  16.     } 
  17.  
  18.    //數(shù)據(jù)封裝方式二:實(shí)體類 
  19.     List<TestEntity> ls=new ArrayList<TestEntity> (); 
  20.     for(int j=0;j<10;j++){ 
  21.         TestEntity testEntity = new TestEntity(); 
  22.         testEntity.setName("張三"+j); 
  23.         testEntity.setAge(18+j); 
  24.         ls.add(testEntity); 
  25.     } 
  26.     map.put("data", ls); 
  27.     listMap.add(map); 
  28.  
  29. //導(dǎo)出參數(shù) 
  30. public static ExportParams getExportParams(String name) { 
  31.      //表格名稱,sheet名稱,導(dǎo)出版本  
  32.     return  new ExportParams(name,name,ExcelType.XSSF); 

 調(diào)用ExcelExportUtil.exportExcel方法生成workbook

  1. Workbook wb = ExcelExportUtil.exportExcel(listMap,ExcelType.XSSF); 

 【編輯推薦】

 

責(zé)任編輯:姜華 來(lái)源: 今日頭條
相關(guān)推薦

2011-06-29 14:01:30

多數(shù)據(jù)庫(kù)實(shí)例效率

2010-04-02 13:46:30

Oracle數(shù)據(jù)導(dǎo)出

2024-07-16 16:20:19

Python數(shù)據(jù)集

2022-12-28 08:17:36

數(shù)據(jù)庫(kù)數(shù)據(jù)導(dǎo)出

2010-04-22 10:16:43

2010-03-30 09:01:01

Oracle數(shù)據(jù)

2019-10-12 16:15:13

MySQL數(shù)據(jù)庫(kù)多實(shí)例

2010-06-02 11:34:23

MySQL 數(shù)據(jù)庫(kù)導(dǎo)入

2010-11-29 13:22:45

sybase數(shù)據(jù)表

2010-11-11 11:00:06

sql server遍

2010-09-10 13:45:18

SQLCOUNT()函數(shù)

2009-07-02 09:40:17

JSP導(dǎo)出Oracle

2017-07-04 15:45:30

數(shù)據(jù)庫(kù)RACWindows平臺(tái)

2013-11-26 16:32:03

MYSQLMYSQL配置

2021-06-29 08:12:22

MySQL數(shù)據(jù)分頁(yè)數(shù)據(jù)庫(kù)

2010-10-15 10:14:09

Mysql建表

2010-04-30 14:47:56

Oracle表

2009-11-06 14:25:20

Oracle創(chuàng)建用戶表

2016-10-09 09:37:49

javascript單例模式

2010-04-23 17:55:25

Oracle數(shù)據(jù)庫(kù)
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)