Files
Yi.Admin/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/PlateService.cs

38 lines
1.8 KiB
C#
Raw Normal View History

2023-12-11 22:14:13 +08:00
using SqlSugar;
using Volo.Abp.Application.Dtos;
2023-12-11 09:55:12 +08:00
using Volo.Abp.Domain.Repositories;
using Yi.Framework.Bbs.Application.Contracts.Dtos.Plate;
using Yi.Framework.Bbs.Application.Contracts.IServices;
2024-01-11 18:51:53 +08:00
using Yi.Framework.Bbs.Domain.Entities.Forum;
2023-12-11 09:55:12 +08:00
using Yi.Framework.Ddd.Application;
2023-12-11 22:14:13 +08:00
using Yi.Framework.Rbac.Application.Contracts.Dtos.Config;
using Yi.Framework.SqlSugarCore.Abstractions;
2023-12-11 09:55:12 +08:00
2024-01-11 18:51:53 +08:00
namespace Yi.Framework.Bbs.Application.Services.Forum
2023-12-11 09:55:12 +08:00
{
/// <summary>
/// Plate服务实现
/// </summary>
2024-05-22 14:35:08 +08:00
public class PlateService : YiCrudAppService<PlateAggregateRoot, PlateGetOutputDto, PlateGetListOutputDto, Guid, PlateGetListInputVo, PlateCreateInputVo, PlateUpdateInputVo>,
2023-12-11 09:55:12 +08:00
IPlateService
{
2024-05-22 14:35:08 +08:00
private ISqlSugarRepository<PlateAggregateRoot, Guid> _repository;
public PlateService(ISqlSugarRepository<PlateAggregateRoot, Guid> repository) : base(repository)
2023-12-11 09:55:12 +08:00
{
2024-01-11 18:51:53 +08:00
_repository = repository;
2023-12-11 22:14:13 +08:00
}
public override async Task<PagedResultDto<PlateGetListOutputDto>> GetListAsync(PlateGetListInputVo input)
{
RefAsync<int> total = 0;
var entities = await _repository._DbQueryable.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name!))
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Name.Contains(input.Code!))
.WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
2024-01-11 18:51:53 +08:00
.OrderByDescending(x => x.OrderNum)
2023-12-11 22:14:13 +08:00
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
return new PagedResultDto<PlateGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
2023-12-11 09:55:12 +08:00
}
}
}