Open SakuraFate opened 7 months ago
可能是管理端没有添加到数据库
前端没判空导致的,SearchSong.vue中,result.data为null
if (!result.data.length) {
currentSongList.value = [];
(proxy as any).$message({
message: "暂时没有相关歌曲",
type: "warning",
});
} else {
currentSongList.value = result.data;
}
后端在没查到音乐时,返回的是return R.error("添加失败,没有找到该歌,无法加入该歌单");
,导致data为null
public R songOfSingerName(String name) {
QueryWrapper<Song> queryWrapper = new QueryWrapper<>();
queryWrapper.like("name",name);
List<Song> songs = songMapper.selectList(queryWrapper);
if (songs.isEmpty()){
return R.error("添加失败,没有找到该歌,无法加入该歌单");
}
return R.success(null, songMapper.selectList(queryWrapper));
}