mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-09 02:44:58 +08:00
Add WhereColumns(+2)
This commit is contained in:
@@ -423,6 +423,25 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
return WhereColumns(new List<Dictionary<string, object>> { dictionary });
|
return WhereColumns(new List<Dictionary<string, object>> { dictionary });
|
||||||
}
|
}
|
||||||
|
public ISugarQueryable<T> WhereColumns(Dictionary<string, object> columns, bool ignoreDefaultValue)
|
||||||
|
{
|
||||||
|
if (ignoreDefaultValue == false || columns == null)
|
||||||
|
{
|
||||||
|
return WhereColumns(columns);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var newColumns = new Dictionary<string, object>();
|
||||||
|
foreach (var item in columns)
|
||||||
|
{
|
||||||
|
if (!UtilMethods.IsDefaultValue(item.Value))
|
||||||
|
{
|
||||||
|
newColumns.Add(item.Key, item.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return WhereColumns(newColumns);
|
||||||
|
}
|
||||||
|
}
|
||||||
public ISugarQueryable<T> WhereColumns(List<Dictionary<string, object>> list)
|
public ISugarQueryable<T> WhereColumns(List<Dictionary<string, object>> list)
|
||||||
{
|
{
|
||||||
List<IConditionalModel> conditionalModels = new List<IConditionalModel>();
|
List<IConditionalModel> conditionalModels = new List<IConditionalModel>();
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ namespace SqlSugar
|
|||||||
ISugarQueryable<T> WhereClassByPrimaryKey(List<T> list);
|
ISugarQueryable<T> WhereClassByPrimaryKey(List<T> list);
|
||||||
ISugarQueryable<T> WhereClassByPrimaryKey(T data) ;
|
ISugarQueryable<T> WhereClassByPrimaryKey(T data) ;
|
||||||
ISugarQueryable<T> WhereColumns(List<Dictionary<string, object>> columns);
|
ISugarQueryable<T> WhereColumns(List<Dictionary<string, object>> columns);
|
||||||
|
ISugarQueryable<T> WhereColumns(Dictionary<string, object> columns, bool ignoreDefaultValue);
|
||||||
ISugarQueryable<T> WhereColumns(Dictionary<string, object> columns);
|
ISugarQueryable<T> WhereColumns(Dictionary<string, object> columns);
|
||||||
ISugarQueryable<T> TranLock(DbLockType LockType = DbLockType.Wait);
|
ISugarQueryable<T> TranLock(DbLockType LockType = DbLockType.Wait);
|
||||||
ISugarQueryable<T> Where(Expression<Func<T, bool>> expression);
|
ISugarQueryable<T> Where(Expression<Func<T, bool>> expression);
|
||||||
|
|||||||
@@ -17,6 +17,12 @@ namespace SqlSugar
|
|||||||
public class UtilMethods
|
public class UtilMethods
|
||||||
{
|
{
|
||||||
|
|
||||||
|
internal static bool IsDefaultValue(object value)
|
||||||
|
{
|
||||||
|
if (value == null) return true;
|
||||||
|
return value.Equals(UtilMethods.GetDefaultValue(value.GetType()));
|
||||||
|
}
|
||||||
|
|
||||||
internal static DateTime ConvertFromDateTimeOffset(DateTimeOffset dateTime)
|
internal static DateTime ConvertFromDateTimeOffset(DateTimeOffset dateTime)
|
||||||
{
|
{
|
||||||
if (dateTime.Offset.Equals(TimeSpan.Zero))
|
if (dateTime.Offset.Equals(TimeSpan.Zero))
|
||||||
|
|||||||
Reference in New Issue
Block a user