11package seven ;
22
3+ import org .apache .poi .ss .formula .functions .T ;
34import seven .callBack .PackageDataInterface ;
5+ import seven .config .Config ;
46import seven .savewapper .SaveExcel ;
57import seven .savewapper .wapperRef .sysWppers .ResExportDBMap ;
68import seven .savewapper .wapperRef .sysWppers .ResExportDBObj ;
79import seven .savewapper .wapperRef .sysWppers .ResExportMap ;
810import seven .savewapper .wapperRef .sysWppers .ResExportObj ;
9- import seven .wapperInt .Wrapper ;
11+ import seven .wapperInt .ReaderMap ;
12+ import seven .wapperInt .ReaderObj ;
1013import seven .wapperInt .wapperRef .WrapperObj ;
14+ import seven .wapperInt .wapperRef .sysWppers .ResWrapperMap ;
15+ import seven .wapperInt .wapperRef .sysWppers .ResWrapperObj ;
1116
17+ import java .io .File ;
1218import java .sql .ResultSet ;
1319import java .util .List ;
1420import java .util .Map ;
21+ import java .util .function .Consumer ;
1522
1623
1724//=======================================================
2936// ___`. | .'___
3037// (______|______)
3138//=======================================================
39+
3240/**
3341 * @author Seven<p>
3442 * date 2016年6月4日-下午4:08:19
@@ -41,15 +49,116 @@ private ExcelFactory() {
4149
4250 /**
4351 * 读取Excel
52+ *
53+ * @param FilePath 路径
54+ * @param r 包装类
55+ * @return Wrapper
56+ * @throws Exception
57+ */
58+ public static ReaderMap getMaps (String FilePath ) throws Exception {
59+ return (ReaderMap ) new ResWrapperMap (it ->{}).init (FilePath );
60+ }
61+
62+ /**
63+ * 读取Excel
64+ *
65+ * @param FilePath 路径
66+ * @param r 包装类
67+ * @return Wrapper
68+ * @throws Exception
69+ */
70+ public static <T > ReaderObj <T > getBeans (Class clazz ,String FilePath ) throws Exception {
71+ return new ResWrapperObj (clazz ,it ->{}).init (FilePath );
72+ }
73+
74+ /**
75+ * 读取Excel
76+ *
77+ * @param FilePath 路径
78+ * @param r 包装类
79+ * @return Wrapper
80+ * @throws Exception
81+ */
82+ public static ReaderMap getMaps (String FilePath , Consumer <Config > config ) throws Exception {
83+ return (ReaderMap ) new ResWrapperMap (config ).init (FilePath );
84+ }
85+
86+ /**
87+ * 读取Excel
88+ *
89+ * @param FilePath 路径
90+ * @param r 包装类
91+ * @return Wrapper
92+ * @throws Exception
93+ */
94+ public static <T > ReaderObj <T > getBeans (Class clazz ,String FilePath , Consumer <Config > config ) throws Exception {
95+ return new ResWrapperObj (clazz , config ).init (FilePath );
96+ }
97+
98+ /**
99+ * 读取Excel
100+ *
101+ * @param FilePath 路径
102+ * @param r 包装类
103+ * @return Wrapper
104+ * @throws Exception
105+ */
106+ public static ReaderMap getMaps (File file ) throws Exception {
107+ return (ReaderMap ) new ResWrapperMap (it ->{}).init (file );
108+ }
109+
110+ /**
111+ * 读取Excel
112+ *
113+ * @param FilePath 路径
114+ * @param r 包装类
115+ * @return Wrapper
116+ * @throws Exception
117+ */
118+ public static <T > ReaderObj <T > getBeans (Class clazz ,File file ) throws Exception {
119+ return new ResWrapperObj (clazz ,it ->{}).init (file );
120+ }
121+
122+ /**
123+ * 读取Excel
124+ *
125+ * @param FilePath 路径
126+ * @param r 包装类
127+ * @return Wrapper
128+ * @throws Exception
129+ */
130+ public static ReaderMap getMaps (File file , Consumer <Config > config ) throws Exception {
131+ return (ReaderMap ) new ResWrapperMap (config ).init (file );
132+ }
133+
134+ /**
135+ * 读取Excel
136+ *
44137 * @param FilePath 路径
45138 * @param r 包装类
46139 * @return Wrapper
47140 * @throws Exception
48141 */
49- public static <T > Wrapper <T > getBeans (String FilePath , WrapperObj < T > r ) throws Exception {
50- return r .init (FilePath );
142+ public static <T > ReaderObj <T > getBeans (Class clazz , File file , Consumer < Config > config ) throws Exception {
143+ return new ResWrapperObj ( clazz , config ) .init (file );
51144 }
52145
146+
147+
148+
149+
150+
151+
152+
153+
154+
155+
156+
157+
158+
159+
160+
161+
53162 /**
54163 * 保存Excel
55164 *
@@ -58,12 +167,12 @@ public static <T> Wrapper<T> getBeans(String FilePath, WrapperObj<T> r) throws E
58167 * @return SaveExcel
59168 * @throws Exception
60169 */
61- public static <T > SaveExcel <T > saveExcel (List <? extends T > bean , String FilePath ) throws Exception {
170+ public static <T > SaveExcel <T > saveExcel (List <? extends T > bean , String FilePath ) throws Exception {
62171 if (bean .size () < 1 ) {
63172 throw new Exception ("请传入数据" );
64173 }
65174 if (bean .get (0 ) instanceof Map ) {
66- return (SaveExcel <T >) new ResExportMap ((List <Map >)bean , FilePath );
175+ return (SaveExcel <T >) new ResExportMap ((List <Map >) bean , FilePath );
67176 }
68177 return new ResExportObj (bean , FilePath );
69178 }
0 commit comments