mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-03 20:27:56 +08:00
Navigate query support skip take
This commit is contained in:
parent
658e15ec45
commit
e9ce346e63
@ -108,6 +108,10 @@ namespace OrmTest
|
||||
|
||||
var list3_1 = db.Queryable<StudentA>()
|
||||
.Includes(x => x.Books.MappingField(z=>z.Names,()=>x.Name).ToList())
|
||||
.ToList();
|
||||
|
||||
var list3_11 = db.Queryable<StudentA>()
|
||||
.Includes(x => x.Books.Skip(1).Take(2).ToList())
|
||||
.ToList();
|
||||
|
||||
//先用Mapper导航映射查出第二层
|
||||
|
@ -336,21 +336,31 @@ namespace SqlSugar
|
||||
}).GroupBy(it => it.l).ToList();
|
||||
foreach (var item in groupQuery)
|
||||
{
|
||||
|
||||
var itemSelectList=item.Select(it => it.n);
|
||||
if (sqlObj.Skip != null)
|
||||
{
|
||||
itemSelectList = itemSelectList
|
||||
.Skip(sqlObj.Skip.Value);
|
||||
}
|
||||
if (sqlObj.Take != null)
|
||||
{
|
||||
itemSelectList = itemSelectList
|
||||
.Take(sqlObj.Take.Value);
|
||||
}
|
||||
if (sqlObj.MappingExpressions.HasValue())
|
||||
{
|
||||
MappingFieldsHelper<T> helper = new MappingFieldsHelper<T>();
|
||||
helper.NavEntity = navEntityInfo;
|
||||
helper.Context = this.Context;
|
||||
helper.RootEntity = this.Context.EntityMaintenance.GetEntityInfo<T>();
|
||||
helper.SetChildList(navObjectNameColumnInfo, item.Key, item.Select(it => it.n).ToList(), sqlObj.MappingExpressions);
|
||||
helper.SetChildList(navObjectNameColumnInfo, item.Key, itemSelectList.ToList(), sqlObj.MappingExpressions);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var instance = Activator.CreateInstance(navObjectNamePropety.PropertyType, true);
|
||||
var ilist = instance as IList;
|
||||
foreach (var value in item.Select(it => it.n).ToList())
|
||||
foreach (var value in itemSelectList.ToList())
|
||||
{
|
||||
ilist.Add(value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user