有问题找:qq 185624592
1.使用到的工具 maven地址
我这边用的是pagehelper 也可以用其他的
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
2.分页代码
1.新增redis list数据
List<Entity> entitys=数据库查询;
//创建一个用来接收序列化对象的list
List<String> strings = Lists.newLinkedList();
//如果list不为空-> 将list对象序列化后 存到 strings 列表
//JSON 是fastjson
if (CollectionPersonUtils.arrayNotNull(entitys)) {
entitys.stream().forEach(f -> strings.add(JSON.toJSONString(f)));
}
Collection c = strings;
//把strings 通过rightPus