PageHelper提供了distinct方法来去重。
示例代码如下:
PageHelper.startPage(pageNum, pageSize); // 执行查询操作 List<User> userList = userMapper.selectUsers(); // 去重 PageInfo<User> pageInfo = new PageInfo<>(userList); List<User> distinctList = pageInfo.getList().stream().distinct().collect(Collectors.toList());  在代码中,首先使用PageHelper进行分页查询,然后将查询结果转为PageInfo对象,最后通过stream的distinct方法去重得到去重后的结果列表。