//-------------------------------------------------------------------- // 此代码由T4模板自动生成 byzhouhang 20210918 // 生成时间 2022-02-15 13:11:20 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 //-------------------------------------------------------------------- using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Infra.EFCore; using Microsoft.AspNetCore.Mvc; namespace IRaCIS.Core.Application.Contracts { /// /// 系统邮件配置表 /// [ApiExplorerSettings(GroupName = "Common")] public class EmailNoticeConfigService : BaseService, IEmailNoticeConfigService { private readonly IRepository repository; public EmailNoticeConfigService(IRepository repository) { this.repository = repository; } [HttpPost] public async Task> GetEmailNoticeConfigList(EmailNoticeConfigQuery queryEmailNoticeConfig) { var emailNoticeConfigQueryable = _repository .WhereIf(queryEmailNoticeConfig.ScenarioId != null, t => t.ScenarioId == queryEmailNoticeConfig.ScenarioId) .WhereIf(queryEmailNoticeConfig.IsReturnRequired != null, t => t.IsReturnRequired == queryEmailNoticeConfig.IsReturnRequired) .WhereIf(queryEmailNoticeConfig.IsUrgent != null, t => t.IsUrgent == queryEmailNoticeConfig.IsUrgent) .WhereIf(queryEmailNoticeConfig.IsEnable != null, t => t.IsEnable == queryEmailNoticeConfig.IsEnable) .ProjectTo(_mapper.ConfigurationProvider); return await emailNoticeConfigQueryable.ToPagedListAsync(queryEmailNoticeConfig.PageIndex, queryEmailNoticeConfig.PageSize, queryEmailNoticeConfig.SortField, queryEmailNoticeConfig.Asc); } public async Task AddOrUpdateEmailNoticeConfig(EmailNoticeConfigAddOrEdit addOrEditEmailNoticeConfig) { var entity = await _repository.InsertOrUpdateAsync(addOrEditEmailNoticeConfig, true); return ResponseOutput.Ok(entity.Id.ToString()); } [HttpDelete("{emailNoticeConfigId:guid}")] public async Task DeleteEmailNoticeConfig(Guid emailNoticeConfigId) { var success = await repository.BatchDeleteNoTrackingAsync(t => t.Id == emailNoticeConfigId); return ResponseOutput.Result(success); } public async Task> GetEmailScenarioEnumSelect() { return await Task.FromResult(EnumToSelectExtension.ToSelect()); } } }