namespace Yw.Application
|
{
|
/// <summary>
|
/// UnitValue
|
/// </summary>
|
[Route("Unit/Value/Std")]
|
[ApiDescriptionSettings("Unit", Name = "单位值(Std)", Order = 7900)]
|
public class SysUnitValue_StdController : IDynamicApiController
|
{
|
|
/// <summary>
|
/// 通过 TypeID 获取
|
/// </summary>
|
[Route("GetByTypeID@V1.0")]
|
[HttpGet]
|
public List<SysUnitValueStdDto> GetByTypeID([FromQuery][Required] TypeIDInput input)
|
{
|
var typeId = input.TypeID;
|
|
var keyContent = $"Unit_Value_Std_GetByTypeID_{typeId}";
|
var cacheKey = MemoryCacheKeyHelper.GetKey(MemoryCacheKey.WebApiLevel, MemoryCacheKey.Module, keyContent);
|
var vm_list = MemoryCacheHelper.GetSet(cacheKey, () =>
|
{
|
var all = new Service.SysUnitValue().GetByTypeID(typeId);
|
Service.SysUnitValue.PublishCache(cacheKey);
|
var vmList = all?.Select(x => new SysUnitValueStdDto(x)).ToList();
|
return vmList;
|
}, CacheHelper.CacheLevel5);
|
return vm_list;
|
}
|
|
/// <summary>
|
/// 通过类型编码获取
|
/// </summary>
|
[Route("GetByTypeCode@V1.0")]
|
[HttpGet]
|
public List<SysUnitValueStdDto> GetByTypeCode([FromQuery][Required] CodeInput input)
|
{
|
var typeCode = input.Code;
|
|
var keyContent = $"Unit_Value_Std_GetByTypeCode_{typeCode}";
|
var cacheKey = MemoryCacheKeyHelper.GetKey(MemoryCacheKey.WebApiLevel, MemoryCacheKey.Module, keyContent);
|
var vm_list = MemoryCacheHelper.GetSet(cacheKey, () =>
|
{
|
var all = new Service.SysUnitValue().GetByTypeCode(typeCode);
|
Service.SysUnitValue.PublishCache(cacheKey);
|
var vmList = all?.Select(x => new SysUnitValueStdDto(x)).ToList();
|
return vmList;
|
}, CacheHelper.CacheLevel5);
|
return vm_list;
|
}
|
|
|
|
|
|
}
|
}
|