feat: 完善aop插入审计日志
This commit is contained in:
@@ -13,7 +13,7 @@ using Yi.Framework.Infrastructure.Data.Entities;
|
||||
|
||||
namespace Yi.Framework.Infrastructure.Sqlsugar
|
||||
{
|
||||
public class SqlSugarDbContext
|
||||
public class SqlSugarDbContext
|
||||
{
|
||||
/// <summary>
|
||||
/// SqlSugar 客户端
|
||||
@@ -109,7 +109,11 @@ namespace Yi.Framework.Infrastructure.Sqlsugar
|
||||
|
||||
if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.LastModificationTime)))
|
||||
{
|
||||
entityInfo.SetValue(DateTime.Now);
|
||||
//为空或者为默认最小值
|
||||
if (oldValue is null || DateTime.MinValue.Equals((DateTime)oldValue))
|
||||
{
|
||||
entityInfo.SetValue(DateTime.Now);
|
||||
}
|
||||
}
|
||||
if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.LastModifierId)))
|
||||
{
|
||||
@@ -122,7 +126,11 @@ namespace Yi.Framework.Infrastructure.Sqlsugar
|
||||
case DataFilterType.InsertByObject:
|
||||
if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.CreationTime)))
|
||||
{
|
||||
entityInfo.SetValue(DateTime.Now);
|
||||
//为空或者为默认最小值
|
||||
if (oldValue is null || DateTime.MinValue.Equals((DateTime)oldValue))
|
||||
{
|
||||
entityInfo.SetValue(DateTime.Now);
|
||||
}
|
||||
}
|
||||
if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.CreatorId)))
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ public class Startup : AppStartup
|
||||
services.AddSchedule(options =>
|
||||
{
|
||||
// 注册作业,并配置作业触发器
|
||||
options.AddJob<TestJob>(Triggers.Period(10000));
|
||||
//options.AddJob<TestJob>(Triggers.Period(10000));
|
||||
options.AddJob<SystemDataJob>(Triggers.Cron("0 0 0,12 ? * ?",CronStringFormat.WithSeconds)); // 表示每天凌晨与12点
|
||||
});
|
||||
services.AddFileLogging("log/application-{0:yyyy}-{0:MM}-{0:dd}.log", options =>
|
||||
|
||||
Reference in New Issue
Block a user