using Azure.Core; using LY.App.Extensions.DI; using LY.App.Model; using Mapster; using SqlSugar; using System.Security.AccessControl; namespace LY.App.Service { [ServiceInjection(InjectionType.Transient)] public class LogService { private readonly SqlSugarClient _db; public LogService(SqlSugarClient sqlSugarClient) { _db = sqlSugarClient; } public async Task AddLog(AddLog input) { var entity = input.Adapt(); await _db.Insertable(entity).ExecuteReturnSnowflakeIdAsync(); } /// /// 分页查询 /// /// /// /// /// public async Task List(int pageNum, int pageSize, string key) { RefAsync total = 0; var items = await _db.Queryable() .WhereIF(!string.IsNullOrEmpty(key), s => s.Message.Contains(key)) .OrderByDescending(s => s.Id) .ToPageListAsync(pageNum, pageSize, total); return new ApiResult() { data = new { total = total.Value, items } }; } } }