using APT.BaseData.Domain.Entities;
using APT.BaseData.Domain.Entities.FM;
using APT.BaseData.Domain.Enums;
using APT.BaseData.Domain.IServices;
using APT.BaseData.Domain.IServices.FM;
using APT.Infrastructure.Core;
using APT.MS.Domain.Entities.BS;
using APT.MS.Domain.Entities.HM;

using APT.MS.Domain.Enums;
using APT.Utility;
using Microsoft.AspNetCore.Mvc;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;

namespace APT.HM.WebApi.Controllers.Api
{
    [Route("api/HM/HMRiskArea")]
    public partial class RiskAreaController : AuthorizeApiController<T_HM_RISK_AREA>
    {
        /// 排序分页查询数据
        /// </summary>
        /// <param name="pageFilter">分页过滤实体</param>
        /// <returns></returns>
        [HttpPost, Route("OrderPagedArea")]
        public PagedActionResult<T_HM_RISK_AREA> OrderPagedArea([FromBody] KeywordPageFilter pageFilter)
        {
            Expression<Func<T_HM_RISK_AREA, bool>> uExpress = t => t.IS_DELETED == false;
            if (pageFilter.Keyword != "")
            {
                List<Guid> ids = new List<Guid>();
                var tempids = pageFilter.Keyword.Split(",");
                foreach (var id in tempids)
                {
                    ids.Add(Guid.Parse(id));
                }
                uExpress = uExpress.And(t => ids.Contains(t.ID));
            }

            return WitOrderPaged(uExpress, pageFilter);
        }
    }
}
