feat: 完善sql耗时Aop

This commit is contained in:
陈淳
2024-02-17 17:37:24 +08:00
parent c72a990162
commit 4673398976
2 changed files with 8 additions and 1 deletions

View File

@@ -242,6 +242,11 @@ namespace Yi.Framework.SqlSugarCore
/// <param name="pars"></param> /// <param name="pars"></param>
protected virtual void OnLogExecuted(string sql, SugarParameter[] pars) protected virtual void OnLogExecuted(string sql, SugarParameter[] pars)
{ {
if (Options.EnabledSqlLog)
{
var sqllog = $"=========Yi-SQL耗时{SqlSugarClient.Ado.SqlExecutionTime.TotalMilliseconds}毫秒=====";
Logger.CreateLogger<SqlSugarDbContext>().LogDebug(sqllog.ToString());
}
} }
/// <summary> /// <summary>

View File

@@ -1,6 +1,8 @@
using SqlSugar; using Microsoft.Extensions.Logging;
using SqlSugar;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Yi.Framework.Rbac.SqlSugarCore; using Yi.Framework.Rbac.SqlSugarCore;
using Yi.Framework.SqlSugarCore;
namespace Yi.Abp.SqlSugarCore namespace Yi.Abp.SqlSugarCore
{ {