You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.7 KiB
C#

using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.Module.Core.Log;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Sys.Dtos;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
namespace DS.WMS.Core.Sys.Method;
public class LogAuditService : ILogAuditService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
private readonly ISaasDbService saasService;
/// <summary>
///
/// </summary>
/// <param name="serviceProvider"></param>
public LogAuditService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
}
public DataResult<List<AuditLogRes>> GetAuditLogList(PageRequest request)
{
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = saasService.GetLogDb().Queryable<SysLogAudit>().Filter(null,true)
.Where(whereList)
.Select<AuditLogRes>().ToQueryPage(request.PageCondition);
return data;
}
public DataResult<AuditLogRes> GetAuditLogInfo(string id)
{
var data = saasService.GetLogDb().Queryable<SysLogAudit>().Filter(null,true)
.Where(a => a.Id == long.Parse(id))
.Select<AuditLogRes>()
.First();
return DataResult<AuditLogRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
}
}