package com.hzya.frame.basedao.entity;

import java.util.List;

/**
 * @ClassName WhereCriterion
 * @Description 条件对象
 * @Author llg
 * Date 2022/12/3 1:55 下午
 */
public class WhereCriterion {
    //左括号
    private String leftBracket;
    //字段
    private String filed;
    //条件
    private String condition;
    private ConditionType conditions;
    //值
    private Object value;
    //第二个值
    private Object secondValue;
    //右括号
    private String rightBracket;
    //连接
    private ConnectType connect;
    //没有值
    private boolean noValue;
    //单值
    private boolean singleValue;
    //之间值
    private boolean betweenValue;
    //list值
    private boolean listValue;
    //类型的处理程序
    private String typeHandler;

    private WhereCriterion() {
    }

    public WhereCriterion(String leftBracket, String filed, String condition, String rightBracket, ConnectType connect) {
        super();
        this.leftBracket = leftBracket;
        this.filed = filed;
        this.condition = condition;
        this.typeHandler = null;
        this.noValue = true;
        this.rightBracket = rightBracket;
        this.connect = connect;
    }
    public WhereCriterion(String leftBracket,String filed, String condition, Object value, String rightBracket, ConnectType connect, String typeHandler) {
        super();
        this.leftBracket = leftBracket;
        this.filed = filed;
        this.condition = condition;
        this.value = value;
        this.rightBracket = rightBracket;
        this.connect = connect;
        this.typeHandler = typeHandler;
        if (value instanceof List<?>) {
            this.listValue = true;
        } else {
            this.singleValue = true;
        }
    }
    public WhereCriterion(String leftBracket,String filed, String condition, Object value, String rightBracket, ConnectType connect) {
        this(leftBracket, filed, condition, value,rightBracket,connect, null);
    }
    public WhereCriterion(String leftBracket,String filed, String condition, Object value, Object secondValue, String rightBracket, ConnectType connect, String typeHandler) {
        super();
        this.leftBracket = leftBracket;
        this.filed = filed;
        this.condition = condition;
        this.value = value;
        this.secondValue = secondValue;
        this.rightBracket = rightBracket;
        this.connect = connect;
        this.typeHandler = typeHandler;
        this.betweenValue = true;
    }
    public WhereCriterion(String leftBracket, String filed, String condition, Object value, Object secondValue, String rightBracket, ConnectType connect) {
        this(leftBracket,filed,condition, value, secondValue,rightBracket,connect, null);
    }

    public String getLeftBracket() {
        return leftBracket;
    }

    public void setLeftBracket(String leftBracket) {
        this.leftBracket = leftBracket;
    }

    public String getFiled() {
        return filed;
    }

    public void setFiled(String filed) {
        this.filed = filed;
    }

    public String getCondition() {
        return condition;
    }

    public void setCondition(String condition) {
        this.condition = condition;
    }

    public Object getValue() {
        return value;
    }

    public void setValue(Object value) {
        this.value = value;
    }

    public Object getSecondValue() {
        return secondValue;
    }

    public void setSecondValue(Object secondValue) {
        this.secondValue = secondValue;
    }

    public String getRightBracket() {
        return rightBracket;
    }

    public void setRightBracket(String rightBracket) {
        this.rightBracket = rightBracket;
    }

    public ConnectType getConnect() {
        return connect;
    }

    public void setConnect(ConnectType connect) {
        this.connect = connect;
    }

    public boolean isNoValue() {
        return noValue;
    }

    public void setNoValue(boolean noValue) {
        this.noValue = noValue;
    }

    public boolean isSingleValue() {
        return singleValue;
    }

    public void setSingleValue(boolean singleValue) {
        this.singleValue = singleValue;
    }

    public boolean isBetweenValue() {
        return betweenValue;
    }

    public void setBetweenValue(boolean betweenValue) {
        this.betweenValue = betweenValue;
    }

    public boolean isListValue() {
        return listValue;
    }

    public void setListValue(boolean listValue) {
        this.listValue = listValue;
    }

    public String getTypeHandler() {
        return typeHandler;
    }

    public void setTypeHandler(String typeHandler) {
        this.typeHandler = typeHandler;
    }

    public ConditionType getConditions() {
        return conditions;
    }

    public void setConditions(ConditionType conditions) {
        this.conditions = conditions;
    }

    @Override
    public String toString() {
        return "WhereCriterion{" +
                "leftBracket='" + leftBracket + '\'' +
                ", filed='" + filed + '\'' +
                ", condition='" + condition + '\'' +
                ", conditions=" + conditions +
                ", value=" + value +
                ", secondValue=" + secondValue +
                ", rightBracket='" + rightBracket + '\'' +
                ", connect=" + connect +
                ", noValue=" + noValue +
                ", singleValue=" + singleValue +
                ", betweenValue=" + betweenValue +
                ", listValue=" + listValue +
                ", typeHandler='" + typeHandler + '\'' +
                '}';
    }
}
