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

cn.yrm.tools.common.code.QueryRuleEnum Maven / Gradle / Ivy

The newest version!
package cn.yrm.tools.common.code;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;
import lombok.Setter;

/**
 * Query 规则 常量
 * @author Scott
 */
public enum QueryRuleEnum {

    GT(">","gt","大于"),
    GE(">=","ge","大于等于"),
    LT("<","lt","小于"),
    LE("<=","le","小于等于"),
    EQ("=","eq","等于"),
    NE("!=","ne","不等于"),
    IN("IN","in","包含"),
    LIKE("LIKE","like","全模糊"),
    LEFT_LIKE("LEFT_LIKE","left_like","左模糊"),
    RIGHT_LIKE("RIGHT_LIKE","right_like","右模糊"),
    SQL_RULES("USE_SQL_RULES","ext","自定义SQL片段");

    @Getter
    @Setter
    private String value;

    @Getter
    @Setter
    private String condition;

    @Getter
    @Setter
    private String msg;

    QueryRuleEnum(String value, String condition, String msg){
        this.value = value;
        this.condition = condition;
        this.msg = msg;
    }
	public static QueryRuleEnum getByValue(String value){
    	if(StrUtil.isEmpty(value)) {
    		return null;
    	}
        for(QueryRuleEnum val :values()){
            if (val.getValue().equals(value) || val.getCondition().equals(value)){
                return val;
            }
        }
        return  null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy