diff --git a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs index 43a25a86d..f979b1085 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs @@ -230,6 +230,14 @@ namespace SqlSugar return this; } + public IDeleteable Where(List conditionalModels) + { + var sql = this.Context.Queryable().SqlBuilder.ConditionalModelToSql(conditionalModels); + var result = this; + result.Where(sql.Key, sql.Value); + return result; + } + public IDeleteable RemoveDataCache() { this.RemoveCacheFunc = () => diff --git a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs index d9ae2722c..007424ac1 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs @@ -345,6 +345,14 @@ namespace SqlSugar UpdateBuilder.WhereValues.Add(whereString); return this; } + public IUpdateable Where(List conditionalModels) + { + Check.Exception(UpdateObjectNotWhere() && UpdateObjs.Length > 1, ErrorMessage.GetThrowMessage("update List no support where", "集合更新不支持Where请使用WhereColumns")); + var sql = this.Context.Queryable().SqlBuilder.ConditionalModelToSql(conditionalModels); + var result = this; + result.Where(sql.Key, sql.Value); + return result; + } public IUpdateable Where(string whereSql, object parameters = null) { Check.Exception(UpdateObjectNotWhere() && UpdateObjs.Length > 1, ErrorMessage.GetThrowMessage("update List no support where", "集合更新不支持Where请使用WhereColumns")); diff --git a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Entities/ConditionalModel.cs b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Entities/ConditionalModel.cs index 3d58da69e..d563ebee7 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Entities/ConditionalModel.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Entities/ConditionalModel.cs @@ -22,6 +22,8 @@ namespace SqlSugar public string FieldName { get; set; } public string FieldValue { get; set; } public ConditionalType ConditionalType { get; set; } + [System.Text.Json.Serialization.JsonIgnoreAttribute] + [Newtonsoft.Json.JsonIgnoreAttribute] public Func FieldValueConvertFunc { get; set; } } } diff --git a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Interface/IDeleteable.cs b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Interface/IDeleteable.cs index db3006695..de915547e 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Interface/IDeleteable.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Interface/IDeleteable.cs @@ -30,6 +30,7 @@ namespace SqlSugar IDeleteable Where(string whereString, SugarParameter[] parameters); IDeleteable Where(string whereString, List parameters); IDeleteable WhereColumns(Expression> columns); + IDeleteable Where(List conditionalModels); IDeleteable EnableDiffLogEvent(object businessData = null); IDeleteable RemoveDataCache(); IDeleteable RemoveDataCache(string likeString); diff --git a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Interface/IUpdateable.cs b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Interface/IUpdateable.cs index 199b927b2..99129fbc2 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Interface/IUpdateable.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Interface/IUpdateable.cs @@ -43,6 +43,7 @@ namespace SqlSugar IUpdateable WhereColumns(Expression> columns); IUpdateable WhereColumns(string columnName); IUpdateable WhereColumns(params string [] columnNames); + IUpdateable Where(List conditionalModels); /// /// .UpdateColumns(it=>new{ it.Name,it.Price})