diff --git a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/DbMethods/DefaultDbMethod.cs b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/DbMethods/DefaultDbMethod.cs index dde8a03e8..ff3180088 100644 --- a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/DbMethods/DefaultDbMethod.cs +++ b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/DbMethods/DefaultDbMethod.cs @@ -25,7 +25,7 @@ namespace SqlSugar public virtual string HasValue(MethodCallExpressionModel model) { var parameter = model.Args[0]; - return string.Format("( {0}<>'' AND {0} IS NOT NULL )", parameter.MemberName); + return string.Format("({0} IS NOT NULL )", parameter.MemberName); } public virtual string HasNumber(MethodCallExpressionModel model) diff --git a/Src/Asp.NetCore2/SqlSugar/Realization/SqlServer/SqlBuilder/SqlServerQueryBuilder.cs b/Src/Asp.NetCore2/SqlSugar/Realization/SqlServer/SqlBuilder/SqlServerQueryBuilder.cs index c63cd4ea1..331cceaba 100644 --- a/Src/Asp.NetCore2/SqlSugar/Realization/SqlServer/SqlBuilder/SqlServerQueryBuilder.cs +++ b/Src/Asp.NetCore2/SqlSugar/Realization/SqlServer/SqlBuilder/SqlServerQueryBuilder.cs @@ -78,8 +78,13 @@ namespace SqlSugar if (this.OrderByValue.IsNullOrEmpty()) { result += " ORDER BY GETDATE() "; + if(this.OldSql.HasValue()) + this.OldSql += " ORDER BY GETDATE() "; } result += this.Offset; + + if (this.OldSql.HasValue()) + this.OldSql += this.Offset; } result = GetSqlQuerySql(result); return result; diff --git a/Src/Asp.NetCore2/SqlSugar/SimpleClient.cs b/Src/Asp.NetCore2/SqlSugar/SimpleClient.cs index 6cba59f2f..1dee4c5cf 100644 --- a/Src/Asp.NetCore2/SqlSugar/SimpleClient.cs +++ b/Src/Asp.NetCore2/SqlSugar/SimpleClient.cs @@ -102,7 +102,7 @@ namespace SqlSugar { return Context.Queryable().Single(whereExpression); } - public T GetFirst(Expression> whereExpression) + public virtual T GetFirst(Expression> whereExpression) { return Context.Queryable().First(whereExpression); } @@ -232,7 +232,7 @@ namespace SqlSugar { return Context.Queryable().SingleAsync(whereExpression); } - public Task GetFirstAsync(Expression> whereExpression) + public virtual Task GetFirstAsync(Expression> whereExpression) { return Context.Queryable().FirstAsync(whereExpression); } diff --git a/Src/Asp.NetCore2/SqlSugar/Utilities/DataTableExtensions.cs b/Src/Asp.NetCore2/SqlSugar/Utilities/DataTableExtensions.cs index 2a74d7300..17425ce53 100644 --- a/Src/Asp.NetCore2/SqlSugar/Utilities/DataTableExtensions.cs +++ b/Src/Asp.NetCore2/SqlSugar/Utilities/DataTableExtensions.cs @@ -86,7 +86,7 @@ namespace SqlSugar if (rowSelector.Body is MemberExpression) rowName = ((MemberExpression)rowSelector.Body).Member.Name; else - rowName = string.Join(UtilConstants.ReplaceKey, ((NewExpression)rowSelector.Body).Arguments.Select(it => it as MemberExpression).Select(it => it.Member.Name)); + rowName = "Group_"+string.Join("_", ((NewExpression)rowSelector.Body).Arguments.Select(it => it as MemberExpression).Select(it => it.Member.Name)); var columns = source.Select(columnSelector).Distinct(); cols = (new[] { rowName }).Concat(columns.Select(x => x.ToString())).ToList();