java.lang.ClassCastException: java.util.ArrayList cannot be cast to com.github.miemiedev.mybatis.paginator.domain.PageList
在网上找了例子都是强转可以的。为什么本人这儿强转就报错。
spring配置文件
mapper文件
select * from liukai_emp
WHERE 1 = 1
and empId = #{empId}
and name = #{name}
and age = #{age}
and sal = #{sal}
and marry = #{marry}
mybatis配置文件
dao部分
public List queryEmpList(PageBounds pageBounds, Emp emp) {
List resultList = getSqlSession().selectList("emp.queryEmpList", emp, pageBounds);
//PageList list = (PageList) this.getSqlSession().selectList("emp.queryEmpList", emp, pageBounds);
//PageList list = new PageList(pageList);
//PaginationSupport resultList = new PaginationSupport(list.getPaginator(), list);
return resultList;
}
service部分 就是这儿强转报错
public PaginationSupport queryEmpList(Emp emp, Page page) {
PageBounds pageBounds = new PageBounds();
//System.out.println(page);
//System.out.println("--" + page.getCurrentPage());
pageBounds.setPage(1);
pageBounds.setLimit(5);
//PaginationSupport list = empDao.queryEmpList(pageBounds, emp);
List list = empDao.queryEmpList(pageBounds, emp);
PageList pageList = (PageList)list;
PaginationSupport resultList = new PaginationSupport(pageList.getPaginator(), pageList);
return resultList;
}