mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-02 03:13:58 +08:00
Update mysql
This commit is contained in:
@@ -424,7 +424,7 @@ namespace SqlSugar
|
||||
{
|
||||
return LambdaExpressions.DbMehtods.GetDate();
|
||||
}
|
||||
else if (this.ReSetValueBySqlExpListType!=null&&this.ReSetValueBySqlExpList != null && this.ReSetValueBySqlExpList.ContainsKey(columnInfo.PropertyName))
|
||||
else if (IsListSetExp(columnInfo)|| IsSingleSetExp(columnInfo))
|
||||
{
|
||||
return this.ReSetValueBySqlExpList[columnInfo.PropertyName].Sql;
|
||||
}
|
||||
@@ -486,6 +486,17 @@ namespace SqlSugar
|
||||
return name + "";
|
||||
}
|
||||
}
|
||||
private bool IsSingleSetExp(DbColumnInfo columnInfo)
|
||||
{
|
||||
return this.ReSetValueBySqlExpList != null &&
|
||||
this.ReSetValueBySqlExpList.ContainsKey(columnInfo.PropertyName) &&
|
||||
this.IsListUpdate == null&&
|
||||
DbColumnInfoList.GroupBy(it => it.TableId).Count()==1;
|
||||
}
|
||||
private bool IsListSetExp(DbColumnInfo columnInfo)
|
||||
{
|
||||
return this.ReSetValueBySqlExpListType != null && this.ReSetValueBySqlExpList != null && this.ReSetValueBySqlExpList.ContainsKey(columnInfo.PropertyName);
|
||||
}
|
||||
//public virtual string GetDbColumn(DbColumnInfo columnInfo, string name)
|
||||
//{
|
||||
// if (columnInfo.UpdateServerTime)
|
||||
|
||||
@@ -97,8 +97,25 @@ namespace SqlSugar
|
||||
batchUpdateSql.Replace("${0}",format);
|
||||
batchUpdateSql.Append(";");
|
||||
}
|
||||
batchUpdateSql = GetBatchUpdateSql(batchUpdateSql);
|
||||
return batchUpdateSql.ToString();
|
||||
}
|
||||
|
||||
private StringBuilder GetBatchUpdateSql(StringBuilder batchUpdateSql)
|
||||
{
|
||||
if (ReSetValueBySqlExpListType == null && ReSetValueBySqlExpList != null)
|
||||
{
|
||||
var result = batchUpdateSql.ToString();
|
||||
foreach (var item in ReSetValueBySqlExpList)
|
||||
{
|
||||
var dbColumnName = item.Value.DbColumnName;
|
||||
result = result.Replace($"T.{dbColumnName}", item.Value.Sql.Replace(dbColumnName, "S." + dbColumnName));
|
||||
batchUpdateSql = new StringBuilder(result);
|
||||
}
|
||||
}
|
||||
|
||||
return batchUpdateSql;
|
||||
}
|
||||
int i = 0;
|
||||
public object FormatValue(object value,string name)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user