package com.hzya.frame.basedao.entity;

import com.fasterxml.jackson.annotation.JsonCreator;

/**
 * @Author lvleigang
 * @Description  连接类型对象
 * @Date 11:30 上午 2022/12/9
 * @param
 * @return
 **/
public enum ConnectType {
    AND("AND", "AND"),
    OR("OR", "OR");
    //类型
    private String type;
    //值
    private String values;

    private ConnectType(String type, String values) {
        this.type = type;
        this.values = values;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getValues() {
        return values;
    }

    public void setValues(String values) {
        this.values = values;
    }

    /**
     * 增加映射方法，并为方法添加@JsonCreator
     */
    @JsonCreator
    public static ConnectType getConnectTypeFromCodeName(String value) {
        for (ConnectType dep : ConnectType.values()) {
            if (dep.getType().equals(value)) {
                return dep;
            }
        }
        return null;
    }
}
