using Microsoft.AspNetCore.Mvc;
using Znyc.CloudCar.IServices.Dictionary;
using Znyc.CloudCar.Model.Dtos.Dictionary;
using Znyc.CloudCar.Model.ViewModels.ReportsCallBack;
namespace Znyc.CloudCar.Controller
{
///
/// 数据字典
///
public class DictionaryController : ControllerBase
{
private readonly IDictionaryService _dictionaryServices;
public DictionaryController(IDictionaryService dictionaryServices)
{
_dictionaryServices = dictionaryServices;
}
///
/// 根据Id获取字典
///
///
///
[HttpGet]
[Route("api/v1/dict/{id}")]
public async Task GetByIdAsync(long id)
{
return await _dictionaryServices.GetByIdAsync(id);
}
///
/// 根据ParentId查询数据字典列表
///
///
///
[HttpGet]
[Route("api/v1/dict/pid/{pid}")]
public async Task GetListByParentIdAsync(long pid)
{
return await _dictionaryServices.GetListByParentIdAsync(pid);
}
///
/// 根据ParentId,Code查询数据字典列表
///
///
///
///
[HttpGet]
[Route("api/v1/dict/{parentId}/{code}")]
public async Task GetListByCodeAsync(long parentId, string code)
{
return await _dictionaryServices.GetListByCodeAsync(parentId, code);
}
}
}