namespace HStation.Application
{
///
/// AssetsFlowmeterMain
///
[Route("Assets/Flowmeter/Main/Std")]
[ApiDescriptionSettings("Assets", Name = "流量计型号(Std)", Order = 8900)]
public class AssetsFlowmeterMain_StdController : IDynamicApiController
{
///
/// 获取所有
///
[Route("GetAll@V1.0")]
[HttpGet]
public List GetAll()
{
var keyContent = $"Assets_Flowmeter_Main_Std_GetAll";
var cacheKey = MemoryCacheKeyHelper.GetKey(MemoryCacheKey.WebApiLevel, MemoryCacheKey.Module, keyContent);
var vm_list = MemoryCacheHelper.GetSet(cacheKey, () =>
{
var allList = new HStation.Service.AssetsFlowmeterMain().GetAll();
HStation.Service.AssetsFlowmeterMain.PublishCache(cacheKey);
var vmList = allList?.Select(x => new AssetsFlowmeterMainStdDto(x)).ToList();
return vmList;
}, Yw.Service.ConfigHelper.CacheLevel3);
return vm_list;
}
///
/// 通过 SeriesID 获取
///
[Route("GetBySeriesID@V1.0")]
[HttpGet]
public List GetBySeriesID([FromQuery][Required] SeriesIDInput input)
{
var keyContent = $"Assets_Flowmeter_Main_Std_GetBySeriesID_{input.SeriesID}";
var cacheKey = MemoryCacheKeyHelper.GetKey(MemoryCacheKey.WebApiLevel, MemoryCacheKey.Module, keyContent);
var vm_list = MemoryCacheHelper.GetSet(cacheKey, () =>
{
var allList = new HStation.Service.AssetsFlowmeterMain().GetBySeriesID(input.SeriesID);
HStation.Service.AssetsFlowmeterMain.PublishCache(cacheKey);
var vmList = allList?.Select(x => new AssetsFlowmeterMainStdDto(x)).ToList();
return vmList;
}, Yw.Service.ConfigHelper.CacheLevel4);
return vm_list;
}
}
}