From 0fbe8237b1830f1c923d3ae33d11ff88288a5a90 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Mon, 17 Jul 2023 19:18:14 +0800 Subject: [PATCH] Synchronization code --- .../QueryableProvider/QueryableProvider.cs | 11 +++++++++ .../QueryableProvider02-05.cs | 24 +++++++++++++++++++ .../SplitTableUpdateByObjectProvider.cs | 1 + .../SqlSugar/Interface/IQueryable.cs | 4 ++++ 4 files changed, 40 insertions(+) diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs index 4a9953b66..8c1e9cc5d 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs @@ -901,6 +901,17 @@ namespace SqlSugar if (list == null) return default(T); else return list.SingleOrDefault(); } + public ISugarQueryable InIF(bool isIn,string fieldName, params TParamter[] pkValues) + { + if (isIn) + { + return In(fieldName, pkValues); + } + else + { + return this; + } + } public ISugarQueryable InIF(bool isIn, params TParamter[] pkValues) { if (isIn) diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableProvider02-05.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableProvider02-05.cs index 64b00ee4e..65ded1e71 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableProvider02-05.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableProvider02-05.cs @@ -440,6 +440,14 @@ namespace SqlSugar #endregion #region In + public new ISugarQueryable InIF(bool isIn, string fieldName, params TParamter[] pkValues) + { + if (isIn) + { + In(fieldName, pkValues); + } + return this; + } public new ISugarQueryable InIF(bool isIn, params TParamter[] pkValues) { if (isIn) @@ -1133,6 +1141,14 @@ namespace SqlSugar #endregion #region In + public new ISugarQueryable InIF(bool isIn, string fieldName, params TParamter[] pkValues) + { + if (isIn) + { + In(fieldName, pkValues); + } + return this; + } public new ISugarQueryable InIF(bool isIn, params TParamter[] pkValues) { if (isIn) @@ -1843,6 +1859,14 @@ namespace SqlSugar #endregion #region In + public new ISugarQueryable InIF(bool isIn, string fieldName, params TParamter[] pkValues) + { + if (isIn) + { + In(fieldName, pkValues); + } + return this; + } public new ISugarQueryable InIF(bool isIn, params TParamter[] pkValues) { if (isIn) diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/UpdateProvider/SplitTableUpdateByObjectProvider.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/UpdateProvider/SplitTableUpdateByObjectProvider.cs index fa5c3739a..1976ca5b5 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/UpdateProvider/SplitTableUpdateByObjectProvider.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/UpdateProvider/SplitTableUpdateByObjectProvider.cs @@ -42,6 +42,7 @@ namespace SqlSugar { var addList = item.Select(it => it.Item).ToList(); result += await this.Context.Updateable(addList) + .UpdateColumns(updateobj.UpdateBuilder.UpdateColumns?.ToArray()) .IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity, this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue) .IgnoreColumns(GetIgnoreColumns()).AS(item.Key).ExecuteCommandAsync(); } diff --git a/Src/Asp.NetCore2/SqlSugar/Interface/IQueryable.cs b/Src/Asp.NetCore2/SqlSugar/Interface/IQueryable.cs index cb38bb419..66b0fbe71 100644 --- a/Src/Asp.NetCore2/SqlSugar/Interface/IQueryable.cs +++ b/Src/Asp.NetCore2/SqlSugar/Interface/IQueryable.cs @@ -95,6 +95,7 @@ namespace SqlSugar T InSingle(object pkValue); Task InSingleAsync(object pkValue); ISugarQueryable In(params TParamter[] pkValues); + ISugarQueryable InIF(bool isIn, string fieldName, params TParamter[] pkValues); ISugarQueryable InIF(bool isIn,params TParamter[] pkValues); ISugarQueryable In(string InFieldName, params FieldType[] inValues); ISugarQueryable In(Expression> expression, params FieldType[] inValues); @@ -371,6 +372,7 @@ namespace SqlSugar ISugarQueryable In(Expression> expression, List inValues); ISugarQueryable In(Expression> expression, ISugarQueryable childQueryExpression); new ISugarQueryable InIF(bool isIn, params TParamter[] pkValues); + new ISugarQueryable InIF(bool isIn, string fieldName, params TParamter[] pkValues); #endregion #region Other @@ -506,6 +508,7 @@ namespace SqlSugar ISugarQueryable In(Expression> expression, ISugarQueryable childQueryExpression); new ISugarQueryable InIF(bool isIn, params TParamter[] pkValues); + new ISugarQueryable InIF(bool isIn, string fieldName, params TParamter[] pkValues); #endregion #region Other @@ -647,6 +650,7 @@ namespace SqlSugar ISugarQueryable In(Expression> expression, ISugarQueryable childQueryExpression); new ISugarQueryable InIF(bool isIn, params TParamter[] pkValues); + new ISugarQueryable InIF(bool isIn, string fieldName, params TParamter[] pkValues); #endregion #region Other