lixiaojun
2024-03-26 38b6c0f70c646d247e50083c4a09abce055e363a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
namespace Yw.Application
{
    /// <summary>
    /// DmaArea
    /// </summary>
    [Route("DMA/Area/Std")]
    [ApiDescriptionSettings("DMA", Name = "Dma分区(Std)", Order = 9900)]
    public class DmaArea_StdController : IDynamicApiController
    {
 
        /// <summary>
        /// 通过 BelongType 和 BelongID 获取
        /// </summary>
        [Route("GetByBelongTypeAndBelongID@V1.0")]
        [HttpGet]
        public List<DmaAreaStdDto> GetByBelongTypeAndBelongID([FromQuery][Required] BelongInput input)
        {
            var keyContent = $"DMA_Area_Std_GetByBelongTypeAndBelongID_{input.BelongType}_{input.BelongID}";
            var cacheKey = MemoryCacheKeyHelper.GetKey(MemoryCacheKey.WebApiLevel, MemoryCacheKey.Module, keyContent);
 
            var vm_list = MemoryCacheHelper.GetSet(cacheKey, () =>
            {
                var all = new Service.DmaArea().GetByBelongTypeAndBelongID(input.BelongType, input.BelongID);
                Yw.Service.DmaArea.PublishCache(cacheKey);
                var vmList = all?.Select(x => new DmaAreaStdDto(x)).ToList();
                return vmList;
            }, Yw.Service.ConfigHelper.CacheLevel5);
            return vm_list;
 
        }
 
 
    }
}