namespace Yw.Application
{
///
/// UnitLang
///
[Route("Unit/Lang/Std")]
[ApiDescriptionSettings("Unit", Name = "单位语言(Std)", Order = 99000)]
public class SysUnitLang_StdController : IDynamicApiController
{
///
/// 获取所有
///
[Route("GetAll@V1.0")]
[HttpGet]
public List GetAll()
{
var keyContent = "Unit_Lang_Std_GetAll";
var cacheKey = MemoryCacheKeyHelper.GetKey(MemoryCacheKey.WebApiLevel, MemoryCacheKey.Module, keyContent);
var vm_list = MemoryCacheHelper.GetSet(cacheKey, () =>
{
var all = new Service.SysUnitLang().GetAll();
Service.SysUnitLang.PublishCache(cacheKey);
var vmList = all?.Select(x => new SysUnitLangDto(x)).ToList();
return vmList;
}, Yw.Service.ConfigHelper.CacheLevel5);
return vm_list;
}
///
/// 通过 Code 获取
///
[Route("GetByCode@V1.0")]
[HttpGet]
public SysUnitLangDto GetByCode([FromQuery][Required] CodeInput input)
{
var model = new Service.SysUnitLang().GetByCode(input.Code);
return model == null ? null : new SysUnitLangDto(model);
}
}
}