From c9f79f5fdcd3c2d81bfb62c1651d336b87291a0b Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Mon, 14 Aug 2023 16:11:50 +0800 Subject: [PATCH] Add unit test --- .../SqlSeverTest/UnitTest/UOneManyMany5.cs | 10 ++++++++- .../SqlSeverTest/UnitTest/UnitManyToMany.cs | 21 +++++++++++++------ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Src/Asp.NetCore2/SqlSeverTest/UnitTest/UOneManyMany5.cs b/Src/Asp.NetCore2/SqlSeverTest/UnitTest/UOneManyMany5.cs index 980149e3c..6d333fcef 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/UnitTest/UOneManyMany5.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/UnitTest/UOneManyMany5.cs @@ -68,7 +68,15 @@ namespace OrmTest .Include(x=>x.books) .Include(x=>x.school_001) .ExecuteCommand(); - + + db.QueryFilter.AddTableFilter(x => x.StudentId == Guid.NewGuid()); + db.Queryable() + + .ToList(it => new { + list = it.books.Count(), + list2 = it.books.Count(), + }); + } [SugarTable("Student_005")] diff --git a/Src/Asp.NetCore2/SqlSeverTest/UnitTest/UnitManyToMany.cs b/Src/Asp.NetCore2/SqlSeverTest/UnitTest/UnitManyToMany.cs index 7a7730b21..0f7169a6e 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/UnitTest/UnitManyToMany.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/UnitTest/UnitManyToMany.cs @@ -112,14 +112,23 @@ namespace OrmTest .LeftJoin((x, y) => x.id == y.id) .Where(x => x.Roles.Any(s => tags.Contains(s.id))) .ToList(); + + db.QueryFilter.AddTableFilter(x => x.roleId == 2); + db.Queryable() + + .ToList(it=>new { + list=it.Roles.Count(), + list2 = it.Roles.Count(), + }); + } - /// - /// 描述: - /// 作者:synjones - /// 时间:2022-04-20 21:30:28 - /// - [SugarTable("unit_operatorinfo")] + /// + /// 描述: + /// 作者:synjones + /// 时间:2022-04-20 21:30:28 + /// + [SugarTable("unit_operatorinfo")] public partial class OperatorInfo { /// /// 多角色