mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
-
This commit is contained in:
parent
e987c57f3f
commit
fa162e8748
@ -284,12 +284,12 @@ namespace OrmTest.Demo
|
|||||||
var getUnionAllList2 = db.UnionAll(db.Queryable<Student>(), db.Queryable<Student>()).ToList();
|
var getUnionAllList2 = db.UnionAll(db.Queryable<Student>(), db.Queryable<Student>()).ToList();
|
||||||
|
|
||||||
var test1 = db.Queryable<Student, School>((st, sc) => st.SchoolId == sc.Id).Where(st=>st.CreateTime>SqlFunc.GetDate()).Select((st, sc) => SqlFunc.ToInt64(sc.Id)).ToList();
|
var test1 = db.Queryable<Student, School>((st, sc) => st.SchoolId == sc.Id).Where(st=>st.CreateTime>SqlFunc.GetDate()).Select((st, sc) => SqlFunc.ToInt64(sc.Id)).ToList();
|
||||||
//var test2= db.Queryable<Student, School>((st, sc) => st.SchoolId == sc.Id)
|
//var test2 = db.Queryable<Student, School>((st, sc) => st.SchoolId == sc.Id)
|
||||||
// .Where(st=>
|
// .Where(st =>
|
||||||
// SqlFunc.IF(st.Id>1)
|
// SqlFunc.IF(st.Id > 1)
|
||||||
// .Return(st.Id)
|
// .Return(st.Id)
|
||||||
// .ElseIF(st.Id==1)
|
// .ElseIF(st.Id == 1)
|
||||||
// .Return(st.SchoolId).End(st.Id)==1).ToList();
|
// .Return(st.SchoolId).End(st.Id) == 1).ToList();
|
||||||
}
|
}
|
||||||
public static void Page()
|
public static void Page()
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,48 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SqlSugar
|
||||||
|
{
|
||||||
|
///<summary>
|
||||||
|
/// ** description:Get subquery sql
|
||||||
|
/// ** author:sunkaixuan
|
||||||
|
/// ** date:2017/9/17
|
||||||
|
/// ** email:610262374@qq.com
|
||||||
|
/// </summary>
|
||||||
|
public class CaseWhenResolve
|
||||||
|
{
|
||||||
|
List<MethodCallExpression> allMethods = new List<MethodCallExpression>();
|
||||||
|
private ExpressionContext context = null;
|
||||||
|
private bool hasWhere;
|
||||||
|
public CaseWhenResolve(MethodCallExpression expression, ExpressionContext context, Expression oppsiteExpression)
|
||||||
|
{
|
||||||
|
this.context = context;
|
||||||
|
var currentExpression = expression;
|
||||||
|
allMethods.Add(currentExpression);
|
||||||
|
if (context.IsSingle && oppsiteExpression != null&& oppsiteExpression is MemberExpression)
|
||||||
|
{
|
||||||
|
var childExpression = (oppsiteExpression as MemberExpression).Expression;
|
||||||
|
this.context.SingleTableNameSubqueryShortName = (childExpression as ParameterExpression).Name;
|
||||||
|
}
|
||||||
|
else if (context.IsSingle)
|
||||||
|
{
|
||||||
|
this.context.SingleTableNameSubqueryShortName = (context.Expression as LambdaExpression).Parameters.First().Name;
|
||||||
|
}
|
||||||
|
while (currentExpression != null)
|
||||||
|
{
|
||||||
|
var addItem = currentExpression.Object as MethodCallExpression;
|
||||||
|
if (addItem != null)
|
||||||
|
allMethods.Add(addItem);
|
||||||
|
currentExpression = addItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetSql()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -23,6 +23,8 @@ namespace SqlSugar
|
|||||||
new SubCount(){ Context=Context },
|
new SubCount(){ Context=Context },
|
||||||
new SubMax(){ Context=Context },
|
new SubMax(){ Context=Context },
|
||||||
new SubMin(){ Context=Context },
|
new SubMin(){ Context=Context },
|
||||||
|
new SubSum(){ Context=Context },
|
||||||
|
new SubAvg(){ Context=Context },
|
||||||
new SubOrderBy(){ Context=Context },
|
new SubOrderBy(){ Context=Context },
|
||||||
new SubOrderByDesc(){ Context=Context }
|
new SubOrderByDesc(){ Context=Context }
|
||||||
};
|
};
|
||||||
|
@ -81,6 +81,7 @@
|
|||||||
<Compile Include="Enum\ConditionalType.cs" />
|
<Compile Include="Enum\ConditionalType.cs" />
|
||||||
<Compile Include="Enum\DbType.cs" />
|
<Compile Include="Enum\DbType.cs" />
|
||||||
<Compile Include="ExpressionsToSql\CaseWhen\CaseWhen.cs" />
|
<Compile Include="ExpressionsToSql\CaseWhen\CaseWhen.cs" />
|
||||||
|
<Compile Include="ExpressionsToSql\CaseWhen\CaseWhenResolve.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Subquery\Items\ISubOperation.cs" />
|
<Compile Include="ExpressionsToSql\Subquery\Items\ISubOperation.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubAnd.cs" />
|
<Compile Include="ExpressionsToSql\Subquery\Items\SubAnd.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubCount.cs" />
|
<Compile Include="ExpressionsToSql\Subquery\Items\SubCount.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user