mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 18:22:23 +08:00
Add: SugarColumn(QuerySql=" getdate() ")
This commit is contained in:
@@ -362,6 +362,7 @@ namespace SqlSugar
|
|||||||
column.UpdateServerTime= sugarColumn.UpdateServerTime;
|
column.UpdateServerTime= sugarColumn.UpdateServerTime;
|
||||||
column.UpdateSql= sugarColumn.UpdateSql;
|
column.UpdateSql= sugarColumn.UpdateSql;
|
||||||
column.IsDisabledAlterColumn = sugarColumn.IsDisabledAlterColumn;
|
column.IsDisabledAlterColumn = sugarColumn.IsDisabledAlterColumn;
|
||||||
|
column.QuerySql = sugarColumn.QuerySql;
|
||||||
if (sugarColumn.IsJson && String.IsNullOrEmpty(sugarColumn.ColumnDataType))
|
if (sugarColumn.IsJson && String.IsNullOrEmpty(sugarColumn.ColumnDataType))
|
||||||
{
|
{
|
||||||
if (this.Context.CurrentConnectionConfig.DbType == DbType.PostgreSQL)
|
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();
|
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
|
else
|
||||||
{
|
{
|
||||||
@@ -920,6 +920,16 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
return result;
|
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
|
public virtual string GetWhereValueString
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@@ -47,5 +47,6 @@ namespace SqlSugar
|
|||||||
public string UpdateSql { get; set; }
|
public string UpdateSql { get; set; }
|
||||||
public object ExtendedAttribute { get; set; }
|
public object ExtendedAttribute { get; set; }
|
||||||
public bool IsDisabledAlterColumn { get; set; }
|
public bool IsDisabledAlterColumn { get; set; }
|
||||||
|
public string QuerySql { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -210,6 +210,7 @@ namespace SqlSugar
|
|||||||
public int CreateTableFieldSort { get; set; }
|
public int CreateTableFieldSort { get; set; }
|
||||||
public bool InsertServerTime { get; set; }
|
public bool InsertServerTime { get; set; }
|
||||||
public string InsertSql { get; set; }
|
public string InsertSql { get; set; }
|
||||||
|
public string QuerySql { get; set; }
|
||||||
public bool UpdateServerTime { get; set; }
|
public bool UpdateServerTime { get; set; }
|
||||||
public string UpdateSql { get; set; }
|
public string UpdateSql { get; set; }
|
||||||
public object ExtendedAttribute{ get; set; }
|
public object ExtendedAttribute{ get; set; }
|
||||||
|
Reference in New Issue
Block a user