lixiaojun
2024-01-14 dddd1f4c9d69ee247bcad44af3950259054a60a8
Yw.Application.Unit.Core/02-type/1-mgr/SysUnitType_Controller.cs
ÎļþÃû´Ó Yw.Application.Unit.Core/2-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