using BPA.SAAS.Manage.Application.System.Dtos;
using BPA.SAAS.Manage.Application.System.Interface;
using BPA.SAAS.Manage.Core.Base;
using BPA.SAAS.Manage.Core.system;

namespace BPA.SAAS.Manage.Application
{
    /// <summary>
    /// 数据字典服务接口
    /// </summary>
    [ApiDescriptionSettings("SYS", Tag = "字典信息")]
    public class DictDataServices : IDynamicApiController
    {
        private readonly IDictDataService _dictDataService;
        public DictDataServices(IDictDataService  dictDataService)
        {
            _dictDataService = dictDataService;
        }

        /// <summary>
        /// 查询字典信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/dictdata/getdictdata")]
        public async Task<PageUtil> GetDictData(DictDataQueryDto dto)
        {
            return await _dictDataService.GetDictData(dto);
        }
        /// <summary>
        /// 添加字典信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/dictdata/adddictdata")]
        public async Task<bool> AddDictData(DictDataDto dto)
        {
            return await _dictDataService.AddDictData(dto);
        }
        /// <summary>
        /// 根据字典类型编码查询
        /// </summary>
        /// <param name="typeCode"></param>
        /// <returns></returns>
        [HttpGet("/api/dictdata/getdiclist")]
        public async Task<List<BPA_DictData>> GetDicList(string typeCode)
        {
            return await _dictDataService.GetDicList(typeCode);
        }
        /// <summary>
        /// 修改字典信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/dictdata/updatedictdata")]
        public async Task<bool> UpdateDictData(DictDataDto dto)
        {
            return await _dictDataService.UpdateDictData(dto);
        }
        /// <summary>
        /// 删除字典信息
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpPost("/api/dictdata/batchdeldictdata")]
        public async Task<bool> BatchDelDictData(List<string> ids)
        {
            return await _dictDataService.BatchDelDictData(ids);
        }
    }
}