管理员

This commit is contained in:
2025-08-21 17:55:59 +08:00
parent e9542c70e9
commit 9dee7ad102

View File

@ -169,9 +169,13 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
throw new RuntimeException("设备类型名称已存在,无法修改!!!"); throw new RuntimeException("设备类型名称已存在,无法修改!!!");
} }
// 管理员
String username = LoginHelper.getUsername();
if (!username.equals("admin")) {
if (!Objects.equals(deviceType.getCustomerId(), LoginHelper.getUserId())) { if (!Objects.equals(deviceType.getCustomerId(), LoginHelper.getUserId())) {
throw new RuntimeException("无权修改该设备类型"); throw new RuntimeException("无权修改该设备类型");
} }
}
BeanUtil.copyProperties(resources, deviceType); BeanUtil.copyProperties(resources, deviceType);
deviceTypeMapper.updateById(deviceType); deviceTypeMapper.updateById(deviceType);