- 对所有 Java 源文件应用统一的代码格式化 - 统一缩进为 4 个空格 - 清理尾随空白字符和文件末尾换行 - 优化导入语句组织 - 总计格式化 654 个 Java 文件 有问题可以回滚或者找我聊
27 lines
763 B
Java
27 lines
763 B
Java
package com.starry.admin.utils;
|
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.util.List;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
/**
|
|
* @author admin
|
|
*/
|
|
public class ExcelUtils {
|
|
|
|
public static List<?> importEasyExcel(InputStream is, Class<?> pojoClass) {
|
|
return EasyExcel.read(is).head(pojoClass).sheet().doReadSync();
|
|
}
|
|
|
|
public static void exportEasyExcel(HttpServletResponse response, Class<?> pojoClass, List<?> list,
|
|
String sheetName) {
|
|
try {
|
|
EasyExcel.write(response.getOutputStream(), pojoClass).sheet(sheetName).doWrite(list);
|
|
} catch (IOException e) {
|
|
throw new RuntimeException(e.getMessage());
|
|
}
|
|
}
|
|
}
|