mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-29 19:56:43 +08:00
Add: SugarColumn(QuerySql=" getdate() ")
This commit is contained in:
parent
634020b822
commit
8bddf50c59
@ -362,6 +362,7 @@ namespace SqlSugar
|
||||
column.UpdateServerTime= sugarColumn.UpdateServerTime;
|
||||
column.UpdateSql= sugarColumn.UpdateSql;
|
||||
column.IsDisabledAlterColumn = sugarColumn.IsDisabledAlterColumn;
|
||||
column.QuerySql = sugarColumn.QuerySql;
|
||||
if (sugarColumn.IsJson && String.IsNullOrEmpty(sugarColumn.ColumnDataType))
|
||||
{
|
||||
if (this.Context.CurrentConnectionConfig.DbType == DbType.PostgreSQL)
|
||||
|
@ -907,7 +907,7 @@ namespace SqlSugar
|
||||
{
|
||||
columns = columns.Where(c => !this.IgnoreColumns.Any(i => c.PropertyName.Equals(i, StringComparison.CurrentCultureIgnoreCase) || c.DbColumnName.Equals(i, StringComparison.CurrentCultureIgnoreCase))).ToList();
|
||||
}
|
||||
result = string.Join(",", columns.Select(it => pre + Builder.GetTranslationColumnName(it.EntityName, it.PropertyName)));
|
||||
result = string.Join(",", columns.Select(it => GetSelectStringByColumnInfo(it, pre)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -920,6 +920,16 @@ namespace SqlSugar
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private string GetSelectStringByColumnInfo(EntityColumnInfo it, string pre)
|
||||
{
|
||||
if (it.QuerySql.HasValue())
|
||||
{
|
||||
return it.QuerySql+ " AS "+ Builder.GetTranslationColumnName(it.EntityName, it.PropertyName);
|
||||
}
|
||||
return pre + Builder.GetTranslationColumnName(it.EntityName, it.PropertyName);
|
||||
}
|
||||
|
||||
public virtual string GetWhereValueString
|
||||
{
|
||||
get
|
||||
|
@ -47,5 +47,6 @@ namespace SqlSugar
|
||||
public string UpdateSql { get; set; }
|
||||
public object ExtendedAttribute { get; set; }
|
||||
public bool IsDisabledAlterColumn { get; set; }
|
||||
public string QuerySql { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -210,6 +210,7 @@ namespace SqlSugar
|
||||
public int CreateTableFieldSort { get; set; }
|
||||
public bool InsertServerTime { get; set; }
|
||||
public string InsertSql { get; set; }
|
||||
public string QuerySql { get; set; }
|
||||
public bool UpdateServerTime { get; set; }
|
||||
public string UpdateSql { get; set; }
|
||||
public object ExtendedAttribute{ get; set; }
|
||||
|
Loading…
Reference in New Issue
Block a user