enums

public enum ShopTypeEnum {

    meituan("16", "可以"),
    meituanfood("8", "不可以"),
    eleme("9", "还行"),
    elemestar("10", "不行");

    private final String code;
    private final String desc;

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

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static ShopTypeEnum getEnumByCode(String code) {
        ShopTypeEnum[] enums = ShopTypeEnum.values();
        for (ShopTypeEnum e : enums) {
            if (StringUtils.equals(e.getCode(), code)) {
                return e;
            }
        }
        return null;
    }
}

 

posted @ 2021-07-15 15:30  Bonnie_ξ  阅读(71)  评论(0)    收藏  举报