mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Split table
This commit is contained in:
parent
8d28b8d393
commit
010bf56234
@ -851,6 +851,7 @@ namespace SqlSugar
|
||||
{
|
||||
tableQueryables.Add(this.Clone().AS(item.TableName));
|
||||
}
|
||||
Check.Exception(tableQueryables.Count == 0, ErrorMessage.GetThrowMessage("SplitTable error . There are no tables after filtering", "SplitTable没有筛选出分表,请检查条件和数据库中的表"));
|
||||
var unionall = this.Context._UnionAll(tableQueryables.ToArray());
|
||||
//var values= unionall.QueryBuilder.GetSelectValue;
|
||||
//unionall.QueryBuilder.SelectValue = values;
|
||||
|
@ -12,5 +12,17 @@ namespace SqlSugar
|
||||
{
|
||||
return tables.Where(it => tableNames.Any(y => y.Equals(it.TableName, StringComparison.OrdinalIgnoreCase)));
|
||||
}
|
||||
public static IEnumerable<SplitTableInfo> ContainsTableNames(this List<SplitTableInfo> tables, params string[] tableNames)
|
||||
{
|
||||
List<SplitTableInfo> result = new List<SplitTableInfo>();
|
||||
foreach (var item in tables)
|
||||
{
|
||||
if (tableNames.Any(it => item.TableName.Contains(it)))
|
||||
{
|
||||
result.Add(item);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user