using SqlSugar;
using Volo.Abp.Application.Dtos;
using Yi.Framework.Ddd.Application;
using Yi.Framework.Rbac.Application.Contracts.Dtos.Notice;
using Yi.Framework.Rbac.Application.Contracts.IServices;
using Yi.Framework.Rbac.Domain.Entities;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Rbac.Application.Services
{
///
/// Notice服务实现
///
public class NoticeService : YiCrudAppService,
INoticeService
{
private ISqlSugarRepository _repository;
public NoticeService(ISqlSugarRepository repository) : base(repository)
{
_repository = repository;
}
///
/// 多查
///
///
///
public override async Task> GetListAsync(NoticeGetListInput input)
{
RefAsync total = 0;
var entities = await _repository._DbQueryable.WhereIF(input.Type is not null, x => x.Type==input.Type)
.WhereIF(!string.IsNullOrEmpty(input.Title), x => x.Title!.Contains(input.Title!))
.WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
return new PagedResultDto(total, await MapToGetListOutputDtosAsync(entities));
}
}
}