mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 01:28:24 +08:00
feat: 添加函数构建重载方法。
This commit is contained in:
parent
fc88826244
commit
9ef8d9994e
@ -2448,15 +2448,43 @@ public class QueryMethods {
|
|||||||
/**
|
/**
|
||||||
* IF 函数。
|
* IF 函数。
|
||||||
*/
|
*/
|
||||||
public static QueryColumn if_(QueryCondition condition, QueryColumn trueValue, QueryColumn falseValue) {
|
public static QueryColumn if_(QueryCondition condition, String trueColumn, String falseColumn) {
|
||||||
return new IfFunctionQueryColumn(condition, trueValue, falseValue);
|
return new IfFunctionQueryColumn(condition, new QueryColumn(trueColumn), new QueryColumn(falseColumn));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IF 函数。
|
||||||
|
*/
|
||||||
|
public static QueryColumn if_(QueryCondition condition, QueryColumn trueColumn, QueryColumn falseColumn) {
|
||||||
|
return new IfFunctionQueryColumn(condition, trueColumn, falseColumn);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IF 函数。
|
||||||
|
*/
|
||||||
|
public static <T, F> QueryColumn if_(QueryCondition condition, LambdaGetter<T> trueColumn, LambdaGetter<F> falseColumn) {
|
||||||
|
return new IfFunctionQueryColumn(condition, LambdaUtil.getQueryColumn(trueColumn), LambdaUtil.getQueryColumn(falseColumn));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IFNULL 函数。
|
* IFNULL 函数。
|
||||||
*/
|
*/
|
||||||
public static QueryColumn ifNull(QueryColumn nullValue, QueryColumn elseValue) {
|
public static QueryColumn ifNull(String nullColumn, String elseColumn) {
|
||||||
return new FunctionQueryColumn("IFNULL", nullValue, elseValue);
|
return new FunctionQueryColumn("IFNULL", new QueryColumn(nullColumn), new QueryColumn(elseColumn));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IFNULL 函数。
|
||||||
|
*/
|
||||||
|
public static QueryColumn ifNull(QueryColumn nullColumn, QueryColumn elseColumn) {
|
||||||
|
return new FunctionQueryColumn("IFNULL", nullColumn, elseColumn);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IFNULL 函数。
|
||||||
|
*/
|
||||||
|
public static <N, E> QueryColumn ifNull(LambdaGetter<N> nullColumn, LambdaGetter<E> elseColumn) {
|
||||||
|
return new FunctionQueryColumn("IFNULL", LambdaUtil.getQueryColumn(nullColumn), LambdaUtil.getQueryColumn(elseColumn));
|
||||||
}
|
}
|
||||||
|
|
||||||
// === 构建 QueryCondition 查询条件 ===
|
// === 构建 QueryCondition 查询条件 ===
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user