65 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			C#
		
	
	
			
		
		
	
	
			65 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			C#
		
	
	
| //--------------------------------------------------------------------
 | |
| //     此代码由T4模板自动生成  byzhouhang 20210918
 | |
| //	   生成时间 2022-07-01 15:37:24 
 | |
| //     对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
 | |
| //--------------------------------------------------------------------
 | |
| 
 | |
| using IRaCIS.Core.Domain.Models;
 | |
| using Microsoft.AspNetCore.Mvc;
 | |
| using IRaCIS.Core.Application.Interfaces;
 | |
| using IRaCIS.Core.Application.ViewModel;
 | |
| namespace IRaCIS.Core.Application.Service
 | |
| {	
 | |
| 	/// <summary>
 | |
| 	/// TaskConsistentRuleService
 | |
| 	/// </summary>	
 | |
| 	[ ApiExplorerSettings(GroupName = "Test")]
 | |
| 	public class TaskConsistentRuleService: BaseService, ITaskConsistentRuleService
 | |
|     {
 | |
| 
 | |
| 			 private readonly IRepository<TaskConsistentRule> _taskConsistentRuleRepository;
 | |
| 
 | |
| 		public TaskConsistentRuleService(IRepository<TaskConsistentRule> taskConsistentRuleRepository)
 | |
| 		{
 | |
|             _taskConsistentRuleRepository = taskConsistentRuleRepository;        
 | |
| 		}
 | |
| 
 | |
| 	   
 | |
| 		public async Task<List<TaskConsistentRuleView>>  GetTaskConsistentRuleList(TaskConsistentRuleQuery inQuery)
 | |
| 		{
 | |
| 
 | |
| 		
 | |
| 		     var taskConsistentRuleQueryable = _taskConsistentRuleRepository
 | |
| 			 .ProjectTo<TaskConsistentRuleView>(_mapper.ConfigurationProvider);
 | |
|              
 | |
| 			 return await taskConsistentRuleQueryable.ToListAsync();
 | |
| 		}
 | |
| 	    
 | |
| 
 | |
|         public async  Task<IResponseOutput> AddOrUpdateTaskConsistentRule(TaskConsistentRuleAddOrEdit addOrEditTaskConsistentRule)
 | |
| 		{
 | |
| 		      //  在此处拷贝automapper 映射
 | |
| 			  
 | |
| 
 | |
|                  CreateMap<TaskConsistentRule, TaskConsistentRuleView>();
 | |
| 			  //  CreateMap< TaskConsistentRule,TaskConsistentRuleAddOrEdit>().ReverseMap();
 | |
| 
 | |
| 
 | |
| 			    var entity = await _taskConsistentRuleRepository.InsertOrUpdateAsync(addOrEditTaskConsistentRule, true);
 | |
| 
 | |
|             return ResponseOutput.Ok(entity.Id.ToString());
 | |
| 		
 | |
| 		}
 | |
| 
 | |
| 
 | |
| 		[HttpDelete("{taskConsistentRuleId:guid}")]
 | |
|         public async Task<IResponseOutput> DeleteTaskConsistentRule(Guid taskConsistentRuleId)
 | |
| 		{
 | |
| 			  var success = await _taskConsistentRuleRepository.DeleteFromQueryAsync(t => t.Id == taskConsistentRuleId,true);
 | |
|               return ResponseOutput.Ok();
 | |
| 		}
 | |
| 
 | |
|        
 | |
|     }
 | |
| } 
 |