From f5ed040943695389e559087661bae25d9fcbe074 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 7 Jul 2024 09:31:27 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E5=85=A8=E5=B1=80=EF=BC=9A=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=20findInSet=20=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatis/core/enums/DbTypeEnum.java | 19 +++++++++++++++---- .../mybatis/core/util/MyBatisUtils.java | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/enums/DbTypeEnum.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/enums/DbTypeEnum.java index 3b55d783b..974986fca 100644 --- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/enums/DbTypeEnum.java +++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/enums/DbTypeEnum.java @@ -11,10 +11,13 @@ import java.util.Optional; import java.util.function.Function; import java.util.stream.Collectors; - +/** + * 针对 MyBatis Plus 的 {@link DbType} 增强,补充更多信息 + */ @Getter @AllArgsConstructor public enum DbTypeEnum { + /** * MySQL */ @@ -27,6 +30,8 @@ public enum DbTypeEnum { /** * PostgreSQL + * + * 华为 openGauss 使用 ProductName 与 PostgreSQL 相同 */ POSTGRE_SQL(DbType.POSTGRE_SQL,"PostgreSQL", "POSITION('#{value}' IN #{column}) <> 0"), @@ -44,8 +49,6 @@ public enum DbTypeEnum { * 人大金仓 */ KINGBASE_ES(DbType.KINGBASE_ES, "KingbaseES", "POSITION('#{value}' IN #{column}) <> 0"), - - // 华为openGauss 使用ProductName 与 PostgreSQL相同 ; public static final Map MAP_BY_NAME = Arrays.stream(values()) @@ -54,9 +57,17 @@ public enum DbTypeEnum { public static final Map MAP_BY_MP = Arrays.stream(values()) .collect(Collectors.toMap(DbTypeEnum::getMpDbType, Function.identity())); - + /** + * MyBatis Plus 类型 + */ private final DbType mpDbType; + /** + * 数据库产品名 + */ private final String productName; + /** + * SQL FIND_IN_SET 模板 + */ private final String findInSetTemplate; public static DbType find(String databaseProductName) { diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/util/MyBatisUtils.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/util/MyBatisUtils.java index 384b49d9a..611b71565 100644 --- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/util/MyBatisUtils.java +++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/util/MyBatisUtils.java @@ -102,4 +102,5 @@ public class MyBatisUtils { .replace("#{column}", column) .replace("#{value}", StrUtil.toString(value)); } + }