This commit is contained in:
Looly 2019-09-30 17:06:13 +08:00
parent d675b7376d
commit 3acf9c4e70

View File

@ -17,20 +17,22 @@ import cn.hutool.log.StaticLog;
*
*/
public class DbTest {
@Test
public void queryTest() throws SQLException {
List<Entity> find = Db.use().query("select * from user where age = ?", 18);
Assert.assertEquals("王五", find.get(0).get("name"));
}
@Test
public void findTest() throws SQLException {
Db.use();
List<Entity> find = Db.use().find(Entity.create("user").set("age", 18));
Assert.assertEquals("王五", find.get(0).get("name"));
}
@Test
public void findByTest() throws SQLException {
Db.use();
List<Entity> find = Db.use().findBy("user",
List<Entity> find = Db.use().findBy("user",
Condition.parse("age", "> 18"),
Condition.parse("age", "< 100")
);