Add Sqlfunc.AggregateDistinctSum

This commit is contained in:
sunkaixuan 2025-01-16 13:43:31 +08:00
parent 5efe2e1ba8
commit 97f2fddb15
3 changed files with 7 additions and 0 deletions

View File

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

View File

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

View File

@ -360,6 +360,7 @@ namespace SqlSugar
public static TResult AggregateMax<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
public static int AggregateCount<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
public static int AggregateDistinctCount<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
public static int AggregateDistinctSum<TResult>(TResult thisValue) { throw new NotSupportedException("Can only be used in expressions"); }
public static TResult MappingColumn<TResult>(TResult type,string newColumnName) { throw new NotSupportedException("Can only be used in expressions"); }
public static TResult MappingColumn<TResult>(string newColumnName) { throw new NotSupportedException("Can only be used in expressions"); }
/// <summary>