fix 设备组数据展示,保存控制editable
This commit is contained in:
@@ -56,8 +56,9 @@ public class DeviceGroupService : IDeviceGroupService
|
||||
if (!request.Id.HasValue)
|
||||
{
|
||||
var entity = request.Adapt<DeviceGroupEntity>();
|
||||
|
||||
entity.Editable = true;
|
||||
entity.Code = Guid.NewGuid();
|
||||
|
||||
await _dbContext.InsertAsync(entity);
|
||||
}
|
||||
else
|
||||
@@ -65,6 +66,8 @@ public class DeviceGroupService : IDeviceGroupService
|
||||
var entity = await _dbContext.Queryable<DeviceGroupEntity>().Where(x => x.Id == request.Id).FirstAsync();
|
||||
entity.ThrowIfNull("设备组不存在,无法更新");
|
||||
|
||||
entity.Editable.ThrowIfFalse("不可编辑当前组");
|
||||
|
||||
var nextDevices = await GetDevicesAsync(entity.Code);
|
||||
if (!entity.Type.HasValue)
|
||||
{
|
||||
@@ -75,7 +78,6 @@ public class DeviceGroupService : IDeviceGroupService
|
||||
(request.Type.HasValue && request.Type != entity.Type && nextDevices.Any()).ThrowIfTrue("分组设备类型不匹配,无法修改类型");
|
||||
}
|
||||
|
||||
|
||||
await _dbContext.UpdateAsync(entity);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user