From 1fda200534318bc7d1c3e9af0cf2179944f22455 Mon Sep 17 00:00:00 2001 From: Gary Date: Sun, 28 Jan 2024 03:38:36 +0800 Subject: [PATCH] 1.fix collect empty issue --- .../main/java/com/luoo/music/controller/JournalController.java | 3 +++ .../main/java/com/luoo/music/controller/SongController.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/luoo_music/src/main/java/com/luoo/music/controller/JournalController.java b/luoo_music/src/main/java/com/luoo/music/controller/JournalController.java index 396e712..7392d2e 100644 --- a/luoo_music/src/main/java/com/luoo/music/controller/JournalController.java +++ b/luoo_music/src/main/java/com/luoo/music/controller/JournalController.java @@ -91,6 +91,9 @@ public class JournalController { @PathVariable @VerifyParam(required = true)Integer pageNum, @PathVariable @VerifyParam(required = true)Integer pageSize) { List objectIds=userCollectService.getCollectList(userId,pageNum,pageSize,CollectTypeEnum.JOURNAL); + if(objectIds.isEmpty()) { + return Result.success(new PageResult(0L, Collections.emptyList())); + } List
pageList = articleService.orderByField(objectIds); Set journalCollectSet = objectIds.isEmpty()?Collections.emptySet(): new HashSet<>(objectIds); List list = pageList.stream().map(a -> getJournalRespDTO(a, journalCollectSet)) diff --git a/luoo_music/src/main/java/com/luoo/music/controller/SongController.java b/luoo_music/src/main/java/com/luoo/music/controller/SongController.java index c4878b9..1135081 100644 --- a/luoo_music/src/main/java/com/luoo/music/controller/SongController.java +++ b/luoo_music/src/main/java/com/luoo/music/controller/SongController.java @@ -85,6 +85,9 @@ public class SongController { @PathVariable @VerifyParam(required = true) Integer pageNum, @PathVariable @VerifyParam(required = true) Integer pageSize) { List objectIds = userCollectService.getCollectList(userId, pageNum, pageSize, CollectTypeEnum.SONG); + if(objectIds.isEmpty()) { + return Result.success(new PageResult(0L, Collections.emptyList())); + } List songs = songService.orderByField(objectIds); Set songCollectSet = objectIds.isEmpty() ? Collections.emptySet() : new HashSet<>(objectIds);