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.AE;
using APT.BaseData.Domain.IServices.FM;
using APT.Infrastructure.Core;
using APT.MS.Domain.Entities.DM;
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.DM
{
    [Route("api/DM/DMDeviceCheckDetail")]
    public class DMDeviceCheckDetailController : AuthorizeApiController<T_DM_DEVICE_CHECK_DETAIL>
    {
        /// <summary>
        /// 设备设施库 选项卡记录查看
        /// </summary>
        /// <param name="filter">过滤实体</param>
        /// <returns></returns>
        [HttpPost, Route("EntitiesShow")]
        public JsonActionResult<IEnumerable<T_DM_DEVICE_CHECK_DETAIL>> EntitiesShow([FromBody] KeywordFilter filter)
        {
            return SafeExecute(() =>
            {
                var list = GetEntities<T_DM_DEVICE_CHECK_DETAIL>(e => e.Nav_DeviceCheck.STATUS != PFStandardStatus.Draft, filter,null);
                if (list != null && list.Any())
                {
                    list = list.OrderByDescending(e => e.CREATE_TIME);
                }
                return list;
            });
        }
    }
}