using APT.BaseData.Domain.Entities;
using APT.BaseData.Domain.Entities.BD;
using APT.BaseData.Domain.Enums;
using APT.BaseData.Domain.IServices.BD;
using APT.Infrastructure.Core;
using APT.Utility;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace APT.BD.WebApi.Controllers.Api
{
    /// <summary>
    ///  国标行业信息
    /// </summary>
    [Route("api/BD/BDPlace")]
    public partial class PlaceController : AuthorizeTreeApiController<T_BD_PLACE>
	{
        /// <summary>
        /// 查询省份数据
        /// </summary>
        /// <param name="filter">过滤实体</param>
        /// <returns></returns>
        [HttpPost, Route("GetProviences")]
        public JsonActionResult<IEnumerable<T_BD_PLACE>> GetProviences([FromBody] KeywordFilter filter)
        {
            return WitEntities(c => c.PROP == Convert.ToInt32(BDPlaceEnum.省份), filter);
        }

        /// <summary>
        /// 查询城市数据
        /// </summary>
        /// <param name="filter">过滤实体</param>
        /// <param name="Parameter1">省份ID</param>
        /// <returns></returns>
        [HttpPost, Route("GetCitiesByPId")]
        public JsonActionResult<IEnumerable<T_BD_PLACE>> GetCitiesByPId([FromBody] KeywordFilter filter)
        {
            return WitEntities(c => c.PROP == Convert.ToInt32(BDPlaceEnum.城市) && c.PARENT_ID.ToString() == filter.Parameter1, filter);
        }

    }
}
