mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -19,4 +19,16 @@ public class SqlBuilderTest {
|
||||
SqlBuilder builder4 = SqlBuilder.create().select().from("user").where(LogicalOperator.AND, new Condition("name", "is not null"));
|
||||
Assert.assertEquals("SELECT * FROM user WHERE name IS NOT NULL", builder4.build());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void orderByTest(){
|
||||
SqlBuilder builder = SqlBuilder.create().select("id", "username").from("user")
|
||||
.join("role", SqlBuilder.Join.INNER)
|
||||
.on("user.id = role.user_id")
|
||||
.where(new Condition("age", ">=", 18),
|
||||
new Condition("username", "abc", Condition.LikeType.Contains)
|
||||
).orderBy(new Order("id"));
|
||||
|
||||
Assert.assertEquals("SELECT id,username FROM user INNER JOIN role ON user.id = role.user_id WHERE age >= ? AND username LIKE ? ORDER BY id", builder.build());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user