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

cn.vonce.sql.bean.Condition Maven / Gradle / Ivy

The newest version!
package cn.vonce.sql.bean;

import cn.vonce.sql.define.ColumnFun;
import cn.vonce.sql.enumerate.SqlLogic;
import cn.vonce.sql.enumerate.SqlOperator;
import cn.vonce.sql.uitls.LambdaUtil;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 简单的条件
 *
 * @author Jovi
 * @version 1.0
 * @email [email protected]
 * @date 2022年3月15日上午10:00:10
 */
public class Condition implements Serializable {

    private Action action;
    private SqlLogic sqlLogic;
    private Logic logic = new Logic(this);
    private List dataList = new ArrayList<>();

    public Condition() {
    }

    protected Condition(Action action) {
        this.action = action;
    }

    protected Action getAction() {
        return action;
    }

    protected SqlLogic getSqlLogic() {
        return sqlLogic;
    }

    protected void setSqlLogic(SqlLogic sqlLogic) {
        this.sqlLogic = sqlLogic;
    }

    /**
     * 获得条件模型列表
     *
     * @return
     */
    public List getDataList() {
        return this.dataList;
    }

    /**
     * 设置条件模型列表
     *
     * @param dataList
     */
    public void setDataList(List dataList) {
        this.dataList = dataList;
    }

