|
@@ -84,16 +84,19 @@ public class IotDeviceServiceImpl implements IotDeviceService {
|
|
iotTreeMapper.insert(iotTreeDO);
|
|
iotTreeMapper.insert(iotTreeDO);
|
|
}
|
|
}
|
|
//维护品牌
|
|
//维护品牌
|
|
- List<IotModelDO> iotModelDOS = iotModelMapper.selectByMap(ImmutableMap.of("brand", createReqVO.getBrand(), "name", createReqVO.getModel()));
|
|
|
|
- if (CollUtil.isEmpty(iotModelDOS)) {
|
|
|
|
- IotModelDO iotModelDO = new IotModelDO();
|
|
|
|
- iotModelDO.setBrand(createReqVO.getBrand());
|
|
|
|
- DictDataDO dictData = dictDataService.getDictData(createReqVO.getBrand());
|
|
|
|
- iotModelDO.setBrandName(Objects.nonNull(dictData)?dictData.getLabel():"");
|
|
|
|
- iotModelDO.setName(createReqVO.getModel());
|
|
|
|
- iotModelDO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
|
|
|
- iotModelMapper.insert(iotModelDO);
|
|
|
|
|
|
+ if(Objects.nonNull(createReqVO.getModel())) {
|
|
|
|
+ List<IotModelDO> iotModelDOS = iotModelMapper.selectByMap(ImmutableMap.of("brand", createReqVO.getBrand(), "name", createReqVO.getModel()));
|
|
|
|
+ if (CollUtil.isEmpty(iotModelDOS)) {
|
|
|
|
+ IotModelDO iotModelDO = new IotModelDO();
|
|
|
|
+ iotModelDO.setBrand(createReqVO.getBrand());
|
|
|
|
+ DictDataDO dictData = dictDataService.getDictData(createReqVO.getBrand());
|
|
|
|
+ iotModelDO.setBrandName(Objects.nonNull(dictData)?dictData.getLabel():"");
|
|
|
|
+ iotModelDO.setName(createReqVO.getModel());
|
|
|
|
+ iotModelDO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
|
|
|
+ iotModelMapper.insert(iotModelDO);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
// 返回
|
|
// 返回
|
|
return iotDevice.getId();
|
|
return iotDevice.getId();
|
|
}
|
|
}
|