//-------------------------------------------------------------------- // 此代码由liquid模板自动生成 byzhouhang 20240909 // 生成时间 2024-09-20 01:22:34Z // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 //-------------------------------------------------------------------- using IRaCIS.Core.Domain.Models; using Microsoft.AspNetCore.Mvc; using IRaCIS.Core.Application.Interfaces; using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Infrastructure.Extention; using System.Threading.Tasks; using IRaCIS.Core.Infra.EFCore; namespace IRaCIS.Core.Application.Service; [ ApiExplorerSettings(GroupName = "Test")] public class DictionaryService(IRepository _dictionaryRepository): BaseService, IDictionaryService { [HttpPost] public async Task> GetDictionaryList(DictionaryQuery inQuery) { var dictionaryQueryable =_dictionaryRepository .ProjectTo(_mapper.ConfigurationProvider); var pageList= await dictionaryQueryable.ToPagedListAsync(inQuery); return pageList; } public async Task AddOrUpdateDictionary(DictionaryAddOrEdit addOrEditDictionary) { // 在此处拷贝automapper 映射 CreateMap(); CreateMap().ReverseMap(); var entity = await _dictionaryRepository.InsertOrUpdateAsync(addOrEditDictionary, true); return ResponseOutput.Ok(entity.Id.ToString()); } [HttpDelete("{dictionaryId:guid}")] public async Task DeleteDictionary(Guid dictionaryId) { var success = await _<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository.DeleteFromQueryAsync(t => t.Id == dictionaryId,true); return ResponseOutput.Ok(); } }