sozsoft-platform/api/src/Sozsoft.Platform.Application/AiBots/AiBotAppService.cs

49 lines
1.4 KiB
C#
Raw Normal View History

2026-02-24 20:44:16 +00:00
using System;
using Sozsoft.Platform.Entities;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
2026-06-23 17:30:19 +00:00
using System.Threading.Tasks;
using System.Linq;
2026-02-24 20:44:16 +00:00
namespace Sozsoft.Platform.AiBots;
[Authorize]
public class AiBotAppService : CrudAppService<
AiBot,
AiBotDto,
Guid,
PagedAndSortedResultRequestDto>
{
public AiBotAppService(IRepository<AiBot, Guid> repo) : base(repo)
{
}
2026-06-23 17:30:19 +00:00
public override async Task<PagedResultDto<AiBotDto>> GetListAsync(PagedAndSortedResultRequestDto input)
{
await CheckGetListPolicyAsync();
var query = await CreateFilteredQueryAsync(input);
if (CurrentTenant.IsAvailable && !string.IsNullOrWhiteSpace(CurrentTenant.Name))
{
var tenantName = CurrentTenant.Name;
query = query.Where(aiBot =>
string.IsNullOrWhiteSpace(aiBot.Tenants) ||
aiBot.Tenants.Contains($"\"{tenantName}\""));
}
var totalCount = await AsyncExecuter.CountAsync(query);
query = ApplySorting(query, input);
query = ApplyPaging(query, input);
var entities = await AsyncExecuter.ToListAsync(query);
var dtos = await MapToGetListOutputDtosAsync(entities);
return new PagedResultDto<AiBotDto>(totalCount, dtos);
}
2026-02-24 20:44:16 +00:00
}