This commit is contained in:
张良(004796)
2024-03-15 17:02:47 +08:00
parent 00e5cfb288
commit 224f17d404
5 changed files with 9 additions and 5 deletions

View File

@@ -18,6 +18,7 @@ import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -93,6 +94,9 @@ public class HomeManager {
Collections.shuffle(vos);
Integer pageNum = pageQuery.getPageNum();
int startIndex = (pageNum - 1) * pageQuery.getPageSize();
if(startIndex > vos.size()){
return Collections.emptyList();
}
int endIndex = Math.min(startIndex+pageQuery.getPageSize(), vos.size());
return vos.subList(startIndex, endIndex);
}