mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-26 04:39:53 +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
|
@Async
|
||||||
public void updateDeviceConnectionInfo(String agentId, String deviceId, String appVersion) {
|
public void updateDeviceConnectionInfo(String agentId, String deviceId, String appVersion) {
|
||||||
try {
|
try {
|
||||||
DeviceEntity device = new DeviceEntity();
|
UpdateWrapper<DeviceEntity> updateWrapper = new UpdateWrapper<>();
|
||||||
device.setId(deviceId);
|
updateWrapper.eq("id", deviceId)
|
||||||
device.setLastConnectedAt(new Date());
|
.set("last_connected_at", new Date())
|
||||||
device.setUpdateDate(new Date());
|
.set("update_date", new Date());
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(appVersion)) {
|
if (StringUtils.isNotBlank(appVersion)) {
|
||||||
device.setAppVersion(appVersion);
|
updateWrapper.set("app_version", appVersion);
|
||||||
}
|
}
|
||||||
deviceDao.updateById(device);
|
deviceDao.update(null, updateWrapper);
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(agentId)) {
|
if (StringUtils.isNotBlank(agentId)) {
|
||||||
redisUtils.set(RedisKeys.getAgentDeviceLastConnectedAtById(agentId), new Date());
|
redisUtils.set(RedisKeys.getAgentDeviceLastConnectedAtById(agentId), new Date());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue