using Mapster; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using SqlSugar; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.Abp.Users; using Yi.Framework.AiHub.Application.Contracts.Dtos; using Yi.Framework.AiHub.Domain.Entities; using Yi.Framework.AiHub.Domain.Entities.Chat; using Yi.Framework.SqlSugarCore.Abstractions; namespace Yi.Framework.AiHub.Application.Services; public class MessageService : ApplicationService { private readonly ISqlSugarRepository _repository; public MessageService(ISqlSugarRepository repository) { _repository = repository; } /// /// 查询消息 /// 需要会话id /// /// /// [Authorize] public async Task> GetListAsync([FromQuery]MessageGetListInput input) { RefAsync total = 0; var userId = CurrentUser.GetId(); var entities = await _repository._DbQueryable .Where(x => x.SessionId == input.SessionId) .Where(x=>x.UserId == userId) .OrderBy(x => x.Id) .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); return new PagedResultDto(total, entities.Adapt>()); } }