mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-26 10:19:40 +08:00
Add db.Updateable.in
This commit is contained in:
@@ -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; 提示:该操作存在很大的风险如果没有条件很容易将整个表全部更新");
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user