mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-27 04:49:47 +01:00
manualAddDevice
This commit is contained in:
parent
84c11a281a
commit
4428c1a298
1 changed files with 4 additions and 2 deletions
|
|
@ -415,7 +415,9 @@ public class DeviceServiceImpl extends BaseServiceImpl<DeviceDao, DeviceEntity>
|
||||||
@Override
|
@Override
|
||||||
public void manualAddDevice(Long userId, DeviceManualAddDTO dto) {
|
public void manualAddDevice(Long userId, DeviceManualAddDTO dto) {
|
||||||
// 检查mac是否已存在
|
// 检查mac是否已存在
|
||||||
DeviceEntity exist = this.lambdaQuery().eq(DeviceEntity::getMacAddress, dto.getMacAddress()).one();
|
QueryWrapper<DeviceEntity> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.eq("mac_address", dto.getMacAddress());
|
||||||
|
DeviceEntity exist = baseDao.selectOne(wrapper);
|
||||||
if (exist != null) {
|
if (exist != null) {
|
||||||
throw new RenException("该Mac地址已存在");
|
throw new RenException("该Mac地址已存在");
|
||||||
}
|
}
|
||||||
|
|
@ -428,6 +430,6 @@ public class DeviceServiceImpl extends BaseServiceImpl<DeviceDao, DeviceEntity>
|
||||||
entity.setCreateDate(new Date());
|
entity.setCreateDate(new Date());
|
||||||
entity.setAutoUpdate(1);
|
entity.setAutoUpdate(1);
|
||||||
entity.setLastConnectedAt(null); // 最近对话时间为空
|
entity.setLastConnectedAt(null); // 最近对话时间为空
|
||||||
this.save(entity);
|
baseDao.insert(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue