在mvc项目中弄分页弄不了,弄了几天了
<plugins>
<plugin interceptor="com.github.pagehelper.PageInterceptor">
<property name="reasonable" value="true"/>
<property name="helperDialect" value="mysql"/>
</plugin>
</plugins>
@Test
public void testPageHelper(){
PageHelper.startPage(1,3);
List<Medicine> medicineList = medicineMapper.findMedicineList();
PageInfo<Medicine> pageInfo = new PageInfo<>(medicineList);
System.out.println("总页数为"+pageInfo.getPages());
}
是应该把配置的东西配置到spring的配置文件中,是我配置错地方了,搞了几天
不要用什么@Test去测试代码,老老实实写controller去访问接口
需要把PageInterceptor配置到SqlSessionFactory配置中