| | |
| | | /// PumpSeries |
| | | /// </summary> |
| | | [Route("Assets/PumpSeries")] |
| | | [ApiDescriptionSettings("Assets", Name = "资产", Order = 100000)] |
| | | [ApiDescriptionSettings("Assets", Name = "PumpSeries", Order = 400000)] |
| | | public class PumpSeries_Controller : IDynamicApiController |
| | | { |
| | | private readonly Service.PumpSeries _service = new(); |
| | |
| | | /// </summary> |
| | | [Route("Insert@V1.0")] |
| | | [HttpPost] |
| | | public long Insert(AddPumpSeriesDto input) |
| | | public long Insert(AddPumpSeriesInput input) |
| | | { |
| | | var model = input.Adapt<AddPumpSeriesDto, Model.PumpSeries>(); |
| | | var model = input.Adapt<AddPumpSeriesInput, Model.PumpSeries>(); |
| | | model.SortCode = _service.GetMaxSortCode() + 1; |
| | | var id = _service.Insert(model); |
| | | return id; |
| | |
| | | /// </summary> |
| | | [Route("Inserts@V1.0")] |
| | | [HttpPost] |
| | | public bool Inserts(List<AddPumpSeriesDto> inputList) |
| | | public bool Inserts(List<AddPumpSeriesInput> inputList) |
| | | { |
| | | var list = inputList.Select(x => x.Adapt<AddPumpSeriesDto, Model.PumpSeries>()).ToList(); |
| | | var list = inputList.Select(x => x.Adapt<AddPumpSeriesInput, Model.PumpSeries>()).ToList(); |
| | | list.ForEach(x => |
| | | { |
| | | x.SortCode = _service.GetMaxSortCode() + 1 + list.IndexOf(x); |
| | |
| | | /// </summary> |
| | | [Route("Update@V1.0")] |
| | | [HttpPut] |
| | | public bool Update(UpdatePumpSeriesDto input) |
| | | public bool Update([Required] UpdatePumpSeriesInput input) |
| | | { |
| | | var model = _service.GetByID(input.ID); |
| | | if (model == null) |
| | |
| | | /// </summary> |
| | | [Route("Updates@V1.0")] |
| | | [HttpPut] |
| | | public bool Updates(List<UpdatePumpSeriesDto> inputList) |
| | | public bool Updates([Required] List<UpdatePumpSeriesInput> inputList) |
| | | { |
| | | if (inputList == null || inputList.Count < 1) |
| | | { |
| | | return false; |
| | | } |
| | | var list = inputList.Select(x => x.Adapt<UpdatePumpSeriesDto, Model.PumpSeries>()).ToList(); |
| | | var list = inputList.Select(x => x.Adapt<UpdatePumpSeriesInput, Model.PumpSeries>()).ToList(); |
| | | var bol = _service.Updates(list); |
| | | return bol; |
| | | } |
| | |
| | | /// </summary> |
| | | [Route("UpdateSortCode@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdateSortCode(long ID, int SortCode) |
| | | public bool UpdateSortCode([Required] UpdateSortCodeInput input) |
| | | { |
| | | var bol = _service.UpdateSortCode(ID, SortCode); |
| | | var bol = _service.UpdateSortCode(input.ID, input.SortCode); |
| | | return bol; |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | [Route("UpdateSorter@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdateSorter(List<UpdateSortCodeInput> inputList) |
| | | public bool UpdateSorter([Required] List<UpdateSortCodeInput> inputList) |
| | | { |
| | | if (inputList == null || inputList.Count < 1) |
| | | { |
| | | return false; |
| | | } |
| | | var list = inputList.Select(x => x.Adapt<Yw.Model.Sorter>()).ToList(); |
| | | var bol = _service.UpdateSorter(list); |
| | | return bol; |
| | |
| | | /// </summary> |
| | | [Route("UpdateParas@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdateParas(long ID, Dictionary<string, string> Paras) |
| | | public bool UpdateParas([Required] UpdateParasInput input) |
| | | { |
| | | var bol = _service.UpdateParas(ID, Paras); |
| | | var bol = _service.UpdateParas(input.ID, input.Paras); |
| | | return bol; |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | [Route("UpdateFlags@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdateFlags(long ID, List<string> Flags) |
| | | public bool UpdateFlags([Required] UpdateFlagsInput input) |
| | | { |
| | | var bol = _service.UpdateFlags(ID, Flags); |
| | | var bol = _service.UpdateFlags(input.ID, input.Flags); |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新 TagName |
| | | /// 更新TagName |
| | | /// </summary> |
| | | [Route("UpdateTagName@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdateTagName(long ID, string TagName) |
| | | public bool UpdateTagName([Required] UpdateTagNameInput input) |
| | | { |
| | | var bol = _service.UpdateTagName(ID, TagName); |
| | | if (!string.IsNullOrEmpty(input.TagName)) |
| | | { |
| | | if (_service.IsExistTagNameExceptID(input.TagName, input.ID)) |
| | | { |
| | | throw Oops.Oh(InternalErrorCodes.V001, $"TagName:{input.TagName}", "标记名称已存在"); |
| | | } |
| | | } |
| | | var bol = _service.UpdateTagName(input.ID, input.TagName); |
| | | return bol; |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | [Route("UpdateUseStatus@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdateUseStatus(long ID, int UseStatus) |
| | | public bool UpdateUseStatus([Required] UpdateUseStatusInput input) |
| | | { |
| | | var bol = _service.UpdateUseStatus(ID, (Yw.Model.eUseStatus)UseStatus); |
| | | var bol = _service.UpdateUseStatus(input.ID, (Yw.Model.eUseStatus)input.UseStatus); |
| | | return bol; |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | [Route("DeleteByID@V1.0")] |
| | | [HttpDelete] |
| | | public bool DeleteByID(long ID) |
| | | public bool DeleteByID([FromQuery][Required] IDInput input) |
| | | { |
| | | var bol = _service.DeleteByID(ID, out string msg); |
| | | var bol = _service.DeleteByID(input.ID, out string msg); |
| | | if (!bol) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D999, msg); |