refactor: 用户导入优化
This commit is contained in:
24
src/main/java/com/youlai/system/common/util/ExcelUtils.java
Normal file
24
src/main/java/com/youlai/system/common/util/ExcelUtils.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.youlai.system.common.util;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.youlai.system.framework.easyexcel.ExcelResult;
|
||||
import com.youlai.system.framework.easyexcel.MyAnalysisEventListener;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* Excel 工具类
|
||||
*
|
||||
* @author: haoxr
|
||||
* @date: 2023/03/01
|
||||
*/
|
||||
public class ExcelUtils {
|
||||
|
||||
public static <T> ExcelResult importExcel(InputStream is, Class clazz, MyAnalysisEventListener<T> listener) {
|
||||
EasyExcel.read(is, clazz, listener).sheet().doRead();
|
||||
ExcelResult excelResult = listener.getResult();
|
||||
return excelResult;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user