From f2dd59f14cb28c2d87d6859dd1a3da2c5f86f992 Mon Sep 17 00:00:00 2001 From: sunkaixuna <610262374@qq.com> Date: Sat, 18 Dec 2021 21:36:48 +0800 Subject: [PATCH] SetColumns(Expression> columns) Subquery bug --- .../SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs index d7acb5613..985dac4f7 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs @@ -356,6 +356,11 @@ namespace SqlSugar CheckTranscodeing(); } + if (columns.ToString().Contains("Subqueryable().")) + { + expResult= expResult.Replace(this.SqlBuilder.SqlTranslationLeft+ (binaryExp.Left as MemberExpression).Expression+this.SqlBuilder.SqlTranslationRight+".",this.UpdateBuilder.GetTableNameString.TrimEnd()+"."); + } + UpdateBuilder.SetValues.Add(new KeyValuePair(SqlBuilder.GetTranslationColumnName(key), expResult)); this.UpdateBuilder.DbColumnInfoList = this.UpdateBuilder.DbColumnInfoList.Where(it => (UpdateParameterIsNull == false && IsPrimaryKey(it)) || UpdateBuilder.SetValues.Any(v => SqlBuilder.GetNoTranslationColumnName(v.Key).Equals(it.DbColumnName, StringComparison.CurrentCultureIgnoreCase) || SqlBuilder.GetNoTranslationColumnName(v.Key).Equals(it.PropertyName, StringComparison.CurrentCultureIgnoreCase)) || it.IsPrimarykey == true).ToList(); AppendSets();