From dddd1f4c9d69ee247bcad44af3950259054a60a8 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期日, 14 一月 2024 13:51:40 +0800 Subject: [PATCH] 模块整理升级 --- Yw.Application.Unit.Core/03-value/1-mgr/SysUnitValue_Controller.cs | 22 ++++++++++------------ 1 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Yw.Application.Unit.Core/3-value/1-mgr/SysUnitValue_Controller.cs b/Yw.Application.Unit.Core/03-value/1-mgr/SysUnitValue_Controller.cs similarity index 89% rename from Yw.Application.Unit.Core/3-value/1-mgr/SysUnitValue_Controller.cs rename to Yw.Application.Unit.Core/03-value/1-mgr/SysUnitValue_Controller.cs index e9b74a6..3a42115 100644 --- a/Yw.Application.Unit.Core/3-value/1-mgr/SysUnitValue_Controller.cs +++ b/Yw.Application.Unit.Core/03-value/1-mgr/SysUnitValue_Controller.cs @@ -77,11 +77,11 @@ var type = new Service.SysUnitType().GetByID(input.TypeID); if (type == null) { - throw Oops.Oh(ErrorCodes.D001, $"TypeID:{input.TypeID}"); + throw YOops.Oh(eResultCode.Alert, ErrorCodes.D001, $"TypeID:{input.TypeID} 鏁版嵁涓嶅瓨鍦�"); } if (_service.IsExistCode(input.TypeID, input.Code)) { - throw Oops.Oh(ErrorCodes.V001, $"Code:{input.Code}", "缂栫爜宸插瓨鍦�"); + throw YOops.Oh(eResultCode.Alert, ErrorCodes.V001, $"Code:{input.Code} 缂栫爜宸插瓨鍦�"); } var model = input.Adapt<AddSysUnitValueInput, Model.SysUnitValue>(); model.SortCode = _service.GetMaxSortCodeByTypeID(input.TypeID) + 1; @@ -104,11 +104,11 @@ var model = _service.GetByID(input.ID); if (model == null) { - throw Oops.Oh(ErrorCodes.D001, $"ID:{input.ID}"); + throw YOops.Oh(eResultCode.Alert, ErrorCodes.D001, $"ID:{input.ID} 鏁版嵁涓嶅瓨鍦�"); } if (_service.IsExistCodeExceptID(model.TypeID, input.Code, input.ID)) { - throw Oops.Oh(ErrorCodes.V001, $"Code:{input.Code}", "缂栫爜宸插瓨鍦�"); + throw YOops.Oh(eResultCode.Alert, ErrorCodes.V001, $"Code:{input.Code} 缂栫爜宸插瓨鍦�"); } var rhs = new Model.SysUnitValue(model); input.Adapt(rhs); @@ -123,8 +123,6 @@ [HttpPut] public bool UpdateSortCode([Required] UpdateSortCodeInput input) { - if (input == null) - return false; var bol = _service.UpdateSortCode(input.ID, input.SortCode); return bol; } @@ -136,10 +134,6 @@ [HttpPut] public bool UpdateSorter([Required] List<UpdateSortCodeInput> inputList) { - if (inputList == null || inputList.Count < 1) - { - return false; - } var list = inputList.Select(x => x.Adapt<Model.Sorter>()).ToList(); var bol = _service.UpdateSorter(list); return bol; @@ -181,10 +175,14 @@ /// </summary> [Route("DeleteByID@V1.0")] [HttpDelete] - public DeleteReasonOutput DeleteByID([FromQuery][Required] IDInput input) + public bool DeleteByID([FromQuery][Required] IDInput input) { var bol = _service.DeleteByID(input.ID, out string msg); - return new DeleteReasonOutput() { Success = bol, Reason = msg }; + if (!bol) + { + throw YOops.Oh(eResultCode.Alert, ErrorCodes.D999, msg); + } + return bol; } #endregion -- Gitblit v1.9.3