public
class
MsgClient
implements
java.io.Serializable {
/** id */
private
java.lang.String id;
// 电话号码(主键)
@Excel
(name =
"电话号码"
, width =
20
, orderNum =
"2"
)
private
String clientPhone =
null
;
// 客户姓名
@Excel
(name =
"姓名"
, orderNum =
"1"
)
private
String clientName =
null
;
// 所属分组
@ExcelEntity
private
MsgClientGroup group =
null
;
// 备注
@Excel
(name =
"备注"
)
private
String remark =
null
;
// 生日
@Excel
(name =
"出生日期"
, format =
"yyyy-MM-dd"
, width =
20
)
private
Date birthday =
null
;
// 创建人
private
String createBy =
null
;
public
class
MsgClientGroup
implements
Serializable {
/**
*
*/
private
static
final
long
serialVersionUID = 6946265640897464878L;
// 组名
@Excel
(name =
"分组"
)
private
String groupName =
null
;
/**
* 创建人
*/
private
String createBy;
@Test
public
void
test()
throws
Exception {
List<MsgClient> list =
new
ArrayList<MsgClient>();
for
(
int
i =
0
; i <
25000
; i++) {
MsgClient client =
new
MsgClient();
client.setBirthday(
new
Date());
client.setClientName(
"小明"
+ i);
client.setClientPhone(
"18797"
+ i);
client.setCreateBy(
"jueyue"
);
client.setId(
"1"
+ i);
client.setRemark(
"测试"
+ i);
MsgClientGroup group =
new
MsgClientGroup();
group.setGroupName(
"测试"
+ i);
client.setGroup(group);
list.add(client);
}
Date start =
new
Date();
Workbook workbook = ExcelExportUtil.exportExcel(
new
ExportParams(
"2412312"
,
"测试"
),
MsgClient.
class
, list);
System.out.println(
new
Date().getTime() - start.getTime());
File savefile =
new
File(
"d:/"
);
if
(!savefile.exists()) {
savefile.mkdirs();
}
FileOutputStream fos =
new
FileOutputStream(
"d:/tt.xls"
);
workbook.write(fos);
fos.close();
}
测试No |
数据量
|
用时
|
1
|
25000
|
1381
|
2
|
25000
|
1292
|
3
|
50000
|
1551
|
4
|
50000
|
1604
|
测试No |
数据量
|
用时
|
1
|
25000
|
6276
|
2
|
25000
|
6342
|
3
|
50000
|
10014
|
4
|
50000
|
9897
|
测试No |
数据量
|
用时
|
1
|
25000
|
3224
|
2
|
25000
|
3457
|
3
|
50000
|
4044
|
4
|
50000
|
3924
|
原文地址:http://blog.csdn.net/qjueyue/article/details/41909577