mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-26 22:25:49 +08:00
Update Core
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<package >
|
||||
<metadata>
|
||||
<id>SqlSugar</id>
|
||||
<version>5.0.6.5</version>
|
||||
<version>5.0.6.6</version>
|
||||
<title>SqlSugar .NET ORM Framework 版本, 5.0.3.3-max 最低要求 .Net Framework 4.6 | 5.0.0.2-5.0.3.2 最低要求 .Net Framework 4.5 | 4.0-4.9.11 最低要求 .Net Framework 4.0+ .NET ORM </title>
|
||||
<authors>sun kaixuan</authors>
|
||||
<owners>landa</owners>
|
||||
|
||||
@@ -1911,7 +1911,28 @@ namespace SqlSugar
|
||||
{
|
||||
QueryBuilder.CheckExpression(expression, "OrderBy");
|
||||
var isSingle = QueryBuilder.IsSingle();
|
||||
if ((expression as LambdaExpression).Body is NewExpression)
|
||||
if (expression.ToString().IsContainsIn("Desc(", "Asc("))
|
||||
{
|
||||
var orderValue = "";
|
||||
var newExp = (expression as LambdaExpression).Body as NewExpression;
|
||||
foreach (var item in newExp.Arguments)
|
||||
{
|
||||
if (item is MemberExpression)
|
||||
{
|
||||
orderValue +=
|
||||
QueryBuilder.GetExpressionValue(item, isSingle ? ResolveExpressType.FieldSingle : ResolveExpressType.FieldMultiple).GetResultString() + ",";
|
||||
}
|
||||
else
|
||||
{
|
||||
orderValue +=
|
||||
QueryBuilder.GetExpressionValue(item, isSingle ? ResolveExpressType.WhereSingle : ResolveExpressType.WhereMultiple).GetResultString() + ",";
|
||||
}
|
||||
}
|
||||
orderValue = orderValue.TrimEnd(',');
|
||||
OrderBy(orderValue);
|
||||
return this;
|
||||
}
|
||||
else if ((expression as LambdaExpression).Body is NewExpression)
|
||||
{
|
||||
var lamResult = QueryBuilder.GetExpressionValue(expression, isSingle ? ResolveExpressType.ArraySingle : ResolveExpressType.ArrayMultiple);
|
||||
var items = lamResult.GetResultString().Split(',').Where(it => it.HasValue()).Select(it => it + UtilConstants.Space + type.ToString().ToUpper()).ToList();
|
||||
|
||||
@@ -526,5 +526,14 @@ namespace SqlSugar
|
||||
var parameter2 = model.Args[1];
|
||||
return string.Format(" ({0} <= {1}) ", parameter.MemberName, parameter2.MemberName);
|
||||
}
|
||||
|
||||
public virtual string Asc(MethodCallExpressionModel model)
|
||||
{
|
||||
return model.Args[0].MemberName + " ASC ";
|
||||
}
|
||||
public virtual string Desc(MethodCallExpressionModel model)
|
||||
{
|
||||
return model.Args[0].MemberName + " DESC ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,6 +80,8 @@ namespace SqlSugar
|
||||
string GreaterThan(MethodCallExpressionModel model);
|
||||
string GreaterThanOrEqual(MethodCallExpressionModel model);
|
||||
string LessThan(MethodCallExpressionModel model);
|
||||
string LessThanOrEqual(MethodCallExpressionModel model);
|
||||
string LessThanOrEqual(MethodCallExpressionModel model);
|
||||
string Asc(MethodCallExpressionModel model);
|
||||
string Desc(MethodCallExpressionModel model);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,14 @@ namespace SqlSugar
|
||||
{
|
||||
public partial class SqlFunc
|
||||
{
|
||||
|
||||
public static T Desc<T>(T value)
|
||||
{
|
||||
throw new NotSupportedException("Can only be used in expressions");
|
||||
}
|
||||
public static T Asc<T>(T value)
|
||||
{
|
||||
throw new NotSupportedException("Can only be used in expressions");
|
||||
}
|
||||
public static int DateDiff(DateType dateType,DateTime littleTime, DateTime bigTime)
|
||||
{
|
||||
throw new NotSupportedException("Can only be used in expressions");
|
||||
|
||||
@@ -910,6 +910,10 @@ namespace SqlSugar
|
||||
return this.Context.DbMehtods.LessThan(model);
|
||||
case "LessThanOrEqual":
|
||||
return this.Context.DbMehtods.LessThanOrEqual(model);
|
||||
case "Asc":
|
||||
return this.Context.DbMehtods.Asc(model);
|
||||
case "Desc":
|
||||
return this.Context.DbMehtods.Desc(model);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<Version>5.0.6.5</Version>
|
||||
<Version>5.0.6.6</Version>
|
||||
<Copyright>sun_kai_xuan</Copyright>
|
||||
<PackageProjectUrl>https://github.com/sunkaixuan/SqlSugar</PackageProjectUrl>
|
||||
<PackageLicenseUrl></PackageLicenseUrl>
|
||||
|
||||
@@ -637,7 +637,8 @@ namespace SqlSugar
|
||||
public SqlSugarProvider GetConnectionWithAttr<T>()
|
||||
{
|
||||
var attr = typeof(T).GetCustomAttribute<TenantAttribute>();
|
||||
Check.ExceptionEasy(attr==null,"not TenantAttribute", "不存在特性 TenantAttribute");
|
||||
if (attr == null)
|
||||
return this.GetConnection(this.CurrentConnectionConfig.ConfigId);
|
||||
var configId = attr.configId;
|
||||
return this.GetConnection(configId);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<package >
|
||||
<metadata>
|
||||
<id>SqlSugarCore</id>
|
||||
<version>5.0.6.5</version>
|
||||
<version>5.0.6.6</version>
|
||||
<authors>sunkaixuan</authors>
|
||||
<owners>果糖大数据科技</owners>
|
||||
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<package >
|
||||
<metadata>
|
||||
<id>SqlSugarCoreNoDrive</id>
|
||||
<version>5.0.6.5</version>
|
||||
<version>5.0.6.6</version>
|
||||
<authors>sunkaixuan</authors>
|
||||
<owners>Landa</owners>
|
||||
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>
|
||||
|
||||
Reference in New Issue
Block a user