2022-11-18 焊接基础数据导入增加dn公称直径
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
namespace BLL
|
||||
{
|
||||
using MiniExcelLibs;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
@@ -1161,6 +1164,37 @@ namespace BLL
|
||||
dv.RowFilter = $"({filterRule})";
|
||||
return dv.ToTable();
|
||||
}
|
||||
|
||||
public static IEnumerable<dynamic> QueryWithoutEmptyRow(Stream stream, bool useHeaderRow, string sheetName, ExcelType excelType, string startCell, IConfiguration configuration)
|
||||
{
|
||||
var rows = stream.Query(useHeaderRow, sheetName, excelType, startCell, configuration);
|
||||
foreach (IDictionary<string, object> row in rows)
|
||||
{
|
||||
if (row.Keys.Any(key => row[key] != null))
|
||||
yield return row;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
/// 用于Linq的去重,扩展方法需要放到静态类中
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <typeparam name="TKey"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="keySelector"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<TSource> DistinctBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
|
||||
{
|
||||
HashSet<TKey> seenKeys = new HashSet<TKey>();
|
||||
foreach (TSource element in source)
|
||||
{
|
||||
if (seenKeys.Add(keySelector(element)))
|
||||
{
|
||||
yield return element;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user