refactor: 优化查询主机逻辑.

This commit is contained in:
lijiahang
2024-01-12 17:45:08 +08:00
parent 5a33ac6b86
commit 322301d9c9
10 changed files with 55 additions and 46 deletions

View File

@@ -34,6 +34,6 @@ public class AuthorizedHostWrapperVO {
private Map<String, Set<Long>> treeNodes;
@Schema(description = "最近访问的主机")
private List<Long> latestHosts;
private Set<Long> latestHosts;
}

View File

@@ -209,7 +209,7 @@ public class AssetAuthorizedDataServiceImpl implements AssetAuthorizedDataServic
favoriteResult.get(),
dataAliasResult.get());
// 设置最近连接的主机
wrapper.setLatestHosts(latestConnectHostIdList.get());
wrapper.setLatestHosts(new LinkedHashSet<>(latestConnectHostIdList.get()));
return wrapper;
}

View File

@@ -27,7 +27,7 @@
</sql>
<select id="selectLatestConnectHostId" resultType="java.lang.Long">
SELECT DISTINCT host_id
SELECT host_id
FROM host_connect_log
WHERE deleted = 0
AND type = #{type}