diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 4c0716c2..853018ef 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -102,7 +102,7 @@ export default defineConfig({ "script", {}, ` - if (location.protocol !== 'https:') { + if (location.protocol !== 'https:' && location.hostname != 'localhost') { location.href = 'https://' + location.hostname + location.pathname + location.search; } ` diff --git a/docs/zh/querywrapper.md b/docs/zh/querywrapper.md index 0f9d7cb3..9d9e31b6 100644 --- a/docs/zh/querywrapper.md +++ b/docs/zh/querywrapper.md @@ -347,6 +347,25 @@ ON tb_account.id = a.id WHERE tb_account.age >= ? ``` +## union, union all + +```java +QueryWrapper query = new QueryWrapper() + .select(ACCOUNT.ID) + .from(ACCOUNT) + .orderBy(ACCOUNT.ID.desc()) + .union(select(ARTICLE.ID).from(ARTICLE)) + .unionAll(select(ARTICLE.ID).from(ARTICLE)); +``` + +其查询生成的 Sql 如下: + +```sql +(SELECT id FROM tb_account ORDER BY id DESC) +UNION (SELECT id FROM tb_article) +UNION ALL (SELECT id FROM tb_article) +``` + ## limit... offset diff --git a/mybatis-flex-core/src/test/java/com/mybatisflex/coretest/AccountSqlTester.java b/mybatis-flex-core/src/test/java/com/mybatisflex/coretest/AccountSqlTester.java index 86f73df5..feb821e9 100644 --- a/mybatis-flex-core/src/test/java/com/mybatisflex/coretest/AccountSqlTester.java +++ b/mybatis-flex-core/src/test/java/com/mybatisflex/coretest/AccountSqlTester.java @@ -83,6 +83,7 @@ public class AccountSqlTester { QueryWrapper query = new QueryWrapper() .select(ACCOUNT.ID) .from(ACCOUNT) + .orderBy(ACCOUNT.ID.desc()) .union(select(ARTICLE.ID).from(ARTICLE)) .unionAll(select(ARTICLE.ID).from(ARTICLE));