refactor(agent): 优化收藏功能代码实现
- 前端移除未使用的 ArrowRightOutlined 导入 - 优化智能体列表排序逻辑,避免修改原数组 - 后端使用 Stream API 简化收藏智能体 ID 获取逻辑
This commit is contained in:
@@ -55,11 +55,9 @@ public class AiAgentFavoriteServiceImpl implements AiAgentFavoriteService {
|
||||
@Override
|
||||
public Set<Long> getFavoriteAgentIds(Long userId) {
|
||||
List<AiAgentFavoriteDO> favorites = aiAgentFavoriteMapper.selectListByUserId(userId);
|
||||
Set<Long> agentIds = new HashSet<>();
|
||||
for (AiAgentFavoriteDO favorite : favorites) {
|
||||
agentIds.add(favorite.getAgentId());
|
||||
}
|
||||
return agentIds;
|
||||
return favorites.stream()
|
||||
.map(AiAgentFavoriteDO::getAgentId)
|
||||
.collect(java.util.stream.Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user