Split support no table query

This commit is contained in:
sunkaixuan 2022-03-01 10:38:48 +08:00
parent a1bae2aea3
commit 24a7656fcd
4 changed files with 22 additions and 0 deletions

View File

@ -35,6 +35,12 @@ namespace OrmTest
.SplitTable(tabs => tabs.Take(3))
.Where(it=>it.Time==DateTime.Now).ToOffsetPage(1,2);
var first = db.Queryable<OrderSpliteTest>()
.SplitTable(DateTime.MaxValue, DateTime.Now)
.First();//no table
Console.WriteLine();
//根据时间选出的表进行查询

View File

@ -35,6 +35,12 @@ namespace OrmTest
.SplitTable(tabs => tabs.Take(3))
.Where(it=>it.Time==DateTime.Now).ToOffsetPage(1,2);
var first = db.Queryable<OrderSpliteTest>()
.SplitTable(DateTime.MaxValue, DateTime.Now)
.First();//no table
Console.WriteLine();
//根据时间选出的表进行查询

View File

@ -36,6 +36,11 @@ namespace OrmTest
.SplitTable(DateTime.Now.Date.AddYears(-1),DateTime.Now)
.ToList();
var first = db.Queryable<OrderSpliteTest>()
.SplitTable(DateTime.MaxValue, DateTime.Now)
.First();//no table
Console.WriteLine();
//根据时间选出的表进行查询

View File

@ -509,6 +509,11 @@ namespace SqlSugar
}
public string GetSqlQuerySql(string result)
{
if (GetTableNameString == " (-- No table ) t ")
{
result = "-- No table ";
return result;
}
if (this.IsSqlQuery&&this.OldSql.HasValue() && (Skip == null && Take == null) && (this.WhereInfos == null || this.WhereInfos.Count == 0))
{
return this.OldSql;