关于树级查询和导航查询并存问题 返回

SqlSugar
2 62
public class Tree1
 {
            [SqlSugar.SugarColumn(IsPrimaryKey = true)]
            public int Id { getset; }
            public string Name { getset; }
            public int Tree2Id { getset; }
            [Navigate(NavigateType.OneToOne,nameof(Tree2Id))]//设置导航 一对一
            public List<Tree2> Tree2s { getset; }
            [SugarColumn(IsIgnore =true)]
            public List<Tree1> Child { getset; }

  }

public class Tree2
 {
            [SqlSugar.SugarColumn(IsPrimaryKey = true)]
            public int Id { getset; }
            public string Name { getset; }
            public int ParentId { getset; }
            [Navigate(NavigateType.OneToOne,nameof(ParentId))]//设置导航 一对一
            public List<Tree3> Parent { getset; }

  }

var list=db.Queryable<Tree1>().Includes(x => x.Tree2,x=>x.Tree3)
                .ToTree(x => x.Child, x => x.ParentId, 0);





我需要根据Tree2 和 Tree3 的筛选条件来过滤Tree1 的条件 


var list=db.Queryable<Tree1>().Includes(x => x.Tree2,x=>x.Tree3)

                .Where(it => it.Tree2.Any(s => s.Name.Contains("1111")))

                .ToTree(x => x.Child, x => x.ParentId, 0);

这样过滤会导致全部过滤掉

热忱回答2