Browse Source

-

pull/12/MERGE
sunkaixuan 8 years ago
parent
commit
9d6d34b7b2
  1. 18
      SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs

18
SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs

@ -487,12 +487,20 @@ namespace SqlSugar
}
protected ISugarQueryable<T> _GroupBy(Expression expression)
{
LambdaExpression lambda = expression as LambdaExpression;
expression = lambda.Body;
var isSingle = QueryBuilder.IsSingle();
var lamResult = QueryBuilder.GetExpressionValue(expression, isSingle ? ResolveExpressType.FieldSingle : ResolveExpressType.FieldMultiple);
string result = lamResult.GetResultString();
if (result.IsNullOrEmpty()) {
lamResult = QueryBuilder.GetExpressionValue(expression, isSingle ? ResolveExpressType.ArraySingle : ResolveExpressType.ArrayMultiple);
result =string.Join(",",lamResult.GetResultArray().Select(it=>this.SqlBuilder.GetTranslationColumnName(typeof(T).Name,it)));
ExpressionResult lamResult = null;
string result = null;
if (expression is NewExpression)
{
lamResult = QueryBuilder.GetExpressionValue(expression, isSingle ? ResolveExpressType.ArraySingle : ResolveExpressType.ArrayMultiple);
result = string.Join(",", lamResult.GetResultArray().Select(it => this.SqlBuilder.GetTranslationColumnName(typeof(T).Name, it)));
}
else
{
lamResult=QueryBuilder.GetExpressionValue(expression, isSingle ? ResolveExpressType.FieldSingle : ResolveExpressType.FieldMultiple);
result = lamResult.GetResultString();
}
GroupBy(result);
return this;

Loading…
Cancel
Save