package com.yuchen.saas.park.api.enums.property;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @Author: caiwq
 * @Date: 2023/11/29 15:18
 * @Description: 性别枚举类型
 */
@Getter
@AllArgsConstructor
public enum SexEnum {

    /**
     * 男
     */
    MALE(1, "男"),
    /**
     * 女
     */
    FEMALE(2, "女");

    private final int value;
    private final String desc;

    public static String getDescByCode(Integer value) {
        if (Objects.isNull(value)) {
            return "";
        }
        SexEnum[] enumArray = SexEnum.values();
        for (SexEnum e : enumArray) {
            if (e.getValue() == value) {
                return e.getDesc();
            }
        }
        return "";
    }
}
