From 84d867df16c9a89f6302dbbcf2e921455a36dc7e Mon Sep 17 00:00:00 2001 From: xiaobo <635990945@qq.com> Date: Wed, 21 Nov 2018 16:51:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?#=E5=A2=9E=E5=8A=A0SQL=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E5=89=8D=E5=90=8E=E4=BA=8B=E4=BB=B6#?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- APIJSON.NET/APIJSON.NET/Data/DbContext.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/APIJSON.NET/APIJSON.NET/Data/DbContext.cs b/APIJSON.NET/APIJSON.NET/Data/DbContext.cs index b85cc1b..07eb061 100644 --- a/APIJSON.NET/APIJSON.NET/Data/DbContext.cs +++ b/APIJSON.NET/APIJSON.NET/Data/DbContext.cs @@ -18,6 +18,14 @@ public DbContext(IConfiguration options) IsAutoCloseConnection = true, InitKeyType= InitKeyType.Attribute }); + Db.Aop.OnLogExecuted = (sql, pars) => //SQL执行完事件 + { + + }; + Db.Aop.OnLogExecuting = (sql, pars) => //SQL执行前事件 + { + + }; } public SqlSugarClient Db; public DbSet LoginDb { get { return new DbSet(Db); } } From 0a05a5beb94a832b1a64ea3d3e1a193469f3d3a4 Mon Sep 17 00:00:00 2001 From: xiaobo <635990945@qq.com> Date: Thu, 22 Nov 2018 13:03:11 +0800 Subject: [PATCH 2/2] =?UTF-8?q?#=E5=88=A0=E9=99=A4=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D#?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- APIJSON.NET/APIJSON.NET/APIJSON.NET.csproj | 4 ++-- APIJSON.NET/APIJSON.NET/Controllers/JsonController.cs | 2 +- APIJSON.NET/APIJSON.NET/appsettings.json | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/APIJSON.NET/APIJSON.NET/APIJSON.NET.csproj b/APIJSON.NET/APIJSON.NET/APIJSON.NET.csproj index 4958ed8..42c509c 100644 --- a/APIJSON.NET/APIJSON.NET/APIJSON.NET.csproj +++ b/APIJSON.NET/APIJSON.NET/APIJSON.NET.csproj @@ -22,11 +22,11 @@ - + - + diff --git a/APIJSON.NET/APIJSON.NET/Controllers/JsonController.cs b/APIJSON.NET/APIJSON.NET/Controllers/JsonController.cs index a87f13a..305078d 100644 --- a/APIJSON.NET/APIJSON.NET/Controllers/JsonController.cs +++ b/APIJSON.NET/APIJSON.NET/Controllers/JsonController.cs @@ -292,7 +292,7 @@ public ActionResult Remove([FromBody]string json) string key = item.Key.Trim(); var value = JObject.Parse(item.Value.ToString()); var sb = new System.Text.StringBuilder(100); - sb.Append($"delete FROM {key} where"); + sb.Append($"delete FROM {key} where "); if (role.Delete==null||role.Delete.Table==null) { ht["code"] = "500"; diff --git a/APIJSON.NET/APIJSON.NET/appsettings.json b/APIJSON.NET/APIJSON.NET/appsettings.json index ee1c0d2..57a7a3f 100644 --- a/APIJSON.NET/APIJSON.NET/appsettings.json +++ b/APIJSON.NET/APIJSON.NET/appsettings.json @@ -1,8 +1,8 @@ { "ConnectionStrings": { - "DbType": 0, //0:MySql,1:SqlServer,2:Sqlite - //"ConnectionString": "Server=liaozengbo\\sql2018; Database=test; User Id=sa;Password=sa123;", - "ConnectionString": "Server=119.29.9.25;Port=3306;Database=test;Uid=root;Pwd=1q,2w.3e?;CharSet=UTF8;" + "DbType": 1, //0:MySql,1:SqlServer,2:Sqlite + "ConnectionString": "Server=liaozengbo\\sql2018; Database=Sample; User Id=sa;Password=sa123;" + //"ConnectionString": "Server=119.29.9.25;Port=3306;Database=test;Uid=root;Pwd=1q,2w.3e?;CharSet=UTF8;" }, "Authentication": { "JwtBearer": {