mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-20 02:29:39 +08:00
-
This commit is contained in:
@@ -15,7 +15,7 @@ namespace OrmTest.Models
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int? SchoolId { get; set; }
|
public int? SchoolId { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public DateTimeOffset? CreateTime { get; set; }
|
public DateTime? CreateTime { get; set; }
|
||||||
[SugarColumn(IsIgnore=true)]
|
[SugarColumn(IsIgnore=true)]
|
||||||
public int TestId { get; set; }
|
public int TestId { get; set; }
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,44 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SqlSugar
|
||||||
|
{
|
||||||
|
public class SubOrderBy : ISubOperation
|
||||||
|
{
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "OrderBy"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Expression Expression
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Sort
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return 480;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExpressionContext Context
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetValue(Expression expression)
|
||||||
|
{
|
||||||
|
var exp = expression as MethodCallExpression;
|
||||||
|
var argExp = exp.Arguments[0];
|
||||||
|
var result = "ORDER BY " + SubTools.GetMethodValue(this.Context, argExp, ResolveExpressType.FieldSingle);
|
||||||
|
var selfParameterName = this.Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters.First().Name) + UtilConstants.Dot;
|
||||||
|
result = result.Replace(selfParameterName, string.Empty);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -82,6 +82,7 @@
|
|||||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubBegin.cs" />
|
<Compile Include="ExpressionsToSql\Subquery\Items\SubBegin.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubMin.cs" />
|
<Compile Include="ExpressionsToSql\Subquery\Items\SubMin.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubMax.cs" />
|
<Compile Include="ExpressionsToSql\Subquery\Items\SubMax.cs" />
|
||||||
|
<Compile Include="ExpressionsToSql\Subquery\Items\SubOrderBy.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubRightBracket.cs" />
|
<Compile Include="ExpressionsToSql\Subquery\Items\SubRightBracket.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubSelect.cs" />
|
<Compile Include="ExpressionsToSql\Subquery\Items\SubSelect.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubSelectDefault.cs" />
|
<Compile Include="ExpressionsToSql\Subquery\Items\SubSelectDefault.cs" />
|
||||||
|
Reference in New Issue
Block a user