use of com.github.pagehelper.model.CountryExample in project Mybatis-PageHelper by pagehelper.
the class TestExample method testInList.
@Test
public void testInList() {
SqlSession sqlSession = MybatisHelper.getSqlSession();
CountryMapper countryMapper = sqlSession.getMapper(CountryMapper.class);
try {
CountryExample example = new CountryExample();
example.createCriteria().andIdIn(Arrays.asList(1, 2, 3, 4, 5));
PageHelper.startPage(1, 20);
List<Country> list = countryMapper.selectByExample(example);
assertEquals(1, list.get(0).getId());
assertEquals(5, list.size());
assertEquals(5, ((Page<?>) list).getTotal());
} finally {
sqlSession.close();
}
}
use of com.github.pagehelper.model.CountryExample in project Mybatis-PageHelper by pagehelper.
the class TestExample method testGreaterThan.
@Test
public void testGreaterThan() {
SqlSession sqlSession = MybatisHelper.getSqlSession();
CountryMapper countryMapper = sqlSession.getMapper(CountryMapper.class);
try {
CountryExample example = new CountryExample();
example.createCriteria().andIdGreaterThan(100);
PageHelper.startPage(1, 20);
List<Country> list = countryMapper.selectByExample(example);
assertEquals(101, list.get(0).getId());
assertEquals(20, list.size());
assertEquals(83, ((Page<?>) list).getTotal());
} finally {
sqlSession.close();
}
}
Aggregations