mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Update naviate
This commit is contained in:
parent
5b0e0166ee
commit
3ff9c37622
@ -71,20 +71,7 @@ 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();
|
||||||
}
|
}
|
||||||
@ -92,6 +79,26 @@ namespace SqlSugar
|
|||||||
_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;
|
||||||
|
Loading…
Reference in New Issue
Block a user