mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
test: 测试 Model toSql() 方法。
This commit is contained in:
parent
53f6bcda6a
commit
0f9dbc1742
@ -156,4 +156,18 @@ class ActiveRecordTest {
|
|||||||
.forEach(System.out::println);
|
.forEach(System.out::println);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testToSql() {
|
||||||
|
String sql = User.create()
|
||||||
|
.as("u")
|
||||||
|
.select(USER.ALL_COLUMNS, ROLE.ALL_COLUMNS)
|
||||||
|
.leftJoin(USER_ROLE).as("ur").on(USER_ROLE.USER_ID.eq(USER.USER_ID))
|
||||||
|
.leftJoin(ROLE).as("r").on(USER_ROLE.ROLE_ID.eq(ROLE.ROLE_ID))
|
||||||
|
.where(USER.USER_ID.eq(2))
|
||||||
|
.toQueryWrapper()
|
||||||
|
.toSQL();
|
||||||
|
|
||||||
|
System.out.println(sql);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user