68 lines
1.9 KiB
C#
68 lines
1.9 KiB
C#
using Dlhis.Entity.Sys.Enums;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using Dlhis.Entity.Device.Enums;
|
|
using Kurisu.AspNetCore.Utils.Extensions;
|
|
|
|
namespace Dlhis.Basic.Device.Request;
|
|
|
|
public class DeviceGetAssignmentsRequest : IValidatableObject
|
|
{
|
|
/// <summary>
|
|
/// 权限分配类型 DeviceAssignmentTypeEnumType
|
|
/// </summary>
|
|
[EnumDataType(typeof(DeviceAssignmentTypeEnumType))]
|
|
public DeviceAssignmentTypeEnumType UniqueType { get; set; }
|
|
|
|
/// <summary>
|
|
/// 分配类型 AssignTypeEnumType
|
|
/// </summary>
|
|
[EnumDataType(typeof(AssignTypeEnumType))]
|
|
public AssignTypeEnumType AssignType { get; set; }
|
|
|
|
/// <summary>
|
|
/// 分配值
|
|
/// </summary>
|
|
public string AssignValue { get; set; }
|
|
|
|
/// <summary>
|
|
/// 设备类型
|
|
/// </summary>
|
|
[EnumDataType(typeof(DeviceTypeEnumType))]
|
|
public DeviceTypeEnumType Type { get; set; }
|
|
|
|
/// <summary>
|
|
/// AssignType == AssignTypeEnumType.Department 需要传入
|
|
/// </summary>
|
|
public string TenantId { get; set; }
|
|
|
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
|
{
|
|
if (AssignType == AssignTypeEnumType.Department)
|
|
{
|
|
if (TenantId.IsEmpty())
|
|
{
|
|
yield return new ValidationResult("请明确具体的厂区", new[] { nameof(TenantId) });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public class DeviceGetAssignmentUniquesRequest
|
|
{
|
|
/// <summary>
|
|
/// 权限分配类型 DeviceAssignmentTypeEnumType
|
|
/// </summary>
|
|
[EnumDataType(typeof(DeviceAssignmentTypeEnumType))]
|
|
public DeviceAssignmentTypeEnumType UniqueType { get; set; }
|
|
|
|
/// <summary>
|
|
/// 权限值
|
|
/// </summary>
|
|
public Guid UniqueValue { get; set; }
|
|
|
|
/// <summary>
|
|
/// 设备类型
|
|
/// </summary>
|
|
[EnumDataType(typeof(DeviceTypeEnumType))]
|
|
public DeviceTypeEnumType Type { get; set; }
|
|
} |