SqlFunc.AggregateSumNoNull
SqlFunc.Collate
This commit is contained in:
sunkaixuan
2022-11-26 22:26:53 +08:00
parent fbec8ed3cc
commit afb5f04a0e
4 changed files with 19 additions and 0 deletions

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}

View File

@@ -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"); }

View File

@@ -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;
}