add page of sql support

This commit is contained in:
Looly
2020-12-06 07:41:54 +08:00
parent 897dea0b30
commit 36588f7e07
23 changed files with 711 additions and 451 deletions

View File

@@ -37,6 +37,25 @@ public class DbTest {
Assert.assertEquals(1, page1.size());
}
@Test
public void pageTest2() throws SQLException {
String sql = "select * from user";
// 测试数据库中一共4条数据第0页有3条第1页有1条
List<Entity> page0 = Db.use().page(
sql, Page.of(0, 3));
Assert.assertEquals(3, page0.size());
List<Entity> page1 = Db.use().page(
sql, Page.of(1, 3));
Assert.assertEquals(1, page1.size());
}
@Test
public void countTest() throws SQLException {
final long count = Db.use().count("select * from user");
Assert.assertEquals(4, count);
}
@Test
public void findLikeTest() throws SQLException {
// 方式1