|
|
@ -23,10 +23,12 @@ import org.springframework.data.domain.PageRequest;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import com.luoo.music.pojo.Journal;
|
|
|
|
import com.luoo.music.pojo.Journal;
|
|
|
|
import com.luoo.music.pojo.JournalSong;
|
|
|
|
import com.luoo.music.pojo.JournalSong;
|
|
|
|
|
|
|
|
import com.luoo.music.pojo.SongInfo;
|
|
|
|
import com.luoo.music.pojo.Tag;
|
|
|
|
import com.luoo.music.pojo.Tag;
|
|
|
|
import com.luoo.music.service.JournalService;
|
|
|
|
import com.luoo.music.service.JournalService;
|
|
|
|
import com.luoo.music.service.JournalSongService;
|
|
|
|
import com.luoo.music.service.JournalSongService;
|
|
|
|
import com.luoo.music.service.SearchService;
|
|
|
|
import com.luoo.music.service.SearchService;
|
|
|
|
|
|
|
|
import com.luoo.music.service.SongInfoService;
|
|
|
|
import com.luoo.music.service.TagService;
|
|
|
|
import com.luoo.music.service.TagService;
|
|
|
|
import annotation.GlobalInterceptor;
|
|
|
|
import annotation.GlobalInterceptor;
|
|
|
|
import annotation.VerifyParam;
|
|
|
|
import annotation.VerifyParam;
|
|
|
@ -50,7 +52,7 @@ public class SearchController {
|
|
|
|
private JournalService journalService;
|
|
|
|
private JournalService journalService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private JournalSongService journalSongService;
|
|
|
|
private SongInfoService songInfoService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private SearchService searchService;
|
|
|
|
private SearchService searchService;
|
|
|
@ -76,7 +78,7 @@ public class SearchController {
|
|
|
|
@VerifyParam(required = true) FuzzySearchReq query) throws InterruptedException, ExecutionException {
|
|
|
|
@VerifyParam(required = true) FuzzySearchReq query) throws InterruptedException, ExecutionException {
|
|
|
|
PageRequest pageRequest = PageRequest.of(getPageNum(query.getPageNum()), getPageSize(query.getPageSize()));
|
|
|
|
PageRequest pageRequest = PageRequest.of(getPageNum(query.getPageNum()), getPageSize(query.getPageSize()));
|
|
|
|
|
|
|
|
|
|
|
|
Page<JournalSong> pageResults=journalSongService.fuzzySearch(query.getKeyword(),pageRequest);
|
|
|
|
Page<SongInfo> pageResults=songInfoService.fuzzySearch(query.getKeyword(),pageRequest);
|
|
|
|
List<SongRespDTO> list = pageResults.stream().map(SongMapper::getSongRespDTO)
|
|
|
|
List<SongRespDTO> list = pageResults.stream().map(SongMapper::getSongRespDTO)
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
return Result.success(new PageResult<SongRespDTO>(Long.valueOf(list.size()), list));
|
|
|
|
return Result.success(new PageResult<SongRespDTO>(Long.valueOf(list.size()), list));
|
|
|
|