66 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			C#
		
	
	
			
		
		
	
	
			66 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			C#
		
	
	
| //--------------------------------------------------------------------
 | |
| //     此代码由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
 | |
| {
 | |
|     /// <summary>
 | |
|     /// EmailNoticeConfigService
 | |
|     /// </summary>	
 | |
|     [ApiExplorerSettings(GroupName = "Common")]
 | |
|     public class EmailNoticeConfigService : BaseService, IEmailNoticeConfigService
 | |
|     {
 | |
|         private readonly IRepository<EmailNoticeConfig> repository;
 | |
| 
 | |
|         public EmailNoticeConfigService(IRepository<EmailNoticeConfig> repository)
 | |
|         {
 | |
|             this.repository = repository;
 | |
|         }
 | |
| 
 | |
|         [HttpPost]
 | |
|         public async Task<PageOutput<EmailNoticeConfigView>> GetEmailNoticeConfigList(EmailNoticeConfigQuery queryEmailNoticeConfig)
 | |
|         {
 | |
|             var emailNoticeConfigQueryable = _repository
 | |
|             .WhereIf<EmailNoticeConfig>(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<EmailNoticeConfigView>(_mapper.ConfigurationProvider);
 | |
| 
 | |
|             return await emailNoticeConfigQueryable.ToPagedListAsync(queryEmailNoticeConfig.PageIndex, queryEmailNoticeConfig.PageSize, queryEmailNoticeConfig.SortField, queryEmailNoticeConfig.Asc);
 | |
|         }
 | |
| 
 | |
| 
 | |
|         public async Task<IResponseOutput> AddOrUpdateEmailNoticeConfig(EmailNoticeConfigAddOrEdit addOrEditEmailNoticeConfig)
 | |
|         {
 | |
|    
 | |
|             var entity = await _repository.InsertOrUpdateAsync<EmailNoticeConfig, EmailNoticeConfigAddOrEdit>(addOrEditEmailNoticeConfig, true);
 | |
| 
 | |
|             return ResponseOutput.Ok(entity.Id.ToString());
 | |
| 
 | |
|         }
 | |
| 
 | |
| 
 | |
|         [HttpDelete("{emailNoticeConfigId:guid}")]
 | |
|         public async Task<IResponseOutput> DeleteEmailNoticeConfig(Guid emailNoticeConfigId)
 | |
|         {
 | |
|             var success = await repository.DeleteFromQueryAsync(t => t.Id == emailNoticeConfigId);
 | |
| 
 | |
|             return ResponseOutput.Result(success);
 | |
|         }
 | |
| 
 | |
| 
 | |
| 
 | |
|         public async Task<Dictionary<object, string>> GetEmailScenarioEnumSelect()
 | |
|         {
 | |
|             return await Task.FromResult(EnumToSelectExtension.ToSelect<EmailScenarioEnum>());
 | |
|         }
 | |
|     }
 | |
| }
 |