using BPA.SAAS.Manage.Application.System.Dtos;
using BPA.SAAS.Manage.Application.System.Interface;
using BPA.SAAS.Manage.Core.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;

namespace BPA.SAAS.Manage.Application.System
{
    [ApiDescriptionSettings("SYS", Tag = "字典类型")]
    public class DictTypeServices: IDynamicApiController, ITransient
    {
        IDictTypeService _dicttypeServices;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dicttypeServices"></param>
        public DictTypeServices(IDictTypeService dicttypeServices)
        {
            _dicttypeServices = dicttypeServices;
        }

        #region 字典类型信息
        /// <summary>
        /// 查询字典类型信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/dicttype/getdicttype")]
        public async Task<PageUtil> GetDictType([FromBody] DictTypeQueryDto dto)
        {
            return await _dicttypeServices.GetDictType(dto);
        }
        /// <summary>
        /// 添加字典类型信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/dicttype/adddicttype")]
        public async Task<bool> Add(DictTypeDto dto)
        {
            return  await _dicttypeServices.AddDictType(dto);
        }
        /// <summary>
        /// 修改字典类型信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/dicttype/updatedicttype")]
        public async Task<bool> Update(DictTypeDto dto)
        {
            return await _dicttypeServices.UpdateDictType(dto);
        }
        /// <summary>
        /// 删除字典类型信息
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpPost("/api/dicttype/deletetedicttype")]
        public async Task<bool> Delete(List<string> ids)
        {
            return await _dicttypeServices.BathchDelDictType(ids);
        }
        /// <summary>
        /// 字典类型下拉数据列表
        /// </summary>
        /// <returns></returns>
        [HttpGet("/api/dicttype/dicttype")]
        public Dictionary<string, object> GetDictType()
        {
            return  _dicttypeServices.GetDictType();
        }
        #endregion
    }
}
