mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-18 17:48:11 +08:00
Deleteable & Updateable .Where(List<ConditionalModel>)
This commit is contained in:
@@ -230,6 +230,14 @@ namespace SqlSugar
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IDeleteable<T> Where(List<IConditionalModel> conditionalModels)
|
||||||
|
{
|
||||||
|
var sql = this.Context.Queryable<T>().SqlBuilder.ConditionalModelToSql(conditionalModels);
|
||||||
|
var result = this;
|
||||||
|
result.Where(sql.Key, sql.Value);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public IDeleteable<T> RemoveDataCache()
|
public IDeleteable<T> RemoveDataCache()
|
||||||
{
|
{
|
||||||
this.RemoveCacheFunc = () =>
|
this.RemoveCacheFunc = () =>
|
||||||
|
@@ -345,6 +345,14 @@ namespace SqlSugar
|
|||||||
UpdateBuilder.WhereValues.Add(whereString);
|
UpdateBuilder.WhereValues.Add(whereString);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
public IUpdateable<T> Where(List<IConditionalModel> conditionalModels)
|
||||||
|
{
|
||||||
|
Check.Exception(UpdateObjectNotWhere() && UpdateObjs.Length > 1, ErrorMessage.GetThrowMessage("update List no support where", "集合更新不支持Where请使用WhereColumns"));
|
||||||
|
var sql = this.Context.Queryable<T>().SqlBuilder.ConditionalModelToSql(conditionalModels);
|
||||||
|
var result = this;
|
||||||
|
result.Where(sql.Key, sql.Value);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
public IUpdateable<T> Where(string whereSql, object parameters = null)
|
public IUpdateable<T> Where(string whereSql, object parameters = null)
|
||||||
{
|
{
|
||||||
Check.Exception(UpdateObjectNotWhere() && UpdateObjs.Length > 1, ErrorMessage.GetThrowMessage("update List no support where", "集合更新不支持Where请使用WhereColumns"));
|
Check.Exception(UpdateObjectNotWhere() && UpdateObjs.Length > 1, ErrorMessage.GetThrowMessage("update List no support where", "集合更新不支持Where请使用WhereColumns"));
|
||||||
|
@@ -22,6 +22,8 @@ namespace SqlSugar
|
|||||||
public string FieldName { get; set; }
|
public string FieldName { get; set; }
|
||||||
public string FieldValue { get; set; }
|
public string FieldValue { get; set; }
|
||||||
public ConditionalType ConditionalType { get; set; }
|
public ConditionalType ConditionalType { get; set; }
|
||||||
|
[System.Text.Json.Serialization.JsonIgnoreAttribute]
|
||||||
|
[Newtonsoft.Json.JsonIgnoreAttribute]
|
||||||
public Func<string,object> FieldValueConvertFunc { get; set; }
|
public Func<string,object> FieldValueConvertFunc { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,6 +30,7 @@ namespace SqlSugar
|
|||||||
IDeleteable<T> Where(string whereString, SugarParameter[] parameters);
|
IDeleteable<T> Where(string whereString, SugarParameter[] parameters);
|
||||||
IDeleteable<T> Where(string whereString, List<SugarParameter> parameters);
|
IDeleteable<T> Where(string whereString, List<SugarParameter> parameters);
|
||||||
IDeleteable<T> WhereColumns(Expression<Func<T, object>> columns);
|
IDeleteable<T> WhereColumns(Expression<Func<T, object>> columns);
|
||||||
|
IDeleteable<T> Where(List<IConditionalModel> conditionalModels);
|
||||||
IDeleteable<T> EnableDiffLogEvent(object businessData = null);
|
IDeleteable<T> EnableDiffLogEvent(object businessData = null);
|
||||||
IDeleteable<T> RemoveDataCache();
|
IDeleteable<T> RemoveDataCache();
|
||||||
IDeleteable<T> RemoveDataCache(string likeString);
|
IDeleteable<T> RemoveDataCache(string likeString);
|
||||||
|
@@ -43,6 +43,7 @@ namespace SqlSugar
|
|||||||
IUpdateable<T> WhereColumns(Expression<Func<T, object>> columns);
|
IUpdateable<T> WhereColumns(Expression<Func<T, object>> columns);
|
||||||
IUpdateable<T> WhereColumns(string columnName);
|
IUpdateable<T> WhereColumns(string columnName);
|
||||||
IUpdateable<T> WhereColumns(params string [] columnNames);
|
IUpdateable<T> WhereColumns(params string [] columnNames);
|
||||||
|
IUpdateable<T> Where(List<IConditionalModel> conditionalModels);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// .UpdateColumns(it=>new{ it.Name,it.Price})
|
/// .UpdateColumns(it=>new{ it.Name,it.Price})
|
||||||
|
Reference in New Issue
Block a user