mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-16 07:57:33 +08:00
Update db.QueryableByObject
This commit is contained in:
parent
c984999d62
commit
31d98190ed
@ -65,10 +65,22 @@ namespace OrmTest
|
|||||||
|
|
||||||
|
|
||||||
var whereFunc = ObjectFuncModel.Create("Format", "o.id", ">", "{int}:1", "&&", "o.name", "=", "{string}:a");
|
var whereFunc = ObjectFuncModel.Create("Format", "o.id", ">", "{int}:1", "&&", "o.name", "=", "{string}:a");
|
||||||
|
|
||||||
|
var data661 = db.Queryable<object>().AS("[order]", "o")
|
||||||
|
.AddJoinInfo("order", "y", "o.id=y.id", SqlSugar.JoinType.Left)
|
||||||
|
.Where(whereFunc)
|
||||||
|
.GroupBy(groupList).Having(having).Select(selector).ToList();
|
||||||
var data66 = db.QueryableByObject(type, "o")
|
var data66 = db.QueryableByObject(type, "o")
|
||||||
.AddJoinInfo(typeof(Custom), "y", "o.id=y.id", SqlSugar.JoinType.Left)
|
.AddJoinInfo(typeof(Custom), "y", "o.id=y.id", SqlSugar.JoinType.Left)
|
||||||
.Where(whereFunc)
|
.Where(whereFunc)
|
||||||
.GroupBy(groupList).Having(having).Select(selector).ToList();
|
.GroupBy(groupList).Having(having).Select(selector).ToList();
|
||||||
|
|
||||||
|
var data67 = db.QueryableByObject(type, "o")
|
||||||
|
.AddJoinInfo("order", "y", ObjectFuncModel.Create("Equals", "y.id", "o.id"), SqlSugar.JoinType.Left)
|
||||||
|
.Where(whereFunc)
|
||||||
|
.GroupBy(groupList).Having(having).Select(selector).ToList();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,20 @@ namespace SqlSugar
|
|||||||
this.QueryableObj = method.Invoke(QueryableObj, new object[] { tableName,shortName,onWhere,type });
|
this.QueryableObj = method.Invoke(QueryableObj, new object[] { tableName,shortName,onWhere,type });
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
public QueryMethodInfo AddJoinInfo(string tableName, string shortName, IFuncModel onFunc, JoinType type = JoinType.Left)
|
||||||
|
{
|
||||||
|
var method = QueryableObj.GetType().GetMyMethod("AddJoinInfo", 4, typeof(string), typeof(string), typeof(string), typeof(JoinType));
|
||||||
|
this.QueryableObj = method.Invoke(QueryableObj, new object[] { tableName, shortName, onFunc, type });
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public QueryMethodInfo AddJoinInfo(List<JoinInfoParameter> joinInfoParameters)
|
||||||
|
{
|
||||||
|
foreach (var item in joinInfoParameters)
|
||||||
|
{
|
||||||
|
AddJoinInfo(item.TableName,item.ShortName,item.Models,item.Type);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
public QueryMethodInfo AddJoinInfo(Type joinEntityType, string shortName, string onWhere, JoinType type = JoinType.Left)
|
public QueryMethodInfo AddJoinInfo(Type joinEntityType, string shortName, string onWhere, JoinType type = JoinType.Left)
|
||||||
{
|
{
|
||||||
var method = QueryableObj.GetType().GetMyMethod("AddJoinInfo", 4, typeof(string), typeof(string), typeof(string), typeof(JoinType));
|
var method = QueryableObj.GetType().GetMyMethod("AddJoinInfo", 4, typeof(string), typeof(string), typeof(string), typeof(JoinType));
|
||||||
|
Loading…
Reference in New Issue
Block a user