    /**
     * 等于
     *
     * @param field
     * @param value
     * @return
     */
    public Logic eq(String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(null, field, SqlOperator.EQUAL_TO, value)));
        return logic;
    }

    /**
     * 等于
     *
     * @param tableAlias
     * @param field
     * @param value
     * @return
     */
    public Logic eq(String tableAlias, String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(tableAlias, field, SqlOperator.EQUAL_TO, value)));
        return logic;
    }

    /**
     * 等于
     *
     * @param column
     * @param value
     * @return
     */
    public Logic eq(Column column, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(column, SqlOperator.EQUAL_TO, value)));
        return logic;
    }

    /**
     * 等于
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic eq(ColumnFun columnFun, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.EQUAL_TO, value)));
        return logic;
    }

    /**
     * 等于
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic eq(ColumnFun columnFun, ColumnFun value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.EQUAL_TO, value)));
        return logic;
    }

    /**
     * 不等于
     *
     * @param field
     * @param value
     * @return
     */
    public Logic notEq(String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(null, field, SqlOperator.NOT_EQUAL_TO, value)));
        return logic;
    }

    /**
     * 不等于
     *
     * @param tableAlias
     * @param field
     * @param value
     * @return
     */
    public Logic notEq(String tableAlias, String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(tableAlias, field, SqlOperator.NOT_EQUAL_TO, value)));
        return logic;
    }

    /**
     * 不等于
     *
     * @param column
     * @param value
     * @return
     */
    public Logic notEq(Column column, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(column, SqlOperator.NOT_EQUAL_TO, value)));
        return logic;
    }

    /**
     * 不等于
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic notEq(ColumnFun columnFun, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.NOT_EQUAL_TO, value)));
        return logic;
    }

    /**
     * 不等于
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic notEq(ColumnFun columnFun, ColumnFun value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.NOT_EQUAL_TO, value)));
        return logic;
    }

    /**
     * 小于
     *
     * @param field
     * @param value
     * @return
     */
    public Logic lt(String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(null, field, SqlOperator.LESS_THAN, value)));
        return logic;
    }

    /**
     * 小于
     *
     * @param tableAlias
     * @param field
     * @param value
     * @return
     */
    public Logic lt(String tableAlias, String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(tableAlias, field, SqlOperator.LESS_THAN, value)));
        return logic;
    }

    /**
     * 小于
     *
     * @param column
     * @param value
     * @return
     */
    public Logic lt(Column column, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(column, SqlOperator.LESS_THAN, value)));
        return logic;
    }

    /**
     * 小于
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic lt(ColumnFun columnFun, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.LESS_THAN, value)));
        return logic;
    }

    /**
     * 小于
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic lt(ColumnFun columnFun, ColumnFun value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.LESS_THAN, value)));
        return logic;
    }

    /**
     * 大于
     *
     * @param field
     * @param value
     * @return
     */
    public Logic gt(String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(null, field, SqlOperator.GREATER_THAN, value)));
        return logic;
    }

    /**
     * 大于
     *
     * @param tableAlias
     * @param field
     * @param value
     * @return
     */
    public Logic gt(String tableAlias, String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(tableAlias, field, SqlOperator.GREATER_THAN, value)));
        return logic;
    }

    /**
     * 大于
     *
     * @param column
     * @param value
     * @return
     */
    public Logic gt(Column column, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(column, SqlOperator.GREATER_THAN, value)));
        return logic;
    }

    /**
     * 大于
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic gt(ColumnFun columnFun, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.GREATER_THAN, value)));
        return logic;
    }

    /**
     * 大于
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic gt(ColumnFun columnFun, ColumnFun value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.GREATER_THAN, value)));
        return logic;
    }

    /**
     * 小于等于
     *
     * @param field
     * @param value
     * @return
     */
    public Logic ltEq(String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(null, field, SqlOperator.LESS_THAN_OR_EQUAL_TO, value)));
        return logic;
    }

    /**
     * 小于等于
     *
     * @param tableAlias
     * @param field
     * @param value
     * @return
     */
    public Logic ltEq(String tableAlias, String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(tableAlias, field, SqlOperator.LESS_THAN_OR_EQUAL_TO, value)));
        return logic;
    }


    /**
     * 小于等于
     *
     * @param column
     * @param value
     * @return
     */
    public Logic ltEq(Column column, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(column, SqlOperator.LESS_THAN_OR_EQUAL_TO, value)));
        return logic;
    }

    /**
     * 小于等于
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic ltEq(ColumnFun columnFun, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.LESS_THAN_OR_EQUAL_TO, value)));
        return logic;
    }

    /**
     * 小于等于
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic ltEq(ColumnFun columnFun, ColumnFun value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.LESS_THAN_OR_EQUAL_TO, value)));
        return logic;
    }

    /**
     * 大于等于
     *
     * @param field
     * @param value
     * @return
     */
    public Logic gtEq(String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(null, field, SqlOperator.GREAT_THAN_OR_EQUAL_TO, value)));
        return logic;
    }

    /**
     * 大于等于
     *
     * @param tableAlias
     * @param field
     * @param value
     * @return
     */
    public Logic gtEq(String tableAlias, String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(tableAlias, field, SqlOperator.GREAT_THAN_OR_EQUAL_TO, value)));
        return logic;
    }

    /**
     * 大于等于
     *
     * @param column
     * @param value
     * @return
     */
    public Logic gtEq(Column column, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(column, SqlOperator.GREAT_THAN_OR_EQUAL_TO, value)));
        return logic;
    }

    /**
     * 大于等于
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic gtEq(ColumnFun columnFun, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.GREAT_THAN_OR_EQUAL_TO, value)));
        return logic;
    }

    /**
     * 大于等于
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic gtEq(ColumnFun columnFun, ColumnFun value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.GREAT_THAN_OR_EQUAL_TO, value)));
        return logic;
    }

    /**
     * 全模糊 包含
     *
     * @param field
     * @param value
     * @return
     */
    public Logic like(String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(null, field, SqlOperator.LIKE, value)));
        return logic;
    }

    /**
     * 全模糊 包含
     *
     * @param tableAlias
     * @param field
     * @param value
     * @return
     */
    public Logic like(String tableAlias, String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(tableAlias, field, SqlOperator.LIKE, value)));
        return logic;
    }


    /**
     * 全模糊 包含
     *
     * @param column
     * @param value
     * @return
     */
    public Logic like(Column column, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(column, SqlOperator.LIKE, value)));
        return logic;
    }

    /**
     * 全模糊 包含
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic like(ColumnFun columnFun, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.LIKE, value)));
        return logic;
    }

    /**
     * 左模糊 包含
     *
     * @param field
     * @param value
     * @return
     */
    public Logic likeL(String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(null, field, SqlOperator.LIKE_L, value)));
        return logic;
    }

    /**
     * 左模糊 包含
     *
     * @param tableAlias
     * @param field
     * @param value
     * @return
     */
    public Logic likeL(String tableAlias, String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(tableAlias, field, SqlOperator.LIKE_L, value)));
        return logic;
    }


    /**
     * 左模糊 包含
     *
     * @param column
     * @param value
     * @return
     */
    public Logic likeL(Column column, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(column, SqlOperator.LIKE_L, value)));
        return logic;
    }

    /**
     * 左模糊 包含
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic likeL(ColumnFun columnFun, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.LIKE_L, value)));
        return logic;
    }

    /**
     * 右模糊 包含
     *
     * @param field
     * @param value
     * @return
     */
    public Logic likeR(String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(null, field, SqlOperator.LIKE_R, value)));
        return logic;
    }

    /**
     * 右模糊 包含
     *
     * @param tableAlias
     * @param field
     * @param value
     * @return
     */
    public Logic likeR(String tableAlias, String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(tableAlias, field, SqlOperator.LIKE_R, value)));
        return logic;
    }


    /**
     * 右模糊 包含
     *
     * @param column
     * @param value
     * @return
     */
    public Logic likeR(Column column, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(column, SqlOperator.LIKE_R, value)));
        return logic;
    }

    /**
     * 右模糊 包含
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic likeR(ColumnFun columnFun, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.LIKE_R, value)));
        return logic;
    }

    /**
     * 全模糊 不包含
     *
     * @param field
     * @param value
     * @return
     */
    public Logic notLike(String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(null, field, SqlOperator.NOT_LIKE, value)));
        return logic;
    }

    /**
     * 全模糊 不包含
     *
     * @param tableAlias
     * @param field
     * @param value
     * @return
     */
    public Logic notLike(String tableAlias, String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(tableAlias, field, SqlOperator.NOT_LIKE, value)));
        return logic;
    }

    /**
     * 全模糊 不包含
     *
     * @param column
     * @param value
     * @return
     */
    public Logic notLike(Column column, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(column, SqlOperator.NOT_LIKE, value)));
        return logic;
    }

    /**
     * 全模糊 不包含
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic notLike(ColumnFun columnFun, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.NOT_LIKE, value)));
        return logic;
    }

    /**
     * 左模糊 不包含
     *
     * @param field
     * @param value
     * @return
     */
    public Logic notLikeL(String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(null, field, SqlOperator.NOT_LIKE_L, value)));
        return logic;
    }

    /**
     * 左模糊 不包含
     *
     * @param tableAlias
     * @param field
     * @param value
     * @return
     */
    public Logic notLikeL(String tableAlias, String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(tableAlias, field, SqlOperator.NOT_LIKE_L, value)));
        return logic;
    }

    /**
     * 左模糊 不包含
     *
     * @param column
     * @param value
     * @return
     */
    public Logic notLikeL(Column column, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(column, SqlOperator.NOT_LIKE_L, value)));
        return logic;
    }

    /**
     * 左模糊 不包含
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic notLikeL(ColumnFun columnFun, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.NOT_LIKE_L, value)));
        return logic;
    }

    /**
     * 右模糊 不包含
     *
     * @param field
     * @param value
     * @return
     */
    public Logic notLikeR(String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(null, field, SqlOperator.NOT_LIKE_R, value)));
        return logic;
    }

    /**
     * 右模糊 不包含
     *
     * @param tableAlias
     * @param field
     * @param value
     * @return
     */
    public Logic notLikeR(String tableAlias, String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(tableAlias, field, SqlOperator.NOT_LIKE_R, value)));
        return logic;
    }

    /**
     * 右模糊 不包含
     *
     * @param column
     * @param value
     * @return
     */
    public Logic notLikeR(Column column, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(column, SqlOperator.NOT_LIKE_R, value)));
        return logic;
    }

    /**
     * 右模糊 不包含
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic notLikeR(ColumnFun columnFun, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.NOT_LIKE_R, value)));
        return logic;
    }

    /**
     * 是
     *
     * @param field
     * @param value
     * @return
     */
    public Logic is(String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(null, field, SqlOperator.IS, value)));
        return logic;
    }

    /**
     * 是
     *
     * @param tableAlias
     * @param field
     * @param value
     * @return
     */
    public Logic is(String tableAlias, String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(tableAlias, field, SqlOperator.IS, value)));
        return logic;
    }

    /**
     * 是
     *
     * @param column
     * @param value
     * @return
     */
    public Logic is(Column column, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(column, SqlOperator.IS, value)));
        return logic;
    }

    /**
     * 是
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic is(ColumnFun columnFun, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.IS, value)));
        return logic;
    }

    /**
     * 是
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic is(ColumnFun columnFun, ColumnFun value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.IS, value)));
        return logic;
    }

    /**
     * 不是
     *
     * @param field
     * @param value
     * @return
     */
    public Logic isNot(String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(null, field, SqlOperator.IS_NOT, value)));
        return logic;
    }

    /**
     * 不是
     *
     * @param tableAlias
     * @param field
     * @param value
     * @return
     */
    public Logic isNot(String tableAlias, String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(tableAlias, field, SqlOperator.IS_NOT, value)));
        return logic;
    }


    /**
     * 不是
     *
     * @param column
     * @param value
     * @return
     */
    public Logic isNot(Column column, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(column, SqlOperator.IS_NOT, value)));
        return logic;
    }

    /**
     * 不是
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic isNot(ColumnFun columnFun, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.IS_NOT, value)));
        return logic;
    }

    /**
     * 不是
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic isNot(ColumnFun columnFun, ColumnFun value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.IS_NOT, value)));
        return logic;
    }

    /**
     * 是null
     *
     * @param field
     * @return
     */
    public Logic isNull(String field) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(null, field, SqlOperator.IS_NULL, null)));
        return logic;
    }

    /**
     * 是null
     *
     * @param tableAlias
     * @param field
     * @return
     */
    public Logic isNull(String tableAlias, String field) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(tableAlias, field, SqlOperator.IS_NULL, null)));
        return logic;
    }

    /**
     * 是null
     *
     * @param column
     * @return
     */
    public Logic isNull(Column column) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(column, SqlOperator.IS_NULL, null)));
        return logic;
    }

    /**
     * 是null
     *
     * @param columnFun
     * @return
     */
    public  Logic isNull(ColumnFun columnFun) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.IS_NULL, null)));
        return logic;
    }

    /**
     * 不是null
     *
     * @param field
     * @return
     */
    public Logic isNotNull(String field) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(null, field, SqlOperator.IS_NOT_NULL, null)));
        return logic;
    }

    /**
     * 不是null
     *
     * @param tableAlias
     * @param field
     * @return
     */
    public Logic isNotNull(String tableAlias, String field) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(tableAlias, field, SqlOperator.IS_NOT_NULL, null)));
        return logic;
    }

    /**
     * 不是null
     *
     * @param column
     * @return
     */
    public Logic isNotNull(Column column) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(column, SqlOperator.IS_NOT_NULL, null)));
        return logic;
    }

    /**
     * 不是null
     *
     * @param columnFun
     * @return
     */
    public  Logic isNotNull(ColumnFun columnFun) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.IS_NOT_NULL, null)));
        return logic;
    }

    /**
     * 包含
     *
     * @param field
     * @param value
     * @return
     */
    public Logic in(String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(null, field, SqlOperator.IN, value)));
        return logic;
    }

    /**
     * 包含
     *
     * @param tableAlias
     * @param field
     * @param value
     * @return
     */
    public Logic in(String tableAlias, String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(tableAlias, field, SqlOperator.IN, value)));
        return logic;
    }

    /**
     * 包含
     *
     * @param column
     * @param value
     * @return
     */
    public Logic in(Column column, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(column, SqlOperator.IN, value)));
        return logic;
    }

    /**
     * 包含
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic in(ColumnFun columnFun, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.IN, value)));
        return logic;
    }

    /**
     * 不包含
     *
     * @param field
     * @param value
     * @return
     */
    public Logic notIn(String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(null, field, SqlOperator.NOT_IN, value)));
        return logic;
    }

    /**
     * 不包含
     *
     * @param tableAlias
     * @param field
     * @param value
     * @return
     */
    public Logic notIn(String tableAlias, String field, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(tableAlias, field, SqlOperator.NOT_IN, value)));
        return logic;
    }

    /**
     * 不包含
     *
     * @param column
     * @param value
     * @return
     */
    public Logic notIn(Column column, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(column, SqlOperator.NOT_IN, value)));
        return logic;
    }

    /**
     * 不包含
     *
     * @param columnFun
     * @param value
     * @return
     */
    public  Logic notIn(ColumnFun columnFun, Object value) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.NOT_IN, value)));
        return logic;
    }

    /**
     * 介于
     *
     * @param field
     * @param value1
     * @param value2
     * @return
     */
    public Logic between(String field, Object value1, Object value2) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(null, field, SqlOperator.BETWEEN, new Object[]{value1, value2})));
        return logic;
    }

    /**
     * 介于
     *
     * @param tableAlias
     * @param field
     * @param value1
     * @param value2
     * @return
     */
    public Logic between(String tableAlias, String field, Object value1, Object value2) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(tableAlias, field, SqlOperator.BETWEEN, new Object[]{value1, value2})));
        return logic;
    }

    /**
     * 介于
     *
     * @param column
     * @param value1
     * @param value2
     * @return
     */
    public Logic between(Column column, Object value1, Object value2) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(column, SqlOperator.BETWEEN, new Object[]{value1, value2})));
        return logic;
    }

    /**
     * 介于
     *
     * @param columnFun
     * @param value1
     * @param value2
     * @return
     */
    public  Logic between(ColumnFun columnFun, Object value1, Object value2) {
        dataList.add(new ConditionData(sqlLogic, newConditionInfo(columnFun, SqlOperator.BETWEEN, new Object[]{value1, value2})));
        return logic;
    }

    private ConditionInfo newConditionInfo(String tableAlias, String name, SqlOperator sqlOperator, Object value) {
        return new ConditionInfo(null, tableAlias, name, value, sqlOperator);
    }

    private ConditionInfo newConditionInfo(Column column, SqlOperator sqlOperator, Object value) {
        return new ConditionInfo(null, column, value, sqlOperator);
    }

    private  ConditionInfo newConditionInfo(ColumnFun columnFun, SqlOperator sqlOperator, Object value) {
        return new ConditionInfo(null, LambdaUtil.getColumn(columnFun), value, sqlOperator);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy