Browse Source

Update Core

pull/14/MERGE
sunkaixuan 3 years ago
parent
commit
0715cfba40
  1. 2
      Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/DbMethods/DefaultDbMethod.cs
  2. 5
      Src/Asp.NetCore2/SqlSugar/Realization/SqlServer/SqlBuilder/SqlServerQueryBuilder.cs
  3. 4
      Src/Asp.NetCore2/SqlSugar/SimpleClient.cs
  4. 2
      Src/Asp.NetCore2/SqlSugar/Utilities/DataTableExtensions.cs

2
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)

5
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;

4
Src/Asp.NetCore2/SqlSugar/SimpleClient.cs

@ -102,7 +102,7 @@ namespace SqlSugar
{
return Context.Queryable<T>().Single(whereExpression);
}
public T GetFirst(Expression<Func<T, bool>> whereExpression)
public virtual T GetFirst(Expression<Func<T, bool>> whereExpression)
{
return Context.Queryable<T>().First(whereExpression);
}
@ -232,7 +232,7 @@ namespace SqlSugar
{
return Context.Queryable<T>().SingleAsync(whereExpression);
}
public Task<T> GetFirstAsync(Expression<Func<T, bool>> whereExpression)
public virtual Task<T> GetFirstAsync(Expression<Func<T, bool>> whereExpression)
{
return Context.Queryable<T>().FirstAsync(whereExpression);
}

2
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();

Loading…
Cancel
Save