package com.tofly.gpsboot.common.business;

import com.tofly.gpsboot.common.system.IsSubmitEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.util.StringUtils;

/**
 * 时间字典码值
 * @author Zev
 */
@Getter
@AllArgsConstructor
public enum DateTypeEnum {
    /**
     *
     */
    YEAR("0","年"),
    MONTH("1","月"),
    QUARTER("2","季"),
    WEEK("3","周"),
    DAY("4","天"),

    ;
    /**
     * 编码
     */
    private String code;
    /**
     * 内容
     */
    private String value;

    public static String getCodeForValue(String code) {
        String path = "";
        if (StringUtils.isEmpty(code)) {
            return path;
        }

        for (DateTypeEnum e : DateTypeEnum.values()) {
            if (e.code.equalsIgnoreCase(code)) {
                path = e.value;
                break;
            }
        }
        return path;
    }
}
