瀏覽代碼

修复空指针

hechunping 2 年之前
父節點
當前提交
effbca851f
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      device-api-service/src/main/java/com/xy/service/DeviceInfoServiceImpl.java

+ 1 - 1
device-api-service/src/main/java/com/xy/service/DeviceInfoServiceImpl.java

@@ -141,7 +141,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
                 .in(DeviceInfo::getDeviceId, dto.getDeviceId())
                 .select(DeviceInfo::getDeviceId, DeviceInfo::getDeviceName);
         List<DeviceInfo> deviceInfoList = list(lqw);
-        return R.ok(deviceInfoList.stream().collect(Collectors.toMap(DeviceInfo::getDeviceId, DeviceInfo::getDeviceName)));
+        return R.ok(deviceInfoList.stream().collect(Collectors.toMap(DeviceInfo::getDeviceId, i->Optional.ofNullable(i.getDeviceName()).orElse(""))));
     }
 
     @Override