
package com.ruoyi.xq.enums.userinfo;


import lombok.Getter;

import java.util.Arrays;

/**
 * 性别
 * <p>created on 2024/2/26 16:50</p>
 * @author duet
 */
@Getter
public enum UserGenderEnum {
    NONE(0,"未知", "xq/images/avatar/none.png"),
    WOMEN(1,"女", "xq/images/avatar/women.png"),
    MAN(2,"男", "xq/images/avatar/man.png"),
    ;


    private final Integer code;
    private final String text;
    private final String defaultAvatar;

    UserGenderEnum(Integer code, String text, String defaultAvatar) {
        this.code = code;
        this.text = text;
        this.defaultAvatar = defaultAvatar;
    }

    public static UserGenderEnum getByCode(Integer gender) {
        return Arrays.stream(UserGenderEnum.values()).filter(i -> gender.equals(i.getCode())).findFirst().orElse(null);
    }
}
