mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-07 18:04:55 +08:00
exp to sql
This commit is contained in:
@@ -259,8 +259,8 @@ namespace OrmTest
|
|||||||
var list2 = db.Queryable<Order>().Where(it =>
|
var list2 = db.Queryable<Order>().Where(it =>
|
||||||
SqlFunc.Subqueryable<OrderItem>()
|
SqlFunc.Subqueryable<OrderItem>()
|
||||||
.LeftJoin<OrderItem>((i,y)=>i.ItemId==y.ItemId)
|
.LeftJoin<OrderItem>((i,y)=>i.ItemId==y.ItemId)
|
||||||
.InnerJoin<OrderItem>((i,z) => i.ItemId == z.ItemId)
|
.InnerJoin<OrderItem>((i,y,z) => i.ItemId == z.ItemId)
|
||||||
.Where(i=>i.ItemId==1)
|
.Where((i ,y)=>i.ItemId==1)
|
||||||
.Any()
|
.Any()
|
||||||
).ToList();
|
).ToList();
|
||||||
;
|
;
|
||||||
@@ -276,6 +276,14 @@ namespace OrmTest
|
|||||||
customName = SqlFunc.Subqueryable<Custom>().Where(exp).Where(exp).GroupBy(s => s.Name).Having(s => SqlFunc.AggregateCount(s.Id) > 0).Select(s => s.Name)
|
customName = SqlFunc.Subqueryable<Custom>().Where(exp).Where(exp).GroupBy(s => s.Name).Having(s => SqlFunc.AggregateCount(s.Id) > 0).Select(s => s.Name)
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
var list5 = db.Queryable<Order>().Where(it =>
|
||||||
|
SqlFunc.Subqueryable<OrderItem>()
|
||||||
|
.LeftJoin<OrderItem>((i, y) => i.ItemId == y.ItemId)
|
||||||
|
.InnerJoin<OrderItem>((i, z) => i.ItemId == z.ItemId)
|
||||||
|
.Where(i => i.ItemId == 1)
|
||||||
|
.Any()
|
||||||
|
).ToList();
|
||||||
Console.WriteLine("#### Subquery End ####");
|
Console.WriteLine("#### Subquery End ####");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,21 +6,20 @@ using System.Text;
|
|||||||
|
|
||||||
namespace SqlSugar
|
namespace SqlSugar
|
||||||
{
|
{
|
||||||
|
public partial class Subqueryable<T> where T : class, new()
|
||||||
public class Subqueryable<T> where T : class, new()
|
|
||||||
{
|
{
|
||||||
|
|
||||||
public Subqueryable<T> AS(string tableName)
|
public Subqueryable<T> AS(string tableName)
|
||||||
{
|
{
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public Subqueryable<T> InnerJoin<JoinType>(Func<T, JoinType, bool> expression)
|
public Subqueryable<T, JoinType> InnerJoin<JoinType>(Func<T, JoinType, bool> expression)
|
||||||
{
|
{
|
||||||
return this;
|
return new Subqueryable<T, JoinType>();
|
||||||
}
|
}
|
||||||
public Subqueryable<T> LeftJoin<JoinType>(Func<T, JoinType, bool> expression)
|
public Subqueryable<T, JoinType> LeftJoin<JoinType>(Func<T, JoinType, bool> expression)
|
||||||
{
|
{
|
||||||
return this;
|
return new Subqueryable<T, JoinType>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Subqueryable<T> Where(string where)
|
public Subqueryable<T> Where(string where)
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SqlSugar
|
||||||
|
{
|
||||||
|
public class Subqueryable<T, T2, T3, T4, T5> : Subqueryable<T> where T : class, new()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public class Subqueryable<T, T2, T3, T4> : Subqueryable<T> where T : class, new()
|
||||||
|
{
|
||||||
|
public Subqueryable<T, T2, T3, JoinType> InnerJoin<JoinType>(Func<T, T2, T3, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T, T2, T3, JoinType>();
|
||||||
|
}
|
||||||
|
public Subqueryable<T, T2, T3, JoinType> LeftJoin<JoinType>(Func<T, T2, T3, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T, T2, T3, JoinType>();
|
||||||
|
}
|
||||||
|
public Subqueryable<T, T2, T3, T4, JoinType> Where(Func<T, T2, T3, T4, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T, T2, T3, T4, JoinType>();
|
||||||
|
}
|
||||||
|
public Subqueryable<T, T2, T3, T4, JoinType> Where(Func<T, T2, T3, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T, T2, T3, T4, JoinType>();
|
||||||
|
}
|
||||||
|
public Subqueryable<T, T2, T3, T4, JoinType> Where(Func<T, T2, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T, T2, T3, T4, JoinType>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class Subqueryable<T, T2, T3> : Subqueryable<T> where T : class, new()
|
||||||
|
{
|
||||||
|
public Subqueryable<T, T2, T3, JoinType> InnerJoin<JoinType>(Func<T, T2, T3, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T, T2, T3, JoinType>();
|
||||||
|
}
|
||||||
|
public Subqueryable<T, T2, T3, JoinType> LeftJoin<JoinType>(Func<T, T2, T3, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T, T2, T3, JoinType>();
|
||||||
|
}
|
||||||
|
public Subqueryable<T, T2, T3, JoinType> Where(Func<T, T2, T3, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T, T2, T3, JoinType>();
|
||||||
|
}
|
||||||
|
public Subqueryable<T, T2, T3, JoinType> Where(Func<T, T2, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T, T2, T3, JoinType>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class Subqueryable<T, T2> : Subqueryable<T> where T : class, new()
|
||||||
|
{
|
||||||
|
public Subqueryable<T, T2, JoinType> InnerJoin<JoinType>(Func<T, T2, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T, T2, JoinType>();
|
||||||
|
}
|
||||||
|
public Subqueryable<T, T2, JoinType> LeftJoin<JoinType>(Func<T, T2, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T, T2, JoinType>();
|
||||||
|
}
|
||||||
|
public Subqueryable<T, T2, JoinType> Where(Func<T, T2, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T, T2, JoinType>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user