diff --git a/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs index 676c9c905..925307dc0 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs @@ -870,6 +870,14 @@ namespace SqlSugar SetColumns(columns); return this; } + public IUpdateable In(Expression> inField, ISugarQueryable childQueryExpression) + { + var lamResult = UpdateBuilder.GetExpressionValue(inField, ResolveExpressType.FieldSingle); + var fieldName = lamResult.GetResultString(); + var sql = childQueryExpression.ToSql(); + Where($" {fieldName} IN ( SELECT {fieldName} FROM ( {sql.Key} ) SUBDEL) ", sql.Value); + return this; + } public IUpdateable WhereIF(bool isWhere, Expression> expression) { Check.ExceptionEasy(!StaticConfig.EnableAllWhereIF, "Need to program startup configuration StaticConfig. EnableAllWhereIF = true; Tip: This operation is very risky if there are no conditions it is easy to update the entire table", " 需要程序启动时配置StaticConfig.EnableAllWhereIF=true; 提示:该操作存在很大的风险如果没有条件很容易将整个表全部更新"); diff --git a/Src/Asp.Net/SqlSugar/Interface/IUpdateable.cs b/Src/Asp.Net/SqlSugar/Interface/IUpdateable.cs index 566ebd29e..690c0351a 100644 --- a/Src/Asp.Net/SqlSugar/Interface/IUpdateable.cs +++ b/Src/Asp.Net/SqlSugar/Interface/IUpdateable.cs @@ -29,7 +29,7 @@ namespace SqlSugar IUpdateable AS(string tableName); IUpdateable AsType(Type tableNameType); IUpdateable With(string lockString); - + IUpdateable In(Expression> inField, ISugarQueryable childQueryExpression); IUpdateable Where(Expression> expression); IUpdateable WhereIF(bool isWhere,Expression> expression);