Add SqlFunc.AggregateDistinctCount

This commit is contained in:
sunkaixuan 2019-05-25 07:29:17 +08:00
parent 1a0f80fdf6
commit b89c05d2bc
3 changed files with 9 additions and 0 deletions

View File

@ -264,6 +264,12 @@ namespace SqlSugar
return string.Format("COUNT({0})", parameter.MemberName);
}
public virtual string AggregateDistinctCount(MethodCallExpressionModel model)
{
var parameter = model.Args[0];
return string.Format("COUNT(DISTINCT{0})", parameter.MemberName);
}
public virtual string MappingColumn(MethodCallExpressionModel model)
{
var parameter = model.Args[0];

View File

@ -48,6 +48,7 @@ namespace SqlSugar
string AggregateMin(MethodCallExpressionModel model);
string AggregateMax(MethodCallExpressionModel model);
string AggregateCount(MethodCallExpressionModel model);
string AggregateDistinctCount(MethodCallExpressionModel model);
string MappingColumn(MethodCallExpressionModel model);
string IsNull(MethodCallExpressionModel model);
string GetSelfAndAutoFill(string shortName,bool isSingle);

View File

@ -578,6 +578,8 @@ namespace SqlSugar
return this.Context.DbMehtods.AggregateMax(model);
case "AggregateCount":
return this.Context.DbMehtods.AggregateCount(model);
case "AggregateDistinctCount":
return this.Context.DbMehtods.AggregateDistinctCount(model);
case "MappingColumn":
var mappingColumnResult = this.Context.DbMehtods.MappingColumn(model);
var isValid = model.Args[0].IsMember && model.Args[1].IsMember == false;