From afd9e0ffc12bdf2dddc216a1346a5245fe3df1c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=9C=E7=B3=96=E7=BD=91?= <610262374@qq.com> Date: Sun, 10 Oct 2021 23:24:14 +0800 Subject: [PATCH] Update README.md --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index d7e2650e4..5dd635468 100644 --- a/README.md +++ b/README.md @@ -136,3 +136,19 @@ public static SqlSugarScope Db = new SqlSugarScope(new ConnectionConfig() tran.CommitTran();//这个提交不能漏掉 } ``` +### Query Filter +```cs +//set Filter +db.QueryFilter.Add(new TableFilterItem(it => it.Name.Contains("a"))); //为Order表置全局条件 + + +db.Queryable().ToList(); +//SELECT [Id],[Name],[Price],[CreateTime],[CustomId] FROM [Order] WHERE ([Name] like '%'+@MethodConst0+'%') + +db.Queryable((i, o) => i.OrderId == o.Id) + .Where(i => i.OrderId != 0) + .Select("i.*").ToList(); +//SELECT i.* FROM [OrderDetail] i ,[Order] o WHERE ( [i].[OrderId] = [o].[Id] ) AND +//( [i].[OrderId] <> @OrderId0 ) AND ([o].[Name] like '%'+@MethodConst1+'%') + +```