package com.prolog.rdc.tms.config.enums;

import lombok.Getter;
import lombok.Setter;

/**
 *
 * 查询比较操作符 ENUM
 *
 *
 * @version :1.0.0
 * @className: QueryComparisonOperatorsEnum
 * @author: kh
 * @creationTime: 2022/1/20 9:20
 * @description:
 * @modifier:
 * @modifyTime:
 * @reviseRemarks:
 */
public enum QueryComparisonOperatorEnum {
	/**
	 * 等于，注意，该enum的顺序不要动，validConditaion方法中，有用到该顺序
	 */
	ET("et", "=", "等于"), IET("iet", "!=", "不等于"), GT("gt", ">", "大于"), GTE("gte", ">=", "大于等于"), LT("lt", "<", "小于"), LTE("lte", "<=", "小于等于"), IN("in", "in", "包含"), NOTIN("notin", "not in", "不包含"), LIKE("like", "like", "匹配"), NOTLIKE("notlike", "not like", "不匹配"), ISNULL("isnull", "is null", "为空"), ISNOTNULL("isnotnull", "is not null", "不包含");

	@Getter
	@Setter
	String code;
	@Getter
	@Setter
	String operator;

	@Getter
	@Setter
	String desc;

	QueryComparisonOperatorEnum(String code, String operator, String desc) {
		this.code = code;
		this.operator = operator;
		this.desc = desc;
	}

	public static QueryComparisonOperatorEnum get(String code) {
		for (QueryComparisonOperatorEnum value : values()) {
			if (value.getCode().equals(code)) {
				return value;
			}
		}
		return null;
	}
}
