mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-09 19:03:56 +08:00
fix(data): 移除 SQL 函数接口中的 SQL 拼接
This commit is contained in:
@@ -18,8 +18,6 @@ package top.continew.starter.data.core.enums;
|
|||||||
|
|
||||||
import top.continew.starter.data.core.function.ISqlFunction;
|
import top.continew.starter.data.core.function.ISqlFunction;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据库类型枚举
|
* 数据库类型枚举
|
||||||
*
|
*
|
||||||
@@ -33,8 +31,8 @@ public enum DatabaseType implements ISqlFunction {
|
|||||||
*/
|
*/
|
||||||
MYSQL("MySQL") {
|
MYSQL("MySQL") {
|
||||||
@Override
|
@Override
|
||||||
public String findInSet(Serializable value, String set) {
|
public String findInSet() {
|
||||||
return "find_in_set('%s', %s) <> 0".formatted(value, set);
|
return "find_in_set({0}, {1}) <> 0";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -43,8 +41,8 @@ public enum DatabaseType implements ISqlFunction {
|
|||||||
*/
|
*/
|
||||||
POSTGRE_SQL("PostgreSQL") {
|
POSTGRE_SQL("PostgreSQL") {
|
||||||
@Override
|
@Override
|
||||||
public String findInSet(Serializable value, String set) {
|
public String findInSet() {
|
||||||
return "(select position(',%s,' in ','||%s||',')) <> 0".formatted(value, set);
|
return "(select position(',{0},' in ','||{1}||',')) <> 0";
|
||||||
}
|
}
|
||||||
},;
|
},;
|
||||||
|
|
||||||
|
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package top.continew.starter.data.core.function;
|
package top.continew.starter.data.core.function;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SQL 函数接口
|
* SQL 函数接口
|
||||||
*
|
*
|
||||||
@@ -29,9 +27,7 @@ public interface ISqlFunction {
|
|||||||
/**
|
/**
|
||||||
* find_in_set 函数
|
* find_in_set 函数
|
||||||
*
|
*
|
||||||
* @param value 值
|
|
||||||
* @param set 集合
|
|
||||||
* @return 函数实现
|
* @return 函数实现
|
||||||
*/
|
*/
|
||||||
String findInSet(Serializable value, String set);
|
String findInSet();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user