Synchronization code

This commit is contained in:
sunkaixuan 2024-01-19 20:16:22 +08:00
parent 5b433d9a80
commit f8c63d5c07
3 changed files with 10 additions and 2 deletions

View File

@ -2,7 +2,7 @@
<package >
<metadata>
<id>SqlSugar</id>
<version>5.1.4.135</version>
<version>5.1.4.137-preview10</version>
<title>.Net Framework 安装此版本, 5.0.3.3-max 最低要求 .Net Framework 4.6 | 5.0.0.2-5.0.3.2 最低要求 .Net Framework 4.5 | 4.0-4.9.11 最低要求 .Net Framework 4.0+ .NET ORM </title>
<authors>sun kaixuan</authors>
<owners>landa</owners>

View File

@ -870,6 +870,14 @@ namespace SqlSugar
SetColumns(columns);
return this;
}
public IUpdateable<T> In<PkType>(Expression<Func<T, object>> inField, ISugarQueryable<PkType> 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<T> WhereIF(bool isWhere, Expression<Func<T, bool>> 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; 提示:该操作存在很大的风险如果没有条件很容易将整个表全部更新");

View File

@ -29,7 +29,7 @@ namespace SqlSugar
IUpdateable<T> AS(string tableName);
IUpdateable<T> AsType(Type tableNameType);
IUpdateable<T> With(string lockString);
IUpdateable<T> In<PkType>(Expression<Func<T, object>> inField, ISugarQueryable<PkType> childQueryExpression);
IUpdateable<T> Where(Expression<Func<T, bool>> expression);
IUpdateable<T> WhereIF(bool isWhere,Expression<Func<T, bool>> expression);