feat: 优化excel操作

This commit is contained in:
陈淳
2023-11-16 12:43:52 +08:00
parent a4080490bd
commit 185d87c24e
2 changed files with 25 additions and 2 deletions

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Module.Excel
{
public class ExcelManager
{
}
}

View File

@@ -12,8 +12,14 @@ using Org.BouncyCastle.Utilities.Collections;
namespace Yi.Framework.Module.Excel namespace Yi.Framework.Module.Excel
{ {
internal class OemClient public class OemClient
{ {
/// <summary>
/// 导出excel
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="entityList"></param>
/// <param name="filePath"></param>
public void Export<T>(List<T> entityList, string filePath) public void Export<T>(List<T> entityList, string filePath)
{ {
var properties = typeof(T).GetProperties().Where(x => x.GetCustomAttribute<DisplayNameAttribute>() is not null).Where(x => x.GetGetMethod().IsPublic).ToList(); var properties = typeof(T).GetProperties().Where(x => x.GetCustomAttribute<DisplayNameAttribute>() is not null).Where(x => x.GetGetMethod().IsPublic).ToList();
@@ -53,7 +59,12 @@ namespace Yi.Framework.Module.Excel
workbook.Dispose(); workbook.Dispose();
} }
/// <summary>
/// 导入excel
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="filePath"></param>
/// <returns></returns>
public List<T> Import<T>(string filePath) where T : new() public List<T> Import<T>(string filePath) where T : new()
{ {
List<T> result = new(); List<T> result = new();