Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
d4223df4
Commit
d4223df4
authored
Dec 17, 2021
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下载视频
parent
61f8d6b7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
5 deletions
+16
-5
ExcelHttp.java
.../src/main/java/com/yanzuoguang/cloud/excel/ExcelHttp.java
+4
-3
ExcelConsole.java
...-db/src/main/java/com/yanzuoguang/excel/ExcelConsole.java
+4
-1
ExcelStatus.java
...l-db/src/main/java/com/yanzuoguang/excel/ExcelStatus.java
+8
-1
No files found.
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/excel/ExcelHttp.java
View file @
d4223df4
...
...
@@ -109,8 +109,8 @@ public class ExcelHttp<T extends Object> extends ExcelConsole<T> {
* @param response 输出结果
* @param excelDao dao层实现接口
*/
public
static
<
T
extends
Object
,
M
extends
Object
>
void
export
(
ExportBase
<
T
>
req
,
HttpServletResponse
response
,
ExcelDao
<
T
,
M
>
excelDao
)
{
export
(
req
,
response
,
excelDao
,
null
);
public
static
<
T
extends
Object
,
M
extends
Object
>
ExcelHttp
<
M
>
export
(
ExportBase
<
T
>
req
,
HttpServletResponse
response
,
ExcelDao
<
T
,
M
>
excelDao
)
{
return
export
(
req
,
response
,
excelDao
,
null
);
}
/**
...
...
@@ -121,7 +121,7 @@ public class ExcelHttp<T extends Object> extends ExcelConsole<T> {
* @param excelDao dao层实现接口
* @param excelStatus excel状态实现
*/
public
static
<
T
extends
Object
,
M
extends
Object
>
void
export
(
ExportBase
<
T
>
req
,
HttpServletResponse
response
,
ExcelDao
<
T
,
M
>
excelDao
,
ExcelStatus
<
M
>
excelStatus
)
{
public
static
<
T
extends
Object
,
M
extends
Object
>
ExcelHttp
<
M
>
export
(
ExportBase
<
T
>
req
,
HttpServletResponse
response
,
ExcelDao
<
T
,
M
>
excelDao
,
ExcelStatus
<
M
>
excelStatus
)
{
ExcelHttp
<
M
>
excel
=
export
(
req
,
excelDao
,
excelStatus
);
try
{
// 等待下载模式,下载文件
...
...
@@ -133,6 +133,7 @@ public class ExcelHttp<T extends Object> extends ExcelConsole<T> {
// 删除生成的临时文件
excel
.
remove
();
}
return
excel
;
}
private
static
<
T
,
M
>
void
releaseExcel
(
ExportBase
<
T
>
req
,
ExcelDao
<
T
,
M
>
excelDao
,
ExcelHttp
<
M
>
excel
)
{
...
...
yzg-util-db/src/main/java/com/yanzuoguang/excel/ExcelConsole.java
View file @
d4223df4
...
...
@@ -186,6 +186,9 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
* 初始化Excel对象
*/
protected
void
initExcel
(
TableHead
head
)
{
if
(
this
.
excelStatus
!=
null
)
{
excelStatus
.
excelInit
(
this
);
}
if
(
this
.
workbook
!=
null
)
{
throw
YzgError
.
getRuntimeException
(
"034"
);
}
...
...
@@ -389,7 +392,7 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
*/
public
ExcelConsole
save
()
{
if
(
this
.
excelStatus
!=
null
)
{
excelStatus
.
excelFinish
();
excelStatus
.
excelFinish
(
this
);
}
if
(
workbook
==
null
)
{
return
this
;
...
...
yzg-util-db/src/main/java/com/yanzuoguang/excel/ExcelStatus.java
View file @
d4223df4
...
...
@@ -7,6 +7,13 @@ package com.yanzuoguang.excel;
*/
public
interface
ExcelStatus
<
T
extends
Object
>
{
/**
* Excel处理
*
* @param excel
*/
void
excelInit
(
ExcelConsole
<
T
>
excel
);
/**
* 循环处理每行数据
*
...
...
@@ -17,5 +24,5 @@ public interface ExcelStatus<T extends Object> {
/**
* 处理Excel结束
*/
void
excelFinish
();
void
excelFinish
(
ExcelConsole
<
T
>
excel
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment