mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-08 16:57:09 +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 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";
|
||||
}
|
||||
},;
|
||||
|
||||
|
@@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user