Commit 17a46be1 authored by yanzg's avatar yanzg

Excel导出功能

parent f52aa9b7
......@@ -559,7 +559,7 @@ public class ObjectHelper {
public static <T> ArrayList<T> getList(Class<T> cls, Object froms) {
ArrayList<T> tos = new ArrayList<T>();
if (froms instanceof List) {
List vCodeFrom = (List) ((froms instanceof List) ? froms : new ArrayList<>());
List vCodeFrom = (List) froms;
for (Object from : vCodeFrom) {
if (StringHelper.isEmpty(from)) {
continue;
......
......@@ -92,9 +92,14 @@ public class FileHelper {
if (file.exists()) {
throw new CodeException("文件删除失败");
}
// 创建文件
file.getParentFile().mkdirs();
// 创建文件夹
File parentFile = file.getParentFile();
if (parentFile != null && !parentFile.exists()) {
parentFile.mkdirs();
}
if (!parentFile.exists()) {
throw new CodeException("创建文件夹失败");
}
file.createNewFile();
// 写入文件
RandomAccessFile raf = new RandomAccessFile(file, "rwd");
......
......@@ -336,8 +336,7 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
workbook = null;
}
File file = new File(this.getFileName());
if (file.exists()) {
file.delete();
if (file.exists() && file.delete()) {
}
return this;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment