use of com.github.pagehelper.model.Country in project Mybatis-PageHelper by pagehelper.
the class TestGroupBy method testGroupBy.
@Test
public void testGroupBy() {
SqlSession sqlSession = MybatisHelper.getSqlSession();
CountryMapper countryMapper = sqlSession.getMapper(CountryMapper.class);
try {
//获取第1页,10条内容,默认查询总数count
Page<Country> page = PageHelper.startPage(1, 10);
countryMapper.selectGroupBy();
//1,'Angola','AO'
assertEquals(1, page.get(0).getId());
assertEquals(10, page.size());
assertEquals(183, page.getTotal());
PageInfo<Country> pageInfo = page.toPageInfo();
System.out.println(pageInfo);
//获取第2页,10条内容,默认查询总数count
page = PageHelper.startPage(2, 10);
countryMapper.selectGroupBy();
//1,'Angola','AO'
assertEquals(1, page.get(0).getId());
assertEquals(10, page.size());
assertEquals(183, page.getTotal());
} finally {
sqlSession.close();
}
}
Aggregations