//-------------------------------------------------------------------- // 此代码由T4模板自动生成 byzhouhang 20210918 // 生成时间 2022-03-28 16:46:23 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 //-------------------------------------------------------------------- using IRaCIS.Core.Domain.Models; using Microsoft.AspNetCore.Mvc; using IRaCIS.Core.Application.Interfaces; using IRaCIS.Core.Application.ViewModel; using Castle.Core.Internal; namespace IRaCIS.Core.Application.Service { /// /// FrontAuditConfigService /// [ApiExplorerSettings(GroupName = "Reviewer")] public class FrontAuditConfigService : BaseService, IFrontAuditConfigService { private readonly IRepository _frontAuditConfigRepository; public FrontAuditConfigService(IRepository frontAuditConfigRepository) { _frontAuditConfigRepository = frontAuditConfigRepository; } public async Task> GetFrontAuditConfigList(FrontAuditConfigQuery iq) { var query = _repository.GetQueryable() .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.Value == iq.Value) .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.ValueCN == iq.ValueCN) .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.Description == iq.Description) .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.OptTypeId == iq.OptTypeId) .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.Code == iq.Code) .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.ChildrenTypeId == iq.ChildrenTypeId); var frontAuditConfigQueryable = query .ProjectTo(_mapper.ConfigurationProvider); return await frontAuditConfigQueryable.ToListAsync(); } public async Task AddOrUpdateFrontAuditConfig(FrontAuditConfigAddOrEdit addOrEditFrontAuditConfig) { // 在此处拷贝automapper 映射 //CreateMap(); // CreateMap< FrontAuditConfig,FrontAuditConfigAddOrEdit>().ReverseMap(); var entity = await _repository.InsertOrUpdateAsync(addOrEditFrontAuditConfig, true); return ResponseOutput.Ok(entity.Id.ToString()); } [HttpDelete("{frontAuditConfigId:guid}")] public async Task DeleteFrontAuditConfig(Guid frontAuditConfigId) { var success = await _repository.DeleteFromQueryAsync(t => t.Id == frontAuditConfigId); return ResponseOutput.Result(success); } } }