mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
-
This commit is contained in:
parent
c116a49b99
commit
ae879c3259
@ -15,7 +15,7 @@ namespace OrmTest.Models
|
||||
public int Id { get; set; }
|
||||
public int? SchoolId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public DateTimeOffset? CreateTime { get; set; }
|
||||
public DateTime? CreateTime { get; set; }
|
||||
[SugarColumn(IsIgnore=true)]
|
||||
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\SubMin.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\SubSelect.cs" />
|
||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubSelectDefault.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user