com.yuehuanghun.mybatis.milu.criteria.LambdaQueryPredicateImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mybatis-milu Show documentation
Show all versions of mybatis-milu Show documentation
A mybatis orm enhance framework.
/*
* Copyright 2020-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yuehuanghun.mybatis.milu.criteria;
import java.util.function.Consumer;
import javax.persistence.LockModeType;
import com.yuehuanghun.mybatis.milu.annotation.JoinMode;
import com.yuehuanghun.mybatis.milu.annotation.Mode;
import com.yuehuanghun.mybatis.milu.criteria.lambda.LambdaReflections;
import com.yuehuanghun.mybatis.milu.criteria.lambda.SerializableFunction;
import com.yuehuanghun.mybatis.milu.data.Sort.Direction;
import com.yuehuanghun.mybatis.milu.data.Sort;
import com.yuehuanghun.mybatis.milu.pagehelper.Pageable;
import lombok.Getter;
public class LambdaQueryPredicateImpl extends LambdaPredicateImpl implements LambdaQueryPredicate {
@Getter
private QueryPredicateImpl delegate = new QueryPredicateImpl();
@SuppressWarnings("unchecked")
@Override
public LambdaQueryPredicate select(SerializableFunction... getterFns) {
String[] attrNames = new String[getterFns.length];
for (int i = 0; i < getterFns.length; i++) {
attrNames[i] = LambdaReflections.fnToFieldName(getterFns[i]);
}
getDelegate().select(attrNames);
return this;
}
@Override
public LambdaQueryPredicate selects(String attrNameChain) {
getDelegate().selects(attrNameChain);
return this;
}
@SuppressWarnings("unchecked")
@Override
public LambdaQueryPredicate exselect(SerializableFunction... getterFns) {
String[] attrNames = new String[getterFns.length];
for (int i = 0; i < getterFns.length; i++) {
attrNames[i] = LambdaReflections.fnToFieldName(getterFns[i]);
}
getDelegate().exselect(attrNames);
return this;
}
@Override
public LambdaQueryPredicate exselects(String attrNameChain) {
getDelegate().exselects(attrNameChain);
return this;
}
@SuppressWarnings("unchecked")
@Override
public LambdaQueryPredicate order(SerializableFunction... getterFns) {
this.order(null, getterFns);
return this;
}
@Override
public LambdaQueryPredicate order(Direction direction, SerializableFunction getterFn) {
getDelegate().order(direction, LambdaReflections.fnToFieldName(getterFn));
return this;
}
@SuppressWarnings("unchecked")
@Override
public LambdaQueryPredicate order(Direction direction, SerializableFunction... getterFns) {
String[] attrNames = new String[getterFns.length];
for (int i = 0; i < getterFns.length; i++) {
SerializableFunction getterFn = getterFns[i];
attrNames[i] = LambdaReflections.fnToFieldName(getterFn);
}
getDelegate().order(direction, attrNames);
return this;
}
@Override
public LambdaQueryPredicate order(Sort sort) {
getDelegate().order(sort);
return this;
}
@Override
public LambdaQueryPredicate orderAsc(SerializableFunction getterFn) {
this.order(Direction.ASC, getterFn);
return this;
}
@SuppressWarnings("unchecked")
@Override
public LambdaQueryPredicate orderAsc(SerializableFunction... getterFns) {
this.order(Direction.ASC, getterFns);
return this;
}
@Override
public LambdaQueryPredicate orderDesc(SerializableFunction getterFn) {
this.order(Direction.DESC, getterFn);
return this;
}
@SuppressWarnings("unchecked")
@Override
public LambdaQueryPredicate orderDesc(SerializableFunction... getterFns) {
this.order(Direction.DESC, getterFns);
return this;
}
@Override
public LambdaQueryPredicate limit(int pageSize) {
getDelegate().limit(pageSize);
return this;
}
@Override
public LambdaQueryPredicate limit(int pageSize, boolean count) {
getDelegate().limit(pageSize, count);
return this;
}
@Override
public LambdaQueryPredicate limit(int pageNum, int pageSize) {
getDelegate().limit(pageNum, pageSize);
return this;
}
@Override
public LambdaQueryPredicate limit(int pageNum, int pageSize, boolean count) {
getDelegate().limit(pageNum, pageSize, count);
return this;
}
@Override
public LambdaQueryPredicate limit(Pageable page) {
getDelegate().limit(page);
return this;
}
@Override
public LambdaQueryPredicate apply(T entity) {
super.apply(entity);
return this;
}
@Override
public LambdaQueryPredicate conditionMode(Mode conditionMode) {
super.conditionMode(conditionMode);
return this;
}
@Override
public LambdaQueryPredicate and(Condition... conditions) {
super.and(conditions);
return this;
}
@Override
public LambdaQueryPredicate and(Consumer> predicate) {
super.and(predicate);
return this;
}
@Override
public LambdaQueryPredicate andP(Consumer predicate) {
super.andP(predicate);
return this;
}
@Override
public LambdaQueryPredicate or(Condition... conditions) {
super.or(conditions);
return this;
}
@Override
public LambdaQueryPredicate or(Consumer> predicate) {
super.or(predicate);
return this;
}
@Override
public LambdaQueryPredicate orP(Consumer predicate) {
super.orP(predicate);
return this;
}
@Override
public LambdaQueryPredicate not(Condition... conditions) {
super.not(conditions);
return this;
}
@Override
public LambdaQueryPredicate not(Consumer> predicate) {
super.not(predicate);
return this;
}
@Override
public LambdaQueryPredicate notP(Consumer predicate) {
super.notP(predicate);
return this;
}
@Override
public LambdaQueryPredicate eq(SerializableFunction getterFn) {
super.eq(getterFn);
return this;
}
@Override
public LambdaQueryPredicate eq(boolean accept, SerializableFunction getterFn) {
super.eq(accept, getterFn);
return this;
}
@Override
public LambdaQueryPredicate neq(SerializableFunction getterFn) {
super.neq(getterFn);
return this;
}
@Override
public LambdaQueryPredicate neq(boolean accept, SerializableFunction getterFn) {
super.neq(accept, getterFn);
return this;
}
@Override
public LambdaQueryPredicate lt(SerializableFunction getterFn) {
super.lt(getterFn);
return this;
}
@Override
public LambdaQueryPredicate lt(boolean accept, SerializableFunction getterFn) {
super.lt(accept, getterFn);
return this;
}
@Override
public LambdaQueryPredicate lte(SerializableFunction getterFn) {
super.lte(getterFn);
return this;
}
@Override
public LambdaQueryPredicate lte(boolean accept, SerializableFunction getterFn) {
super.lte(accept, getterFn);
return this;
}
@Override
public LambdaQueryPredicate gt(SerializableFunction getterFn) {
super.gt(getterFn);
return this;
}
@Override
public LambdaQueryPredicate gt(boolean accept, SerializableFunction getterFn) {
super.gt(accept, getterFn);
return this;
}
@Override
public LambdaQueryPredicate gte(SerializableFunction getterFn) {
super.gte(getterFn);
return this;
}
@Override
public LambdaQueryPredicate gte(boolean accept, SerializableFunction getterFn) {
super.gte(accept, getterFn);
return this;
}
@Override
public LambdaQueryPredicate like(SerializableFunction getterFn) {
super.like(getterFn);
return this;
}
@Override
public LambdaQueryPredicate like(boolean accept, SerializableFunction getterFn) {
super.like(accept, getterFn);
return this;
}
@Override
public LambdaQueryPredicate notLike(SerializableFunction getterFn) {
super.notLike(getterFn);
return this;
}
@Override
public LambdaQueryPredicate notLike(boolean accept, SerializableFunction getterFn) {
super.notLike(accept, getterFn);
return this;
}
@Override
public LambdaQueryPredicate contain(SerializableFunction getterFn) {
super.contain(getterFn);
return this;
}
@Override
public LambdaQueryPredicate contain(boolean accept, SerializableFunction getterFn) {
super.contain(accept, getterFn);
return this;
}
@Override
public LambdaQueryPredicate notContain(SerializableFunction getterFn) {
super.notContain(getterFn);
return this;
}
@Override
public LambdaQueryPredicate notContain(boolean accept, SerializableFunction getterFn) {
super.notContain(accept, getterFn);
return this;
}
@Override
public LambdaQueryPredicate startWith(SerializableFunction getterFn) {
super.startWith(getterFn);
return this;
}
@Override
public LambdaQueryPredicate startWith(boolean accept, SerializableFunction getterFn) {
super.startWith(accept, getterFn);
return this;
}
@Override
public LambdaQueryPredicate endWith(SerializableFunction getterFn) {
super.endWith(getterFn);
return this;
}
@Override
public LambdaQueryPredicate endWith(boolean accept, SerializableFunction getterFn) {
super.endWith(accept, getterFn);
return this;
}
@Override
public LambdaQueryPredicate between(SerializableFunction getterFn, Object startValue, Object endValue) {
super.between(getterFn, startValue, endValue);
return this;
}
@Override
public LambdaQueryPredicate between(boolean accept, SerializableFunction getterFn, Object startValue,
Object endValue) {
super.between(accept, getterFn, startValue, endValue);
return this;
}
@Override
public LambdaQueryPredicate isNull(SerializableFunction getterFn) {
super.isNull(getterFn);
return this;
}
@Override
public LambdaQueryPredicate isNull(boolean accept, SerializableFunction getterFn) {
super.isNull(accept, getterFn);
return this;
}
@Override
public LambdaQueryPredicate notNull(SerializableFunction getterFn) {
super.notNull(getterFn);
return this;
}
@Override
public LambdaQueryPredicate notNull(boolean accept, SerializableFunction getterFn) {
super.notNull(accept, getterFn);
return this;
}
@Override
public LambdaQueryPredicate in(SerializableFunction getterFn) {
super.in(getterFn);
return this;
}
@Override
public LambdaQueryPredicate in(boolean accept, SerializableFunction getterFn) {
super.in(accept, getterFn);
return this;
}
@Override
public LambdaQueryPredicate notIn(SerializableFunction getterFn) {
super.notIn(getterFn);
return this;
}
@Override
public LambdaQueryPredicate notIn(boolean accept, SerializableFunction getterFn) {
super.notIn(accept, getterFn);
return this;
}
@Override
public LambdaQueryPredicate eq(SerializableFunction getterFn, Object value) {
super.eq(getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate eq(boolean accept, SerializableFunction getterFn, Object value) {
super.eq(accept, getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate neq(SerializableFunction getterFn, Object value) {
super.neq(getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate neq(boolean accept, SerializableFunction getterFn, Object value) {
super.neq(accept, getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate lt(SerializableFunction getterFn, Object value) {
super.lt(getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate lt(boolean accept, SerializableFunction getterFn, Object value) {
super.lt(accept, getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate lte(SerializableFunction getterFn, Object value) {
super.lte(getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate lte(boolean accept, SerializableFunction getterFn, Object value) {
super.lte(accept, getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate gt(SerializableFunction getterFn, Object value) {
super.gt(getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate gt(boolean accept, SerializableFunction getterFn, Object value) {
super.gt(accept, getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate gte(SerializableFunction getterFn, Object value) {
super.gte(getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate gte(boolean accept, SerializableFunction getterFn, Object value) {
super.gte(accept, getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate like(SerializableFunction getterFn, Object value) {
super.like(getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate like(boolean accept, SerializableFunction getterFn, Object value) {
super.like(accept, getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate notLike(SerializableFunction getterFn, Object value) {
super.notLike(getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate notLike(boolean accept, SerializableFunction getterFn, Object value) {
super.notLike(accept, getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate contain(SerializableFunction getterFn, Object value) {
super.contain(getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate contain(boolean accept, SerializableFunction getterFn, Object value) {
super.contain(accept, getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate notContain(SerializableFunction getterFn, Object value) {
super.notContain(getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate notContain(boolean accept, SerializableFunction getterFn, Object value) {
super.notContain(accept, getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate startWith(SerializableFunction getterFn, Object value) {
super.startWith(getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate startWith(boolean accept, SerializableFunction getterFn, Object value) {
super.startWith(accept, getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate endWith(SerializableFunction getterFn, Object value) {
super.endWith(getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate endWith(boolean accept, SerializableFunction getterFn, Object value) {
super.endWith(accept, getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate in(SerializableFunction getterFn, Object value) {
super.in(getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate in(boolean accept, SerializableFunction getterFn, Object value) {
super.in(accept, getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate notIn(SerializableFunction getterFn, Object value) {
super.notIn(getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate notIn(boolean accept, SerializableFunction getterFn, Object value) {
super.notIn(accept, getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate regex(SerializableFunction getterFn, Object value) {
super.regex(getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate regex(boolean accept, SerializableFunction getterFn, Object value) {
super.regex(accept, getterFn, value);
return this;
}
@Override
public LambdaQueryPredicate undeleted() {
getDelegate().undeleted();
return this;
}
@Override
public LambdaQueryPredicate deleted() {
getDelegate().deleted();
return this;
}
@Override
public LambdaQueryPredicate distinct() {
getDelegate().distinct();
return this;
}
@Override
public LambdaQueryPredicate lock(LockModeType lockModeType) {
getDelegate().lock(lockModeType);
return this;
}
@Override
public LambdaQueryPredicate lock() {
getDelegate().lock();
return this;
}
@Override
public LambdaQueryPredicate joinMode(JoinMode joinMode) {
getDelegate().joinMode(joinMode);
return this;
}
@Override
public LambdaQueryPredicate joinMode(SerializableFunction refGetterFn, JoinMode joinMode) {
getDelegate().joinMode(LambdaReflections.fnToFieldName(refGetterFn), joinMode);
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy