fix count bug

This commit is contained in:
Looly
2021-06-12 01:00:59 +08:00
parent 7dc5873d9e
commit d26feae36f
4 changed files with 27 additions and 2 deletions

View File

@@ -50,6 +50,17 @@ public class DbTest {
Assert.assertEquals(1, page1.size());
}
@Test
public void pageWithParamsTest() throws SQLException {
String sql = "select * from user where name = ?";
PageResult<Entity> result = Db.use().page(
sql, Page.of(0, 3), "张三");
Assert.assertEquals(2, result.getTotal());
Assert.assertEquals(1, result.getTotalPage());
Assert.assertEquals(2, result.size());
}
@Test
public void countTest() throws SQLException {
final long count = Db.use().count("select * from user");