ÎļþÃû´Ó Application/IStation.Application.Product/iot_payment_record/IotPaymentRecord_Controller.cs ÐÞ¸Ä |
| | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// IotPaymentRecord |
| | | /// SimPaymentRecord |
| | | /// </summary> |
| | | [Route("Product/IotPaymentRecord")] |
| | | [ApiDescriptionSettings("Product", Name = "ç©èå¡ç¼´è´¹è®°å½", Order = 1000)] |
| | | public class IotPaymentRecord_Controller : IDynamicApiController |
| | | [Route("Product/SimPaymentRecord")] |
| | | [ApiDescriptionSettings("Product", Name = "SIMå¡ç¼´è´¹è®°å½", Order = 1000)] |
| | | public class SimPaymentRecord_Controller : IDynamicApiController |
| | | { |
| | | private readonly Service.IotPaymentRecord _service = new Service.IotPaymentRecord(); |
| | | private readonly Service.SimPaymentRecord _service = new Service.SimPaymentRecord(); |
| | | |
| | | #region Query |
| | | |
| | |
| | | /// </summary> |
| | | [Route("GetByCorpID@V1.0")] |
| | | [HttpGet] |
| | | public List<IotPaymentRecordDto> GetByCorpID([FromQuery][Required] CorpIDInput input) |
| | | public List<SimPaymentRecordDto> GetByCorpID([FromQuery][Required] CorpIDInput input) |
| | | { |
| | | var list = _service.GetByCorpID(input.CorpID); |
| | | var vm_list = list?.Select(x => x.Adapt<Model.IotPaymentRecord, IotPaymentRecordDto>()).ToList(); |
| | | var vm_list = list?.Select(x => x.Adapt<Model.SimPaymentRecord, SimPaymentRecordDto>()).ToList(); |
| | | return vm_list; |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | [Route("GetByID@V1.0")] |
| | | [HttpGet] |
| | | public IotPaymentRecordDto GetByID([FromQuery][Required] IDUnderCorpInput input) |
| | | public SimPaymentRecordDto GetByID([FromQuery][Required] IDUnderCorpInput input) |
| | | { |
| | | var model = _service.GetByID(input.CorpID, input.ID); |
| | | return model?.Adapt<Model.IotPaymentRecord, IotPaymentRecordDto>(); |
| | | return model?.Adapt<Model.SimPaymentRecord, SimPaymentRecordDto>(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | [Route("GetByIds@V1.0")] |
| | | [HttpGet] |
| | | public List<IotPaymentRecordDto> GetByIds([FromQuery][Required] IdsUnderCorpInput input) |
| | | public List<SimPaymentRecordDto> GetByIds([FromQuery][Required] IdsUnderCorpInput input) |
| | | { |
| | | var ids = LongListHelper.ToList(input.Ids); |
| | | var list = _service.GetByIds(input.CorpID, ids); |
| | | var vm_list = list?.Select(x => x.Adapt<Model.IotPaymentRecord, IotPaymentRecordDto>()).ToList(); |
| | | var vm_list = list?.Select(x => x.Adapt<Model.SimPaymentRecord, SimPaymentRecordDto>()).ToList(); |
| | | return vm_list; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ ProductID è·å |
| | | /// éè¿ CardID è·å |
| | | /// </summary> |
| | | [Route("GetByProductID@V1.0")] |
| | | [Route("GetByCardID@V1.0")] |
| | | [HttpGet] |
| | | public List<IotPaymentRecordDto> GetByProductID([FromQuery] ProductIDUnderCorpInput input) |
| | | public List<SimPaymentRecordDto> GetByCardID([FromQuery] CardIDUnderCorpInput input) |
| | | { |
| | | var list = _service.GetByProductID(input.CorpID, input.ProductID); |
| | | var vmList = list?.Select(x => new IotPaymentRecordDto(x)).ToList(); |
| | | var list = _service.GetByCardID(input.CorpID, input.CardID); |
| | | var vmList = list?.Select(x => new SimPaymentRecordDto(x)).ToList(); |
| | | return vmList; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ ProductIds è·å |
| | | /// éè¿ CardIds è·å |
| | | /// </summary> |
| | | [Route("GetByProductIds@V1.0")] |
| | | [Route("GetByCardIds@V1.0")] |
| | | [HttpGet] |
| | | public List<IotPaymentRecordDto> GetByProductIds([FromQuery] ProductIdsUnderCorpInput input) |
| | | public List<SimPaymentRecordDto> GetByCardIds([FromQuery] CardIdsUnderCorpInput input) |
| | | { |
| | | var productIds = LongListHelper.ToList(input.ProductIds); |
| | | var list = _service.GetByProductIds(input.CorpID, productIds); |
| | | var vmList = list?.Select(x => new IotPaymentRecordDto(x)).ToList(); |
| | | var productIds = LongListHelper.ToList(input.CardIds); |
| | | var list = _service.GetByCardIds(input.CorpID, productIds); |
| | | var vmList = list?.Select(x => new SimPaymentRecordDto(x)).ToList(); |
| | | return vmList; |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | [Route("GetByBelongTypeAndBelongID@V1.0")] |
| | | [HttpGet] |
| | | public List<IotPaymentRecordDto> GetByBelongTypeAndBelongID([FromQuery][Required] BelongUnderCorpInput input) |
| | | public List<SimPaymentRecordDto> GetByBelongTypeAndBelongID([FromQuery][Required] BelongUnderCorpInput input) |
| | | { |
| | | var list = _service.GetByBelongTypeAndBelongID(input.CorpID, input.BelongType, input.BelongID); |
| | | var vmList = list?.Select(x => new IotPaymentRecordDto(x)).ToList(); |
| | | var vmList = list?.Select(x => new SimPaymentRecordDto(x)).ToList(); |
| | | return vmList; |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | [Route("Insert@V1.0")] |
| | | [HttpPost] |
| | | public long Insert(AddIotPaymentRecordInput input) |
| | | public long Insert(AddSimPaymentRecordInput input) |
| | | { |
| | | if (input == null) |
| | | return default; |
| | | var model = input.Adapt<AddIotPaymentRecordInput, Model.IotPaymentRecord>(); |
| | | var model = input.Adapt<AddSimPaymentRecordInput, Model.SimPaymentRecord>(); |
| | | var id = _service.Insert(model); |
| | | return id; |
| | | } |
| | |
| | | /// </summary> |
| | | [Route("Inserts@V1.0")] |
| | | [HttpPost] |
| | | public bool Inserts(List<AddIotPaymentRecordInput> inputList) |
| | | public bool Inserts(List<AddSimPaymentRecordInput> inputList) |
| | | { |
| | | if (inputList == null || inputList.Count < 1) |
| | | return false; |
| | | var list = inputList.Select(x => x.Adapt<AddIotPaymentRecordInput, Model.IotPaymentRecord>()).ToList(); |
| | | var list = inputList.Select(x => x.Adapt<AddSimPaymentRecordInput, Model.SimPaymentRecord>()).ToList(); |
| | | var bol = _service.Inserts(list); |
| | | return bol; |
| | | } |
| | |
| | | /// </summary> |
| | | [Route("Update@V1.0")] |
| | | [HttpPut] |
| | | public bool Update(UpdateIotPaymentRecordInput input) |
| | | public bool Update(UpdateSimPaymentRecordInput input) |
| | | { |
| | | if (input == null) |
| | | return false; |
| | | var model = _service.GetByID(input.CorpID, input.ID); |
| | | if (model == null) |
| | | return false; |
| | | var rhs = new Model.IotPaymentRecord(model); |
| | | var rhs = new Model.SimPaymentRecord(model); |
| | | input.Adapt(rhs); |
| | | var bol = _service.Update(rhs); |
| | | return bol; |
| | |
| | | /// </summary> |
| | | [Route("Updates@V1.0")] |
| | | [HttpPut] |
| | | public bool Updates(List<UpdateIotPaymentRecordInput> inputList) |
| | | public bool Updates(List<UpdateSimPaymentRecordInput> inputList) |
| | | { |
| | | if (inputList == null || inputList.Count() < 1) |
| | | { |
| | |
| | | var modelList = _service.GetByIds(corpIds[0], inputList.Select(x => x.ID).ToList()); |
| | | if (modelList == null || modelList.Count < 1) |
| | | return false; |
| | | var rhsList = new List<Model.IotPaymentRecord>(); |
| | | var rhsList = new List<Model.SimPaymentRecord>(); |
| | | modelList.ForEach(x => { |
| | | var input = inputList.Find(t => t.ID == x.ID); |
| | | if (input != null) |
| | | { |
| | | var rhs = new Model.IotPaymentRecord(x); |
| | | var rhs = new Model.SimPaymentRecord(x); |
| | | input.Adapt(rhs); |
| | | rhsList.Add(rhs); |
| | | } |