lixiaojun
2024-05-21 dc5bfa19ffc92dada57bdd6b052de6dfd25a010a
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
namespace Yw.Application
{
    /// <summary>
    /// UnitTransfer
    /// </summary>
    [Route("Unit/Transfer")]
    [ApiDescriptionSettings("Unit", Name = "单位转换", Order = 6000)]
    public class SysUnitTransfer_Controller : IDynamicApiController
    {
        private readonly Service.SysUnitTransfer _service = new();
 
        #region Query
 
        /// <summary>
        /// 通过 TypeID 获取
        /// </summary>
        [Route("GetByTypeID@V1.0")]
        [HttpGet]
        public List<SysUnitTransferDto> GetByTypeID([FromQuery][Required] TypeIDInput input)
        {
            var list = _service.GetByTypeID(input.TypeID);
            var vm_list = list?.Select(x => new SysUnitTransferDto(x)).ToList();
            return vm_list;
        }
 
        /// <summary>
        /// 通过 ID 获取 
        /// </summary>
        [Route("GetByID@V1.0")]
        [HttpGet]
        public SysUnitTransferDto GetByID([FromQuery][Required] IDInput input)
        {
            var model = _service.GetByID(input.ID);
            return model == null ? null : new SysUnitTransferDto(model);
        }
 
        /// <summary>
        /// 通过 Ids 获取
        /// </summary>
        [Route("GetByIds@V1.0")]
        [HttpGet]
        public List<SysUnitTransferDto> GetByIds([FromQuery] IdsInput model)
        {
            var ids = LongListHelper.ToList(model.Ids);
            var list = _service.GetByIds(ids);
            var vm_list = list?.Select(x => new SysUnitTransferDto(x)).ToList();
            return vm_list;
        }
 
 
 
        #endregion
 
 
 
 
        #region Set
 
        /// <summary>
        /// 通过 TypeID 设置
        /// </summary>
        [Route("SetByTypeID@V1.0")]
        [HttpPost]
        public bool SetByTypeID([Required] SetSysUnitTransferTypeInput input)
        {
            var list = input.Setters?.Select(x =>
            {
                var model = x.Adapt<SysUnitTransferTypeSetter, Model.SysUnitTransferTypeSetter>();
                return model;
            }).ToList();
            var bol = _service.SetByTypeID(input.TypeID, list);
            return bol;
        }
 
        #endregion
 
    }
}