时间区间查询 betweenIfPresent 支持传入数组

This commit is contained in:
xingyu 2022-07-21 23:16:48 +08:00
parent f2d7500822
commit c7a64fc8b4

View File

@ -94,6 +94,19 @@ public class QueryWrapperX<T> extends QueryWrapper<T> {
return this; return this;
} }
public QueryWrapperX<T> betweenIfPresent(String column, Object[] values) {
if (values!= null && values[0] != null && values[1] != null) {
return (QueryWrapperX<T>) super.between(column, values[0], values[1]);
}
if (values!= null && values[0] != null) {
return (QueryWrapperX<T>) ge(column, values[0]);
}
if (values!= null && values[1] != null) {
return (QueryWrapperX<T>) le(column, values[1]);
}
return this;
}
// ========== 重写父类方法方便链式调用 ========== // ========== 重写父类方法方便链式调用 ==========
@Override @Override