1.歌曲搜索传入特殊编码字符报错问题修复

This commit is contained in:
SongZhang 2024-07-19 16:17:01 +08:00
parent e52206e6d8
commit 4691fa8c31
1 changed files with 10 additions and 1 deletions

View File

@ -21,6 +21,8 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
@ -38,6 +40,7 @@ import java.util.*;
@Service
public class TbShopSongServiceImpl implements TbShopSongService{
private static final Logger log = LoggerFactory.getLogger(TbShopSongServiceImpl.class);
private final RedisTemplate<String, Object> redisTemplate;
private final TbShopSongOrderService shopSongOrderService;
@ -64,7 +67,13 @@ public class TbShopSongServiceImpl implements TbShopSongService{
@Override
public PageInfo<TbShopSong> all(Integer shopId, Integer page, Integer size, String keyWord, boolean isDesc) {
PageHelper.startPage(page, size);
List<TbShopSong> shopSongs = shopSongMapper.selectAllAndSearch(shopId, keyWord);
List<TbShopSong> shopSongs;
try {
shopSongs = shopSongMapper.selectAllAndSearch(shopId, keyWord);
}catch (Exception e) {
log.warn("查询歌曲列表出现异常", e);
shopSongs = new ArrayList<>();
}
return new PageInfo<>(shopSongs);
}