This commit is contained in:
2024-04-11 17:31:32 +08:00
parent f6eaa2f481
commit 4fbc6c0267
200 changed files with 1252 additions and 1860 deletions

View File

@@ -1,6 +1,8 @@
using JNPF.Common.Configuration;
using System.Text.RegularExpressions;
using JNPF.Common.Configuration;
using JNPF.DependencyInjection;
using JNPF.EventBus;
using JNPF.VisualDev.Entitys;
using SqlSugar;
namespace JNPF.EventHandler;
@@ -42,7 +44,18 @@ public class LogEventSubscriber : IEventSubscriber, ISingleton
_sqlSugarClient.ChangeDatabase(log.ConnectionConfig.ConfigId);
}
await _sqlSugarClient.CopyNew().Insertable(log.Entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandAsync();
string pattern = @"^[0-9]*$";
var db = _sqlSugarClient.CopyNew();
if (!string.IsNullOrEmpty(log.Entity.ModuleId) && new Regex(pattern).IsMatch(log.Entity.ModuleId))
{
var module = await db.Queryable<VisualDevEntity>().Where(x => x.Id == log.Entity.ModuleId).FirstAsync();
if (module != null)
{
log.Entity.ModuleName = module.FullName;
}
}
await db.Insertable(log.Entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandAsync();
}
/// <summary>