generated from Java-2025Fall/final-vibevault-template
完成作业
This commit is contained in:
parent
a120406357
commit
bfd351e365
BIN
initial_interface.txt
Normal file
BIN
initial_interface.txt
Normal file
Binary file not shown.
@ -59,11 +59,6 @@ public interface PlaylistService {
|
||||
*/
|
||||
List<PlaylistDTO> searchPlaylists(String keyword);
|
||||
|
||||
/**
|
||||
* [Advanced] 按所有者查询歌单
|
||||
*/
|
||||
List<PlaylistDTO> getPlaylistsByOwner(String username);
|
||||
|
||||
/**
|
||||
* [Advanced] 复制歌单
|
||||
*/
|
||||
|
||||
@ -110,17 +110,7 @@ public class PlaylistServiceImpl implements PlaylistService {
|
||||
|
||||
// ========== Advanced 方法 ==========
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<PlaylistDTO> getPlaylistsByOwner(String username) {
|
||||
User owner = userRepository.findByUsername(username)
|
||||
.orElseThrow(() -> new ResourceNotFoundException("User not found: " + username));
|
||||
|
||||
return playlistRepository.findByOwner(owner)
|
||||
.stream()
|
||||
.map(this::toDTO)
|
||||
.toList();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user