package com.mortals.xhx.common.code;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author: finegirl
 * @date: 2021/7/16 11:50
 * @description: 分表方式
 **/
public enum DividedTableTypeEnum {
    DIVIED_NO(0, "无"),
    DIVIED_BY_DAY(1, "日"),
    DIVIED_BY_WEEK(2, "周"),
    DIVIED_BY_MONTH(3, "月"),
    DIVIED_BY_YEAR(4, "年"),
    DIVIED_BY_MOD(5, "HASH取余");

    private int value;
    private String desc;

    private DividedTableTypeEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public int getValue() {
        return this.value;
    }

    public String getDesc() {
        return this.desc;
    }

    public static DividedTableTypeEnum getByValue(int value) {
        DividedTableTypeEnum[] var1 = values();
        int var2 = var1.length;

        for (int var3 = 0; var3 < var2; ++var3) {
            DividedTableTypeEnum examStatus = var1[var3];
            if (examStatus.getValue() == value) {
                return examStatus;
            }
        }

        return null;
    }

    public static Map<String, String> getEnumMap(int... eItem) {
        Map<String, String> resultMap = new LinkedHashMap();
        DividedTableTypeEnum[] var2 = values();
        int var3 = var2.length;

        for (int var4 = 0; var4 < var3; ++var4) {
            DividedTableTypeEnum item = var2[var4];

            try {
                boolean hasE = false;
                int[] var7 = eItem;
                int var8 = eItem.length;

                for (int var9 = 0; var9 < var8; ++var9) {
                    int e = var7[var9];
                    if (item.getValue() == e) {
                        hasE = true;
                        break;
                    }
                }

                if (!hasE) {
                    resultMap.put(item.getValue() + "", item.getDesc());
                }
            } catch (Exception var11) {
            }
        }

        return resultMap;
    }
}