lixiaojun
2025-01-13 abf3ceabdd98abd0d955b03732e581a43c4e9fb0
Yw.Application.Unit.Core/03-value/SysUnitValue_Controller.cs
@@ -4,7 +4,7 @@
    /// UnitValue
    /// </summary>
    [Route("Unit/Value")]
    [ApiDescriptionSettings("Unit", Name = "单位值", Order = 8000)]
    [ApiDescriptionSettings("Unit", Name = "单位值", Order = 80000)]
    public class SysUnitValue_Controller : IDynamicApiController
    {
        private readonly Service.SysUnitValue _service = new();
@@ -58,10 +58,6 @@
            var vm_list = list?.Select(x => new SysUnitValueDto(x)).ToList();
            return vm_list;
        }
        #endregion
@@ -139,6 +135,26 @@
            return bol;
        }
        /// <summary>
        /// 更新编码
        /// </summary>
        [Route("UpdateCode@V1.0")]
        [HttpPut]
        public bool UpdateCode([Required] UpdateCodeInput input)
        {
            var model = _service.GetByID(input.ID);
            if (model == null)
            {
                throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"ID:{input.ID} 数据不存在");
            }
            if (_service.IsExistCodeExceptID(model.TypeID, input.Code, input.ID))
            {
                throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.V001, $"Code:{input.Code} 编码已存在");
            }
            var bol = _service.UpdateCode(input.ID, input.Code);
            return bol;
        }
        #endregion
        #region Exist