mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 01:28:24 +08:00
update docs
This commit is contained in:
parent
56c399725b
commit
d2c526bb39
@ -293,6 +293,7 @@ QueryWrapper queryWrapper=QueryWrapper.create()
|
|||||||
.where(ACCOUNT.AGE.ge(10));
|
.where(ACCOUNT.AGE.ge(10));
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
其查询生成的 Sql 如下:
|
其查询生成的 Sql 如下:
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
@ -302,6 +303,51 @@ INNER JOIN tb_article ON tb_account.id = tb_article.account_id
|
|||||||
WHERE tb_account.age >= ?
|
WHERE tb_account.age >= ?
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## join on 多个条件
|
||||||
|
|
||||||
|
```java
|
||||||
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
|
.select()
|
||||||
|
.from(ACCOUNT)
|
||||||
|
.leftJoin(ARTICLE).on(
|
||||||
|
ACCOUNT.ID.eq(ARTICLE.ACCOUNT_ID).and(ACCOUNT.AGE.eq(18))
|
||||||
|
)
|
||||||
|
.where(ACCOUNT.AGE.ge(10));
|
||||||
|
```
|
||||||
|
|
||||||
|
其查询生成的 Sql 如下:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT * FROM tb_account LEFT JOIN tb_article
|
||||||
|
ON tb_account.id = tb_article.account_id AND tb_account.age = ?
|
||||||
|
WHERE tb_account.age >= ?
|
||||||
|
```
|
||||||
|
|
||||||
|
## join select
|
||||||
|
|
||||||
|
```java
|
||||||
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
|
.select()
|
||||||
|
.from(ACCOUNT)
|
||||||
|
.leftJoin(
|
||||||
|
select().from(ARTICLE).where(ARTICLE.ID.ge(100))
|
||||||
|
).as("a").on(
|
||||||
|
ACCOUNT.ID.eq(raw("a.id"))
|
||||||
|
)
|
||||||
|
.where(ACCOUNT.AGE.ge(10));
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
其查询生成的 Sql 如下:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT * FROM tb_account
|
||||||
|
LEFT JOIN (SELECT * FROM tb_article WHERE id >= ? ) AS a
|
||||||
|
ON tb_account.id = a.id
|
||||||
|
WHERE tb_account.age >= ?
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## limit... offset
|
## limit... offset
|
||||||
|
|
||||||
::: tip 提示
|
::: tip 提示
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user