mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-24 04:19:48 +01:00
UpdateWrapper
This commit is contained in:
parent
32fa71e8f1
commit
7e86a9f8a9
1 changed files with 8 additions and 6 deletions
|
|
@ -60,14 +60,16 @@ public class DeviceServiceImpl extends BaseServiceImpl<DeviceDao, DeviceEntity>
|
|||
@Async
|
||||
public void updateDeviceConnectionInfo(String agentId, String deviceId, String appVersion) {
|
||||
try {
|
||||
DeviceEntity device = new DeviceEntity();
|
||||
device.setId(deviceId);
|
||||
device.setLastConnectedAt(new Date());
|
||||
device.setUpdateDate(new Date());
|
||||
UpdateWrapper<DeviceEntity> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("id", deviceId)
|
||||
.set("last_connected_at", new Date())
|
||||
.set("update_date", new Date());
|
||||
|
||||
if (StringUtils.isNotBlank(appVersion)) {
|
||||
device.setAppVersion(appVersion);
|
||||
updateWrapper.set("app_version", appVersion);
|
||||
}
|
||||
deviceDao.updateById(device);
|
||||
deviceDao.update(null, updateWrapper);
|
||||
|
||||
if (StringUtils.isNotBlank(agentId)) {
|
||||
redisUtils.set(RedisKeys.getAgentDeviceLastConnectedAtById(agentId), new Date());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue