All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.aoju.bus.mapper.criteria.WeekendSqlCriteria Maven / Gradle / Ivy

/*********************************************************************************
 *                                                                               *
 * The MIT License (MIT)                                                         *
 *                                                                               *
 * Copyright (c) 2015-2022 aoju.org mybatis.io and other contributors.           *
 *                                                                               *
 * Permission is hereby granted, free of charge, to any person obtaining a copy  *
 * of this software and associated documentation files (the "Software"), to deal *
 * in the Software without restriction, including without limitation the rights  *
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell     *
 * copies of the Software, and to permit persons to whom the Software is         *
 * furnished to do so, subject to the following conditions:                      *
 *                                                                               *
 * The above copyright notice and this permission notice shall be included in    *
 * all copies or substantial portions of the Software.                           *
 *                                                                               *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR    *
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,      *
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE   *
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER        *
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN     *
 * THE SOFTWARE.                                                                 *
 *                                                                               *
 ********************************************************************************/
package org.aoju.bus.mapper.criteria;

import org.aoju.bus.core.lang.function.XFunction;
import org.aoju.bus.mapper.criteria.SqlCriteria.Criteria;
import org.aoju.bus.mapper.criteria.SqlCriteria.Criterion;
import org.aoju.bus.mapper.entity.SqlsCriteria;
import org.aoju.bus.mapper.reflect.Reflector;

/**
 * @author Kimi Liu
 * @since Java 17+
 */
public class WeekendSqlCriteria implements SqlsCriteria {

    private Criteria criteria;

    private WeekendSqlCriteria() {
        this.criteria = new SqlCriteria.Criteria();
    }

    public static  WeekendSqlCriteria custom() {
        return new WeekendSqlCriteria<>();
    }

    public WeekendSqlCriteria andIsNull(String property) {
        this.criteria.getCriterions().add(new Criterion(property, "is null", "and"));
        return this;
    }

    public WeekendSqlCriteria andIsNull(XFunction fn) {
        return this.andIsNull(Reflector.fnToFieldName(fn));
    }

    public WeekendSqlCriteria andIsNotNull(String property) {
        this.criteria.getCriterions().add(new Criterion(property, "is not null", "and"));
        return this;
    }

    public WeekendSqlCriteria andIsNotNull(XFunction fn) {
        return this.andIsNotNull(Reflector.fnToFieldName(fn));
    }

    public WeekendSqlCriteria andEqualTo(String property, Object value) {
        this.criteria.getCriterions().add(new Criterion(property, value, "=", "and"));
        return this;
    }

    public WeekendSqlCriteria andEqualTo(XFunction fn, Object value) {
        return this.andEqualTo(Reflector.fnToFieldName(fn), value);
    }

    public WeekendSqlCriteria andNotEqualTo(String property, Object value) {
        this.criteria.getCriterions().add(new Criterion(property, value, "<>", "and"));
        return this;
    }

    public WeekendSqlCriteria andNotEqualTo(XFunction fn, Object value) {
        return this.andNotEqualTo(Reflector.fnToFieldName(fn), value);
    }

    public WeekendSqlCriteria andGreaterThan(String property, Object value) {
        this.criteria.getCriterions().add(new Criterion(property, value, ">", "and"));
        return this;
    }

    public WeekendSqlCriteria andGreaterThan(XFunction fn, Object value) {
        return this.andGreaterThan(Reflector.fnToFieldName(fn), value);
    }

    public WeekendSqlCriteria andGreaterThanOrEqualTo(String property, Object value) {
        this.criteria.getCriterions().add(new Criterion(property, value, ">=", "and"));
        return this;
    }

    public WeekendSqlCriteria andGreaterThanOrEqualTo(XFunction fn, Object value) {
        return this.andGreaterThanOrEqualTo(Reflector.fnToFieldName(fn), value);
    }

