fix 配置值范围整理,保存配置处理
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Org.BouncyCastle.Asn1.X509.SigI;
|
||||
|
||||
namespace Dlhis.Canteen.Setting.Request;
|
||||
|
||||
public class CanteenSettingSaveRequest
|
||||
public class CanteenSettingSaveRequest : IValidatableObject
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
|
||||
@@ -16,7 +19,6 @@ public class CanteenSettingSaveRequest
|
||||
/// <summary>
|
||||
/// 配置生效范围
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "配置生效范围不能为空")]
|
||||
public string UniqueValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -35,4 +37,12 @@ public class CanteenSettingSaveRequest
|
||||
/// 参数值
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
if (UniqueType != CanteenSettingUnqiueEnumType.Tenant && UniqueValue.IsEmpty())
|
||||
{
|
||||
yield return new ValidationResult($"配置{UniqueType.GetDescription()}值不能为空", new string[] { nameof(UniqueValue) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user