Skip to content

Commit 015ac78

Browse files
committed
更新构造方法.适配java8 开发ing
1 parent f9115b8 commit 015ac78

11 files changed

Lines changed: 237 additions & 361 deletions

File tree

src/main/java/seven/ExcelFactory.java

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,44 +31,46 @@
3131
//=======================================================
3232
/**
3333
* @author Seven<p>
34-
* @date 2016年6月4日-下午4:08:19
34+
* @date 2016年6月4日-下午4:08:19
3535
*/
3636
@SuppressWarnings("unchecked")
3737
public class ExcelFactory {
3838

39-
private ExcelFactory() {
40-
}
39+
private ExcelFactory() {
40+
}
4141

4242
/**
4343
* 读取Excel
44-
* @param FilePath 路径
45-
* @param r 包装类
44+
* @param FilePath 路径
45+
* @param r 包装类
4646
* @return
4747
* @throws Exception
4848
*/
49-
public static Wrapper getBeans(String FilePath, WrapperObj r) throws Exception {
50-
return (Wrapper)r.init(FilePath);
51-
}
49+
public static Wrapper getBeans(String FilePath, WrapperObj r) throws Exception {
50+
return r.init(FilePath);
51+
}
5252

5353
/**
5454
* 保存Excel
55+
*
5556
* @param bean
5657
* @param FilePath
5758
* @return
5859
* @throws Exception
5960
*/
60-
public static SaveExcel saveExcel(List<? extends Object> bean, String FilePath) throws Exception {
61-
if (bean.size() < 1) {
62-
throw new Exception("请传入数据");
63-
}
64-
if (bean.get(0) instanceof Map) {
65-
return new ResExportMap((List<Map>) bean,FilePath);
66-
}
67-
return new ResExportObj((List)bean, FilePath);
68-
}
61+
public static SaveExcel saveExcel(List<? extends Object> bean, String FilePath) throws Exception {
62+
if (bean.size() < 1) {
63+
throw new Exception("请传入数据");
64+
}
65+
if (bean.get(0) instanceof Map) {
66+
return new ResExportMap((List<Map>) bean, FilePath);
67+
}
68+
return new ResExportObj((List) bean, FilePath);
69+
}
6970

7071
/**
7172
* 保存Excel
73+
*
7274
* @param bean
7375
* @return
7476
* @throws Exception
@@ -80,47 +82,51 @@ public static SaveExcel saveExcel(List<? extends Object> bean) throws Exception
8082
if (bean.get(0) instanceof Map) {
8183
return new ResExportMap((List<Map>) bean);
8284
}
83-
return new ResExportObj((List)bean);
85+
return new ResExportObj((List) bean);
8486
}
8587

8688

8789
/**
8890
* 保存Excel
91+
*
8992
* @param resultSet
9093
* @param FilePath
9194
* @return
9295
* @throws Exception
9396
*/
9497
public static SaveExcel saveExcel(ResultSet resultSet, String FilePath) throws Exception {
95-
return new ResExportDBMap(resultSet,FilePath);
98+
return new ResExportDBMap(resultSet, FilePath);
9699
}
97100

98101
/**
99102
* 保存Excel
103+
*
100104
* @param resultSet
101105
* @param FilePath
102106
* @param packageDataInterface
103107
* @return
104108
* @throws Exception
105109
*/
106110
public static SaveExcel saveExcel(ResultSet resultSet, String FilePath, PackageDataInterface packageDataInterface) throws Exception {
107-
return new ResExportDBObj(resultSet,FilePath,packageDataInterface);
111+
return new ResExportDBObj(resultSet, FilePath, packageDataInterface);
108112
}
109113

110114
/**
111115
* 保存Excel
116+
*
112117
* @param resultSet
113118
* @param type
114119
* @return
115120
* @throws Exception
116121
*/
117-
public static SaveExcel saveExcel(ResultSet resultSet,Class type) throws Exception {
118-
return new ResExportDBObj(resultSet,type);
122+
public static SaveExcel saveExcel(ResultSet resultSet, Class type) throws Exception {
123+
return new ResExportDBObj(resultSet, type);
119124
}
120125

121126

122127
/**
123128
* 保存Excel
129+
*
124130
* @param resultSet
125131
* @return
126132
* @throws Exception

src/main/java/seven/anno/ExcelAnno.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@
2121
// (______|______)
2222
//=======================================================
2323
/**
24-
* @author Seven<p>
25-
* @date 2016年6月4日-下午4:07:33
24+
* @author Seven
2625
*/
2726
@Target(ElementType.FIELD)
2827
@Retention(RetentionPolicy.RUNTIME)
2928
public @interface ExcelAnno {
30-
public String Value()default "Null";
31-
public boolean Pass() default false;
32-
public String Required() default "Null";
33-
public short Align() default 0x2;
34-
29+
String Value()default "Null";
30+
boolean Pass() default false;
31+
String Required() default "Null";
32+
short Align() default 0x2;
3533
}

src/main/java/seven/callBack/DataFilterColumnInterface.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
* [Github]https://github.com/MatrixSeven
55
* [Bolg]https://matrixseven.github.io/
66
* Created by seven on 2016/10/19.
7-
* *{@link seven.savewapper.SaveExcel} -->AnyCol和FilterCol
7+
* *{@link seven.savewapper.SaveExcel}
88
*/
99
@FunctionalInterface
1010
public interface DataFilterColumnInterface {
1111
/**
12-
*{@link seven.savewapper.SaveExcel} -->AnyCol和FilterCol
12+
*{@link seven.savewapper.SaveExcel}
1313
*/
1414
public String[] filter();
1515
}

src/main/java/seven/savewapper/SaveExcel.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public interface SaveExcel extends ExcelSuperInterface {
8686
/**
8787
* 网页输出流
8888
*
89-
* @param stream
89+
* @param strea
9090
* @return
9191
*/
9292
SaveExcel SetOutputStream(OutputStream stream) throws Exception;
@@ -137,4 +137,3 @@ public interface SaveExcel extends ExcelSuperInterface {
137137
*/
138138
SaveExcel SetCellStyle(String name, CellStyleInterface cellStyle);
139139
}
140-

src/main/java/seven/savewapper/wapperRef/sysWppers/ResExportObj.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,22 @@ public void Save() throws Exception {
6464
if (filterColBy_key.contains(fields[i].getName())) {
6565
continue;
6666
}
67+
6768
ea = fields[i].getAnnotation(ExcelAnno.class);
69+
if (ea != null) {
70+
if(ea.Pass()) {
71+
continue;
72+
}}
6873
title[i] = fields[i].getName();
69-
if (ea != null && !ea.Value().equals("Null")) {
70-
align[i] = ea.Align();
71-
continue;
72-
}
7374
align[i] = 0x2;
75+
if (ea != null) {
76+
if(ea.Align()!=0x2){
77+
align[i] = ea.Align();
78+
}
79+
if (!ea.Value().equals("Null")) {
80+
title[i] = ea.Value();
81+
}
82+
}
7483
}
7584
}else {
7685
for (int i = 0; i < fields.length; i++) {

src/main/java/seven/util/RegHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
/**
2323
* @author Seven<p>
24-
* @date 2016年6月4日-下午4:07:25
24+
* 2016年6月4日-下午4:07:25
2525
*/
2626
@Deprecated
2727
public class RegHelper {

0 commit comments

Comments
 (0)