    public WeekendSqlCriteria andLessThan(String property, Object value) {
        this.criteria.getCriterions().add(new Criterion(property, value, "<", "and"));
        return this;
    }

    public WeekendSqlCriteria andLessThan(XFunction fn, Object value) {
        return this.andLessThan(Reflector.fnToFieldName(fn), value);
    }

    public WeekendSqlCriteria andLessThanOrEqualTo(String property, Object value) {
        this.criteria.getCriterions().add(new Criterion(property, value, "<=", "and"));
        return this;
    }

    public WeekendSqlCriteria andLessThanOrEqualTo(XFunction fn, Object value) {
        return this.andLessThanOrEqualTo(Reflector.fnToFieldName(fn), value);
    }

    public WeekendSqlCriteria andIn(String property, Iterable values) {
        this.criteria.getCriterions().add(new Criterion(property, values, "in", "and"));
        return this;
    }

    public WeekendSqlCriteria andIn(XFunction fn, Iterable values) {
        return this.andIn(Reflector.fnToFieldName(fn), values);
    }

    public WeekendSqlCriteria andNotIn(String property, Iterable values) {
        this.criteria.getCriterions().add(new Criterion(property, values, "not in", "and"));
        return this;
    }

    public WeekendSqlCriteria andNotIn(XFunction fn, Iterable values) {
        return this.andNotIn(Reflector.fnToFieldName(fn), values);
    }

    public WeekendSqlCriteria andBetween(String property, Object value1, Object value2) {
        this.criteria.getCriterions().add(new Criterion(property, value1, value2, "between", "and"));
        return this;
    }

    public WeekendSqlCriteria andBetween(XFunction fn, Object value1, Object value2) {
        return this.andBetween(Reflector.fnToFieldName(fn), value1, value2);
    }

    public WeekendSqlCriteria andNotBetween(String property, Object value1, Object value2) {
        this.criteria.getCriterions().add(new Criterion(property, value1, value2, "not between", "and"));
        return this;
    }

    public WeekendSqlCriteria andNotBetween(XFunction fn, Object value1, Object value2) {
        return this.andNotBetween(Reflector.fnToFieldName(fn), value1, value2);
    }

    public WeekendSqlCriteria andLike(String property, String value) {
        this.criteria.getCriterions().add(new Criterion(property, value, "like", "and"));
        return this;
    }

    public WeekendSqlCriteria andLike(XFunction fn, String value) {
        return this.andLike(Reflector.fnToFieldName(fn), value);
    }

    public WeekendSqlCriteria andNotLike(String property, String value) {
        this.criteria.getCriterions().add(new Criterion(property, value, "not like", "and"));
        return this;
    }

    public WeekendSqlCriteria andNotLike(XFunction fn, String value) {
        return this.andNotLike(Reflector.fnToFieldName(fn), value);
    }

    public WeekendSqlCriteria orIsNull(String property) {
        this.criteria.getCriterions().add(new Criterion(property, "is null", "or"));
        return this;
    }

    public WeekendSqlCriteria orIsNull(XFunction fn) {
        return this.orIsNull(Reflector.fnToFieldName(fn));
    }

    public WeekendSqlCriteria orIsNotNull(String property) {
        this.criteria.getCriterions().add(new Criterion(property, "is not null", "or"));
        return this;
    }

    public WeekendSqlCriteria orIsNotNull(XFunction fn) {
        return this.orIsNotNull(Reflector.fnToFieldName(fn));
    }

    public WeekendSqlCriteria orEqualTo(String property, Object value) {
        this.criteria.getCriterions().add(new Criterion(property, value, "=", "or"));
        return this;
    }

    public WeekendSqlCriteria orEqualTo(XFunction fn, String value) {
        return this.orEqualTo(Reflector.fnToFieldName(fn), value);
    }

    public WeekendSqlCriteria orNotEqualTo(String property, Object value) {
        this.criteria.getCriterions().add(new Criterion(property, value, "<>", "or"));
        return this;
    }

