审计日志接口
parent
fc9e652f38
commit
8d4f64dc1f
@ -0,0 +1,61 @@
|
||||
using DS.Module.Core;
|
||||
|
||||
namespace DS.WMS.Core.System.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// 审计日志返回实体
|
||||
/// </summary>
|
||||
public class AuditLogRes
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
/// 业务id
|
||||
/// </summary>
|
||||
public long KeyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// sql语句
|
||||
/// </summary>
|
||||
public string Sql { get; set; }
|
||||
/// <summary>
|
||||
/// 请求参数
|
||||
/// </summary>
|
||||
public string Param { get; set; }
|
||||
/// <summary>
|
||||
/// 旧值
|
||||
/// </summary>
|
||||
public string OldValue { get; set; }
|
||||
/// <summary>
|
||||
/// 新值
|
||||
/// </summary>
|
||||
public string NewValue { get; set; }
|
||||
/// <summary>
|
||||
/// 业务数据
|
||||
/// </summary>
|
||||
public string AopData { get; set; }
|
||||
/// <summary>
|
||||
/// 差异数据
|
||||
/// </summary>
|
||||
public string DiffData { get; set; }
|
||||
/// <summary>
|
||||
/// 操作方式:新增、更新、删除
|
||||
/// </summary>
|
||||
|
||||
public string OperateType { get; set; }
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Note { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
/// <summary>
|
||||
/// 租户id
|
||||
/// </summary>
|
||||
public long TenantId { get; set; }
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
using DS.Module.Core;
|
||||
using DS.WMS.Core.System.Dtos;
|
||||
using DS.WMS.Core.System.Entity;
|
||||
|
||||
namespace DS.WMS.Core.System.Interface;
|
||||
|
||||
public interface ILogAuditService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 审计日志列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<List<AuditLogRes>> GetAuditLogList(PageRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// 审计日志详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<AuditLogRes> GetAuditLogInfo(string id);
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Extensions;
|
||||
using DS.Module.Log.Entity;
|
||||
using DS.Module.UserModule;
|
||||
using DS.WMS.Core.System.Dtos;
|
||||
using DS.WMS.Core.System.Entity;
|
||||
using DS.WMS.Core.System.Interface;
|
||||
using Mapster;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.System.Method;
|
||||
|
||||
public class LogAuditService : ILogAuditService
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly ISqlSugarClient db;
|
||||
private readonly IUser user;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="serviceProvider"></param>
|
||||
public LogAuditService(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
|
||||
user = _serviceProvider.GetRequiredService<IUser>();
|
||||
}
|
||||
|
||||
public DataResult<List<AuditLogRes>> GetAuditLogList(PageRequest request)
|
||||
{
|
||||
//序列化查询条件
|
||||
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
||||
var data = db.Queryable<SysLogAudit>().Filter(null,true)
|
||||
.Where(whereList)
|
||||
.Select<AuditLogRes>().ToQueryPage(request.PageCondition);
|
||||
return data;
|
||||
}
|
||||
|
||||
public DataResult<AuditLogRes> GetAuditLogInfo(string id)
|
||||
{
|
||||
var data = db.Queryable<SysLogAudit>().Filter(null,true)
|
||||
.Where(a => a.Id == long.Parse(id))
|
||||
.Select<AuditLogRes>()
|
||||
.First();
|
||||
return DataResult<AuditLogRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue