Update 达梦 人大金仓

This commit is contained in:
sunkaixuan 2023-05-07 22:24:28 +08:00
parent 0835bbbe97
commit 4fbf4ae1b8
2 changed files with 17 additions and 0 deletions

View File

@ -7,6 +7,7 @@ namespace SqlSugar
{
public class DmUpdateBuilder : UpdateBuilder
{
public override string ReSetValueBySqlExpListType { get; set; } = "dm";
protected override string GetJoinUpdate(string columnsString, ref string whereString)
{
var joinString = $" {Builder.GetTranslationColumnName(this.TableName)} {Builder.GetTranslationColumnName(this.ShortName)} ";

View File

@ -178,9 +178,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($"{dbColumnName}=T.{dbColumnName}", $"{dbColumnName}={item.Value.Sql.Replace(dbColumnName, $"{Builder.GetTranslationColumnName(this.TableName)}.{dbColumnName}")}");
batchUpdateSql = new StringBuilder(result);
}
}
return batchUpdateSql;
}
protected override string GetJoinUpdate(string columnsString, ref string whereString)
{
var formString = $" {Builder.GetTranslationColumnName(this.TableName)} AS {Builder.GetTranslationColumnName(this.ShortName)} ";