java.util.Arrays$ArrayList cannot be cast to com.github.pagehelper.Page

 PageHelper.startPage(1, 10);
        List empList = empMapper.page(pageSeach.getName(),pageSeach.getGender(),pageSeach.getBegin(),pageSeach.getEnd());
   Page p = (Page) empList;
     
        //封装PageBean
        PageBean pageBean = new PageBean(p.getTotal(), p.getResult());
        return pageBean;

改成;

 Page objects = PageHelper.startPage(1, 10);
        List empList = empMapper.page(pageSeach.getName(),pageSeach.getGender(),pageSeach.getBegin(),pageSeach.getEnd());

         objects.addAll(empList);
   
        //封装PageBean
        PageBean pageBean = new PageBean(objects.getTotal(), objects.getResult());
        return pageBean;
 
  

如果还不成功
换版本


            com.github.pagehelper
            pagehelper-spring-boot-starter
            1.4.6
        

你可能感兴趣的:(java,java,开发语言)