fix 唯一号处理
This commit is contained in:
@@ -78,6 +78,11 @@ public class DeviceSaveRequest : IValidatableObject
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
if (Id.HasValue)
|
||||
{
|
||||
UniqueNo = null;
|
||||
}
|
||||
|
||||
if (Type != DeviceTypeEnumType.Door && AsAttendance)
|
||||
{
|
||||
yield return new ValidationResult($"{DeviceTypeEnumType.Door.GetDescription()}才可设置作为考勤设备", new[] { nameof(AsAttendance) });
|
||||
|
||||
@@ -111,7 +111,6 @@ public class DeviceService : IDeviceService
|
||||
var existsG = await _dbContext.Queryable<DeviceGroupRelationshipEntity>()
|
||||
.LeftJoin<DeviceGroupEntity>((dgr, dg) => dgr.GroupCode == dg.Code)
|
||||
.Where((dgr, dg) => dgr.DeviceCode == entity.Code)
|
||||
.Where((dgr, dg) => dg.Type != null)
|
||||
.AnyAsync();
|
||||
|
||||
existsG.ThrowIfTrue("存在设备分组,不可修改设备分类");
|
||||
|
||||
@@ -22,7 +22,6 @@ public class DeviceEntity : SugarBaseEntity, ITenantId
|
||||
/// <summary>
|
||||
/// 设备唯一码,IP/MAC/SNO
|
||||
/// </summary>
|
||||
[AdaptIgnore(MemberSide.Destination)]
|
||||
[SugarColumn(ColumnDescription = "设备唯一码", UniqueGroupNameList = new[] { "Idx_Device_UniqueNo" })]
|
||||
public string UniqueNo { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user