mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-04 12:47:57 +08:00
Update Core
This commit is contained in:
parent
61f5f36958
commit
b6041cbe87
@ -71,27 +71,66 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
var currentList = _preList.Where(it => it != null).ToList();
|
var currentList = _preList.Where(it => it != null).ToList();
|
||||||
if (RootList == null || currentList.Count == 0) return;
|
if (RootList == null || currentList.Count == 0) return;
|
||||||
var memberExpression = ((_preExpressionList.Last() as LambdaExpression).Body as MemberExpression);
|
List<object> list = ExecuteByLay(currentList);
|
||||||
var navObjectName = memberExpression.Member.Name;
|
|
||||||
var navType = currentList[0].GetType().GetProperty(navObjectName).PropertyType.Name;
|
|
||||||
var isList = navType.StartsWith("List`");
|
|
||||||
List<object> list = new List<object>();
|
|
||||||
if (isList)
|
|
||||||
{
|
|
||||||
list = currentList.SelectMany(it => (it.GetType().GetProperty(navObjectName).GetValue(it) as IList).Cast<object>()).ToList();
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
list = currentList.Select(it => (it.GetType().GetProperty(navObjectName).GetValue(it))).ToList();
|
|
||||||
}
|
|
||||||
ExecuteByLay(item, list, SelectR3);
|
ExecuteByLay(item, list, SelectR3);
|
||||||
_preList = list.ToList();
|
_preList = list.ToList();
|
||||||
}
|
}
|
||||||
|
else if (i == 4)
|
||||||
|
{
|
||||||
|
var currentList = _preList.Where(it => it != null).ToList();
|
||||||
|
if (RootList == null || currentList.Count == 0) return;
|
||||||
|
List<object> list = ExecuteByLay(currentList);
|
||||||
|
ExecuteByLay(item, list, SelectR4);
|
||||||
|
_preList = list.ToList();
|
||||||
|
}
|
||||||
|
else if (i == 5)
|
||||||
|
{
|
||||||
|
var currentList = _preList.Where(it => it != null).ToList();
|
||||||
|
if (RootList == null || currentList.Count == 0) return;
|
||||||
|
List<object> list = ExecuteByLay(currentList);
|
||||||
|
ExecuteByLay(item, list, SelectR5);
|
||||||
|
_preList = list.ToList();
|
||||||
|
}
|
||||||
|
else if (i == 6)
|
||||||
|
{
|
||||||
|
var currentList = _preList.Where(it => it != null).ToList();
|
||||||
|
if (RootList == null || currentList.Count == 0) return;
|
||||||
|
List<object> list = ExecuteByLay(currentList);
|
||||||
|
ExecuteByLay(item, list, SelectR6);
|
||||||
|
_preList = list.ToList();
|
||||||
|
}
|
||||||
|
else if (i == 7)
|
||||||
|
{
|
||||||
|
var currentList = _preList.Where(it => it != null).ToList();
|
||||||
|
if (RootList == null || currentList.Count == 0) return;
|
||||||
|
List<object> list = ExecuteByLay(currentList);
|
||||||
|
ExecuteByLay(item, list, SelectR7);
|
||||||
|
_preList = list.ToList();
|
||||||
|
}
|
||||||
_preExpressionList.Add(item);
|
_preExpressionList.Add(item);
|
||||||
_ListCallFunc = new List<Expression>();
|
_ListCallFunc = new List<Expression>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<object> ExecuteByLay(List<object> currentList)
|
||||||
|
{
|
||||||
|
var memberExpression = ((_preExpressionList.Last() as LambdaExpression).Body as MemberExpression);
|
||||||
|
var navObjectName = memberExpression.Member.Name;
|
||||||
|
var navType = currentList[0].GetType().GetProperty(navObjectName).PropertyType.Name;
|
||||||
|
var isList = navType.StartsWith("List`");
|
||||||
|
List<object> list = new List<object>();
|
||||||
|
if (isList)
|
||||||
|
{
|
||||||
|
list = currentList.SelectMany(it => (it.GetType().GetProperty(navObjectName).GetValue(it) as IList).Cast<object>()).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
list = currentList.Select(it => (it.GetType().GetProperty(navObjectName).GetValue(it))).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
private void ExecuteByLay(Expression expression, List<object> list, Func<ISugarQueryable<object>, List<object>> selector)
|
private void ExecuteByLay(Expression expression, List<object> list, Func<ISugarQueryable<object>, List<object>> selector)
|
||||||
{
|
{
|
||||||
if (list == null || list.Count == 0) return;
|
if (list == null || list.Count == 0) return;
|
||||||
|
@ -228,6 +228,18 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
public Subqueryable<T1, T2, T3,T4> WhereIF(bool isWhere, Func<T1, T2, T3,T4, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public TResult Select<TResult>(Func<T1, T2, T3,T4, TResult> expression) where TResult : struct
|
||||||
|
{
|
||||||
|
return default(TResult);
|
||||||
|
}
|
||||||
|
public string Select(Func<T1, T2, T3,T4, string> expression)
|
||||||
|
{
|
||||||
|
return default(string);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public class Subqueryable<T1, T2, T3> : Subqueryable<T1> where T1 : class, new()
|
public class Subqueryable<T1, T2, T3> : Subqueryable<T1> where T1 : class, new()
|
||||||
{
|
{
|
||||||
@ -251,6 +263,18 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
public Subqueryable<T1, T2,T3> WhereIF(bool isWhere, Func<T1, T2,T3, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public TResult Select<TResult>(Func<T1, T2,T3, TResult> expression) where TResult : struct
|
||||||
|
{
|
||||||
|
return default(TResult);
|
||||||
|
}
|
||||||
|
public string Select(Func<T1, T2,T3, string> expression)
|
||||||
|
{
|
||||||
|
return default(string);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public class Subqueryable<T1, T2> : Subqueryable<T1> where T1 : class, new()
|
public class Subqueryable<T1, T2> : Subqueryable<T1> where T1 : class, new()
|
||||||
{
|
{
|
||||||
@ -270,5 +294,17 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
public Subqueryable<T1,T2> WhereIF(bool isWhere, Func<T1, T2, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public TResult Select<TResult>(Func<T1,T2, TResult> expression) where TResult : struct
|
||||||
|
{
|
||||||
|
return default(TResult);
|
||||||
|
}
|
||||||
|
public string Select(Func<T1, T2, string> expression)
|
||||||
|
{
|
||||||
|
return default(string);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user