mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 18:55:07 +08:00
-
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
|
||||
namespace SqlSugar
|
||||
{
|
||||
public class SubMax:ISubOperation
|
||||
{
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Max";
|
||||
}
|
||||
}
|
||||
|
||||
public Expression Expression
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
|
||||
public int Sort
|
||||
{
|
||||
get
|
||||
{
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
|
||||
public ExpressionContext Context
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string GetValue(Expression expression = null)
|
||||
{
|
||||
var exp = expression as MethodCallExpression;
|
||||
return "MAX("+SubTools.GetMethodValue(this.Context, exp.Arguments[0], ResolveExpressType.FieldSingle)+")";
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
|
||||
namespace SqlSugar
|
||||
{
|
||||
public class SubMin: ISubOperation
|
||||
{
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Min";
|
||||
}
|
||||
}
|
||||
|
||||
public Expression Expression
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
|
||||
public int Sort
|
||||
{
|
||||
get
|
||||
{
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
|
||||
public ExpressionContext Context
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string GetValue(Expression expression = null)
|
||||
{
|
||||
var exp = expression as MethodCallExpression;
|
||||
return "MIN(" + SubTools.GetMethodValue(this.Context, exp.Arguments[0], ResolveExpressType.FieldSingle) + ")";
|
||||
}
|
||||
}
|
||||
}
|
@@ -20,7 +20,9 @@ namespace SqlSugar
|
||||
new SubNotAny(){ Context=Context },
|
||||
new SubBegin(){ Context=Context },
|
||||
new SubFromTable(){ Context=Context },
|
||||
new SubCount(){ Context=Context }
|
||||
new SubCount(){ Context=Context },
|
||||
new SubMax(){ Context=Context },
|
||||
new SubMin(){ Context=Context }
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -79,6 +79,8 @@
|
||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubFromTable.cs" />
|
||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubAny.cs" />
|
||||
<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\SubRightBracket.cs" />
|
||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubSelect.cs" />
|
||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubSelectDefault.cs" />
|
||||
|
Reference in New Issue
Block a user