mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-15 14:04:44 +08:00
Update split table
This commit is contained in:
parent
0cc55e6dd1
commit
68706d7d79
@ -1499,10 +1499,24 @@ namespace SqlSugar
|
|||||||
return this.Select<TResult>(this.QueryBuilder.SelectValue+"");
|
return this.Select<TResult>(this.QueryBuilder.SelectValue+"");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (this.EntityInfo?.Type?.GetCustomAttribute<SplitTableAttribute>() != null&& this.QueryBuilder?.SelectValue?.ToString()=="*")
|
||||||
|
{
|
||||||
|
var columnAarray = this.Context.EntityMaintenance.GetEntityInfo<T>().Columns;
|
||||||
|
var sql = string.Empty;
|
||||||
|
var columns= columnAarray.Where(it => typeof(TResult).GetProperties().Any(s => s.Name.EqualCase(it.PropertyName))).Where(it => it.IsIgnore == false).ToList();
|
||||||
|
if (columns.Any())
|
||||||
|
{
|
||||||
|
sql = string.Join(",", columns.Select(it => $"{SqlBuilder.GetTranslationColumnName(it.DbColumnName)} AS {SqlBuilder.GetTranslationColumnName(it.PropertyName)} "));
|
||||||
|
}
|
||||||
|
return this.Select<TResult>(sql);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
return this.Select<TResult>(this.SqlBuilder.SqlSelectAll);
|
return this.Select<TResult>(this.SqlBuilder.SqlSelectAll);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var selects = this.QueryBuilder.GetSelectValueByString();
|
var selects = this.QueryBuilder.GetSelectValueByString();
|
||||||
@ -1687,6 +1701,7 @@ namespace SqlSugar
|
|||||||
//}
|
//}
|
||||||
var unionall = this.Context._UnionAll(tableQueryables.ToArray());
|
var unionall = this.Context._UnionAll(tableQueryables.ToArray());
|
||||||
unionall.QueryBuilder.Includes = this.QueryBuilder.Includes;
|
unionall.QueryBuilder.Includes = this.QueryBuilder.Includes;
|
||||||
|
unionall.QueryBuilder.EntityType = typeof(T);
|
||||||
if (unionall.QueryBuilder.Includes?.Any()==true)
|
if (unionall.QueryBuilder.Includes?.Any()==true)
|
||||||
{
|
{
|
||||||
unionall.QueryBuilder.NoCheckInclude = true;
|
unionall.QueryBuilder.NoCheckInclude = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user