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/02-type/1-mgr/SysUnitType_Controller.cs | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Yw.Application.Unit.Core/2-type/1-mgr/SysUnitType_Controller.cs b/Yw.Application.Unit.Core/02-type/1-mgr/SysUnitType_Controller.cs similarity index 90% rename from Yw.Application.Unit.Core/2-type/1-mgr/SysUnitType_Controller.cs rename to Yw.Application.Unit.Core/02-type/1-mgr/SysUnitType_Controller.cs index 4d00c02..2145f48 100644 --- a/Yw.Application.Unit.Core/2-type/1-mgr/SysUnitType_Controller.cs +++ b/Yw.Application.Unit.Core/02-type/1-mgr/SysUnitType_Controller.cs @@ -73,7 +73,7 @@ { if (_service.IsExistCode(input.Code)) { - throw Oops.Oh(ErrorCodes.V001, "Code", "缂栫爜宸插瓨鍦�"); + throw YOops.Oh(eResultCode.Alert, ErrorCodes.V001, $"Code:{input.Code} 缂栫爜宸插瓨鍦�"); } var model = input.Adapt<AddSysUnitTypeInput, Model.SysUnitType>(); model.SortCode = _service.GetMaxSortCode(); @@ -95,11 +95,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(input.Code, input.ID)) { - throw Oops.Oh(ErrorCodes.V001, "Code", "缂栫爜宸插瓨鍦�"); + throw YOops.Oh(eResultCode.Alert, ErrorCodes.V001, $"Code:{input.Code} 缂栫爜宸插瓨鍦�"); } var rhs = new Model.SysUnitType(model); input.Adapt(rhs); @@ -114,8 +114,6 @@ [HttpPut] public bool UpdateSortCode([Required] UpdateSortCodeInput input) { - if (input == null) - return false; var bol = _service.UpdateSortCode(input.ID, input.SortCode); return bol; } @@ -127,10 +125,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; @@ -172,10 +166,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