namespace HStation.Application
|
{
|
/// <summary>
|
/// AssetsFlowmeterMain
|
/// </summary>
|
[Route("Assets/Flowmeter/Main/Std")]
|
[ApiDescriptionSettings("Assets", Name = "流量计型号(Std)", Order = 8900)]
|
public class AssetsFlowmeterMain_StdController : IDynamicApiController
|
{
|
|
/// <summary>
|
/// 获取所有
|
/// </summary>
|
[Route("GetAll@V1.0")]
|
[HttpGet]
|
public List<AssetsFlowmeterMainStdDto> 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;
|
}
|
|
/// <summary>
|
/// 通过 SeriesID 获取
|
/// </summary>
|
[Route("GetBySeriesID@V1.0")]
|
[HttpGet]
|
public List<AssetsFlowmeterMainStdDto> 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;
|
}
|
|
|
|
}
|
}
|