From 6693cd49b93244b42dfadd4f4be28e526d764425 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Mon, 12 Aug 2024 23:55:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(data):=20=E7=A7=BB=E9=99=A4=20SQL=20?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E6=8E=A5=E5=8F=A3=E4=B8=AD=E7=9A=84=20SQL=20?= =?UTF-8?q?=E6=8B=BC=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../continew/starter/data/core/enums/DatabaseType.java | 10 ++++------ .../starter/data/core/function/ISqlFunction.java | 6 +----- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/continew-starter-data/continew-starter-data-core/src/main/java/top/continew/starter/data/core/enums/DatabaseType.java b/continew-starter-data/continew-starter-data-core/src/main/java/top/continew/starter/data/core/enums/DatabaseType.java index 3c8100f1..bc66f545 100644 --- a/continew-starter-data/continew-starter-data-core/src/main/java/top/continew/starter/data/core/enums/DatabaseType.java +++ b/continew-starter-data/continew-starter-data-core/src/main/java/top/continew/starter/data/core/enums/DatabaseType.java @@ -18,8 +18,6 @@ package top.continew.starter.data.core.enums; import top.continew.starter.data.core.function.ISqlFunction; -import java.io.Serializable; - /** * 数据库类型枚举 * @@ -33,8 +31,8 @@ public enum DatabaseType implements ISqlFunction { */ MYSQL("MySQL") { @Override - public String findInSet(Serializable value, String set) { - return "find_in_set('%s', %s) <> 0".formatted(value, set); + public String findInSet() { + return "find_in_set({0}, {1}) <> 0"; } }, @@ -43,8 +41,8 @@ public enum DatabaseType implements ISqlFunction { */ POSTGRE_SQL("PostgreSQL") { @Override - public String findInSet(Serializable value, String set) { - return "(select position(',%s,' in ','||%s||',')) <> 0".formatted(value, set); + public String findInSet() { + return "(select position(',{0},' in ','||{1}||',')) <> 0"; } },; diff --git a/continew-starter-data/continew-starter-data-core/src/main/java/top/continew/starter/data/core/function/ISqlFunction.java b/continew-starter-data/continew-starter-data-core/src/main/java/top/continew/starter/data/core/function/ISqlFunction.java index 9f96cc49..c0eb67da 100644 --- a/continew-starter-data/continew-starter-data-core/src/main/java/top/continew/starter/data/core/function/ISqlFunction.java +++ b/continew-starter-data/continew-starter-data-core/src/main/java/top/continew/starter/data/core/function/ISqlFunction.java @@ -16,8 +16,6 @@ package top.continew.starter.data.core.function; -import java.io.Serializable; - /** * SQL 函数接口 * @@ -29,9 +27,7 @@ public interface ISqlFunction { /** * find_in_set 函数 * - * @param value 值 - * @param set 集合 * @return 函数实现 */ - String findInSet(Serializable value, String set); + String findInSet(); }