mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-05 03:17:41 +08:00
Add:
SqlFunc.AggregateSumNoNull SqlFunc.Collate
This commit is contained in:
@@ -669,5 +669,16 @@ namespace SqlSugar
|
||||
model.Args[0].MemberName = ToString(model);
|
||||
return Contains(model);
|
||||
}
|
||||
public string Collate(MethodCallExpressionModel model)
|
||||
{
|
||||
var name=model.Args[0].MemberName;
|
||||
return $" {name} collate Chinese_PRC_CS_AS ";
|
||||
}
|
||||
public string AggregateSumNoNull(MethodCallExpressionModel model)
|
||||
{
|
||||
model.Args[0].MemberName = AggregateSum(model);
|
||||
model.Args.Add(new MethodCallExpressionArgs() { MemberValue = 0, MemberName = 0 });
|
||||
return IsNull(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,5 +98,7 @@ namespace SqlSugar
|
||||
string JsonArrayLength(MethodCallExpressionModel model);
|
||||
string JsonParse(MethodCallExpressionModel model);
|
||||
string JsonLike(MethodCallExpressionModel model);
|
||||
string Collate(MethodCallExpressionModel model);
|
||||
string AggregateSumNoNull(MethodCallExpressionModel model);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,6 +221,8 @@ namespace SqlSugar
|
||||
public static string Replace(object value, string oldChar, string newChar) { return value.ObjToString().Replace(oldChar, newChar); }
|
||||
public static int Length(object value) { return value.ObjToString().Length; }
|
||||
public static TResult AggregateSum<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
public static TResult AggregateSumNoNull<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
public static string Collate(string thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
public static TResult AggregateAvg<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
public static TResult AggregateMin<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
public static TResult AggregateMax<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
|
||||
@@ -748,6 +748,10 @@ namespace SqlSugar
|
||||
return this.Context.DbMehtods.JsonParse(model);
|
||||
case "JsonLike":
|
||||
return this.Context.DbMehtods.JsonLike(model);
|
||||
case "Collate":
|
||||
return this.Context.DbMehtods.Collate(model);
|
||||
case "AggregateSumNoNull":
|
||||
return this.Context.DbMehtods.AggregateSumNoNull(model);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user