using Cike.AutoWebApi.Setting; using Yi.Framework.Ddd.Services; using Microsoft.AspNetCore.Mvc; using Yi.Framework.Ddd.Dtos; using Yi.Framework.DictionaryManager.Entities; using Yi.Framework.DictionaryManager.Dtos.Dictionary; using Yi.Framework.Core.Attributes; namespace Yi.Framework.DictionaryManager { /// /// Dictionary服务实现 /// [AppService] public class DictionaryService : CrudAppService, IDictionaryService, IAutoApiService { /// /// 查询 /// public override async Task> GetListAsync(DictionaryGetListInputVo input) { int total = 0; var entities = await _DbQueryable.WhereIF(input.DictType is not null, x => x.DictType == input.DictType) .WhereIF(input.DictLabel is not null, x => x.DictLabel!.Contains(input.DictLabel!)) .WhereIF(input.State is not null, x => x.State == input.State) .ToPageListAsync(input.PageNum, input.PageSize, total); return new PagedResultDto { Total = total, Items = await MapToGetListOutputDtosAsync(entities) }; } /// /// 根据字典类型获取字典列表 /// /// /// [Route("/api/dictionary/dic-type/{dicType}")] public async Task> GetDicType([FromRoute] string dicType) { var entities = await _repository.GetListAsync(u => u.DictType == dicType && u.State == true); var result = await MapToGetListOutputDtosAsync(entities); return result; } } }