mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-26 04:39:53 +01:00
优化方法,把获取最近最后时间获取,放在获取设备数量前面前,可以减少一次sql查询,因为在获取时间的时候,已经顺便缓存的设备数量了
--AgentServiceImpl.java 优化:减少sql查询
This commit is contained in:
parent
6f7ff9f858
commit
09c17b2dc5
1 changed files with 2 additions and 5 deletions
|
|
@ -105,14 +105,11 @@ public class AgentServiceImpl extends BaseServiceImpl<AgentDao, AgentEntity> imp
|
||||||
// 获取 TTS 音色名称
|
// 获取 TTS 音色名称
|
||||||
dto.setTtsVoiceName(timbreModelService.getTimbreNameById(agent.getTtsVoiceId()));
|
dto.setTtsVoiceName(timbreModelService.getTimbreNameById(agent.getTtsVoiceId()));
|
||||||
|
|
||||||
// 获取设备数量
|
|
||||||
dto.setDeviceCount(getDeviceCountByAgentId(agent.getId()));
|
|
||||||
|
|
||||||
// 获取智能体最近的最后连接时长
|
// 获取智能体最近的最后连接时长
|
||||||
dto.setLastConnectedAt(deviceService.getLatestLastConnectionTime(agent.getId()));
|
dto.setLastConnectedAt(deviceService.getLatestLastConnectionTime(agent.getId()));
|
||||||
|
|
||||||
|
// 获取设备数量
|
||||||
|
dto.setDeviceCount(getDeviceCountByAgentId(agent.getId()));
|
||||||
return dto;
|
return dto;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue