@Override
public PageInfo<Student> findByCriteria(Integer stuno, String name) {
PageHelper.startPage(2,2);
StudentExample example = new StudentExample();
StudentExample.Criteria criteria = example.createCriteria();
//设置查询大于传入学号的数据
criteria.andStunoGreaterThan(stuno);
criteria.andNameLike("%"+name+"%");
Page<Student> students = (Page<Student>) studentMapper.selectByExample(example);
PageInfo<Student> pageInfo = new PageInfo<Student>(students);
return pageInfo;
}
对于pageInfo的使用不能直接将
studentMapper.selectByExample(example)强转为pageinfo而是要先从list类型转成page类型再将page类型转换成pageinfo类型