68 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
		
		
			
		
	
	
			68 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| 
								 | 
							
								using APT.BaseData.Domain.Entities;
							 | 
						|||
| 
								 | 
							
								using APT.BaseData.Domain.Entities.FM;
							 | 
						|||
| 
								 | 
							
								using APT.BaseData.Domain.Enums.PF;
							 | 
						|||
| 
								 | 
							
								using APT.BaseData.Domain.IServices;
							 | 
						|||
| 
								 | 
							
								using APT.BaseData.Domain.IServices.FM;
							 | 
						|||
| 
								 | 
							
								using APT.Infrastructure.Core;
							 | 
						|||
| 
								 | 
							
								using APT.MS.Domain.Entities.CM;
							 | 
						|||
| 
								 | 
							
								using APT.MS.Domain.Enums;
							 | 
						|||
| 
								 | 
							
								using APT.Utility;
							 | 
						|||
| 
								 | 
							
								using Microsoft.AspNetCore.Mvc;
							 | 
						|||
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using System.Collections.Generic;
							 | 
						|||
| 
								 | 
							
								using System.Linq;
							 | 
						|||
| 
								 | 
							
								using System.Linq.Expressions;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace APT.SC.WebApi.Controllers.Api.CM
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    [Route("api/CM/CMConfig")]
							 | 
						|||
| 
								 | 
							
								    public class CMConfigController : AuthorizeApiController<T_CM_CONFIG>
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 排序分页查询数据
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="pageFilter">分页过滤实体</param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        [HttpPost, Route("OrderPaged")]
							 | 
						|||
| 
								 | 
							
								        public PagedActionResult<T_CM_CONFIG> OrderPaged([FromBody] KeywordPageFilter pageFilter)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            return SafeGetPagedData(delegate (PagedActionResult<T_CM_CONFIG> result)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Expression<Func<T_CM_CONFIG, bool>> expression = e => !e.IS_DELETED;
							 | 
						|||
| 
								 | 
							
								                if (pageFilter.FilterGroup.Rules != null && pageFilter.FilterGroup.Rules.Count > 0)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    int Month = 0;
							 | 
						|||
| 
								 | 
							
								                    int Day = 0;
							 | 
						|||
| 
								 | 
							
								                    foreach (var item in pageFilter.FilterGroup.Rules)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        try
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            Month = int.Parse(item.Value.ToString().Split('-')[0]);
							 | 
						|||
| 
								 | 
							
								                            Day = int.Parse(item.Value.ToString().Split('-')[1]);
							 | 
						|||
| 
								 | 
							
								                            switch (item.Field)
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                case "DRILL_PLAN_TRIGGER_TIME"://年度应急演练计划触发时间
							 | 
						|||
| 
								 | 
							
								                                    expression = expression.And(e => e.DRILL_PLAN_TRIGGER_TIME.HasValue && e.DRILL_PLAN_TRIGGER_TIME.Value.Month == Month && e.DRILL_PLAN_TRIGGER_TIME.Value.Day == Day);
							 | 
						|||
| 
								 | 
							
								                                    break;
							 | 
						|||
| 
								 | 
							
								                                case "URGENT_EVENT_TRIGGER_TIME"://潜在紧急事件清单触发日期
							 | 
						|||
| 
								 | 
							
								                                    expression = expression.And(e => e.URGENT_EVENT_TRIGGER_TIME.HasValue && e.URGENT_EVENT_TRIGGER_TIME.Value.Month == Month && e.URGENT_EVENT_TRIGGER_TIME.Value.Day == Day);
							 | 
						|||
| 
								 | 
							
								                                    break;
							 | 
						|||
| 
								 | 
							
								                                case "DEMAND_SURVEY_END_TIME"://应急装备需求调查结束日期
							 | 
						|||
| 
								 | 
							
								                                    expression = expression.And(e => e.DEMAND_SURVEY_END_TIME.HasValue && e.DEMAND_SURVEY_END_TIME.Value.Month == Month && e.DEMAND_SURVEY_END_TIME.Value.Day == Day);
							 | 
						|||
| 
								 | 
							
								                                    break;
							 | 
						|||
| 
								 | 
							
								                                default:
							 | 
						|||
| 
								 | 
							
								                                    break;
							 | 
						|||
| 
								 | 
							
								                            }
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        catch { }
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    pageFilter.FilterGroup.Rules.Clear();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                PagedActionResult<T_CM_CONFIG> orderPageEntities = GetOrderPageEntities<T_CM_CONFIG>(expression, pageFilter, null);
							 | 
						|||
| 
								 | 
							
								                result.Data = orderPageEntities.Data;
							 | 
						|||
| 
								 | 
							
								                result.TotalCount = orderPageEntities.TotalCount;
							 | 
						|||
| 
								 | 
							
								            });
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |