fix(data): 移除 SQL 函数接口中的 SQL 拼接

This commit is contained in:
2024-08-12 23:55:34 +08:00
parent b9f106572a
commit 6693cd49b9
2 changed files with 5 additions and 11 deletions

View File

@@ -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";
}
},;

View File

@@ -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();
}