    public WeekendSqlCriteria orNotEqualTo(XFunction fn, String value) {
        return this.orNotEqualTo(Reflector.fnToFieldName(fn), value);
    }

    public WeekendSqlCriteria orGreaterThan(String property, Object value) {
        this.criteria.getCriterions().add(new Criterion(property, value, ">", "or"));
        return this;
    }

    public WeekendSqlCriteria orGreaterThan(XFunction fn, String value) {
        return this.orGreaterThan(Reflector.fnToFieldName(fn), value);
    }

    public WeekendSqlCriteria orGreaterThanOrEqualTo(String property, Object value) {
        this.criteria.getCriterions().add(new Criterion(property, value, ">=", "or"));
        return this;
    }

    public WeekendSqlCriteria orGreaterThanOrEqualTo(XFunction fn, String value) {
        return this.orGreaterThanOrEqualTo(Reflector.fnToFieldName(fn), value);
    }

    public WeekendSqlCriteria orLessThan(String property, Object value) {
        this.criteria.getCriterions().add(new Criterion(property, value, "<", "or"));
        return this;
    }

    public WeekendSqlCriteria orLessThan(XFunction fn, String value) {
        return this.orLessThan(Reflector.fnToFieldName(fn), value);
    }

    public WeekendSqlCriteria orLessThanOrEqualTo(String property, Object value) {
        this.criteria.getCriterions().add(new Criterion(property, value, "<=", "or"));
        return this;
    }

    public WeekendSqlCriteria orLessThanOrEqualTo(XFunction fn, String value) {
        return this.orLessThanOrEqualTo(Reflector.fnToFieldName(fn), value);
    }

    public WeekendSqlCriteria orIn(String property, Iterable values) {
        this.criteria.getCriterions().add(new Criterion(property, values, "in", "or"));
        return this;
    }

    public WeekendSqlCriteria orIn(XFunction fn, Iterable values) {
        return this.orIn(Reflector.fnToFieldName(fn), values);
    }

    public WeekendSqlCriteria orNotIn(String property, Iterable values) {
        this.criteria.getCriterions().add(new Criterion(property, values, "not in", "or"));
        return this;
    }

    public WeekendSqlCriteria orNotIn(XFunction fn, Iterable values) {
        return this.orNotIn(Reflector.fnToFieldName(fn), values);
    }

    public WeekendSqlCriteria orBetween(String property, Object value1, Object value2) {
        this.criteria.getCriterions().add(new Criterion(property, value1, value2, "between", "or"));
        return this;
    }

    public WeekendSqlCriteria orBetween(XFunction fn, Object value1, Object value2) {
        return this.orBetween(Reflector.fnToFieldName(fn), value1, value2);
    }

    public WeekendSqlCriteria orNotBetween(String property, Object value1, Object value2) {
        this.criteria.getCriterions().add(new Criterion(property, value1, value2, "not between", "or"));
        return this;
    }

    public WeekendSqlCriteria orNotBetween(XFunction fn, Object value1, Object value2) {
        return this.orNotBetween(Reflector.fnToFieldName(fn), value1, value2);
    }

    public WeekendSqlCriteria orLike(String property, String value) {
        this.criteria.getCriterions().add(new Criterion(property, value, "like", "or"));
        return this;
    }

    public WeekendSqlCriteria orLike(XFunction fn, String value) {
        return this.orLike(Reflector.fnToFieldName(fn), value);
    }

    public WeekendSqlCriteria orNotLike(String property, String value) {
        this.criteria.getCriterions().add(new Criterion(property, value, "not like", "or"));
        return this;
    }

    public WeekendSqlCriteria orNotLike(XFunction fn, String value) {
        return this.orNotLike(Reflector.fnToFieldName(fn), value);
    }

    @Override
    public Criteria getCriteria() {
        return criteria;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy