package com.liangjian.dataplatform.member.entity.vo.tagrules;

/**
 * @Author: 黄子奇
 * @Date: 2019/9/9 9:04
 */
public enum BinOperaType {
    EQ{
        @Override
        public String toSql(String left, String right) {
            return String.format("%s = %s",left, right);
        }
    },
    LE{
        @Override
        public String toSql(String left, String right) {
            return String.format("%s <= %s", left, right);
        }
    },
    GE{
        @Override
        public String toSql(String left, String right) {
            return String.format("%s >= %s",left, right);
        }
    },
    NE {
        @Override
        public String toSql(String left, String right) {
            return String.format("%s <> %s", left, right);
        }
    },
    CONTAINS{
        @Override
        public String toSql(String left, String right) {
            return left + " LIKE %" + right + "%";
        }
    },
    BELONG {
        @Override
        public String toSql(String left, String right) {
            return String.format("INSTR(%s, %s)", right, left);
        }
    };


    public abstract String toSql(String left, String right);
}
