Update Select(exp,true)

This commit is contained in:
sunkaixuan 2023-05-24 18:13:11 +08:00
parent cf73ee8297
commit 41faf7968e

View File

@ -1138,6 +1138,16 @@ namespace SqlSugar
{
return this.Select<TResult>(expression);
}
if (sql.StartsWith("*,"))
{
var columns = this.Context.EntityMaintenance.GetEntityInfo<T>()
.Columns.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)} "))
+ "," + sql.TrimStart('*').TrimStart(',');
}
}
if (this.QueryBuilder.TableShortName.IsNullOrEmpty())
{
this.QueryBuilder.TableShortName = clone.QueryBuilder.TableShortName;