# MoodEnum.java

    package cloud.wconnect.frontoffice.cons;

    import lombok.AllArgsConstructor;
    import lombok.Getter;

    import java.util.Objects;

    /**
     * 枚举：Mood
     *
     * @author yyt
     * 2023/3/20
     */
    @Getter
    @AllArgsConstructor
    public enum MoodEnum {

        /**
         * Happy
         */
        HAPPY(0, "logbook.happy"),

        /**
         * Pleasant
         */
        PLEASANT(1, "logbook.pleasant"),

        /**
         * Neutral
         */
        NEUTRAL(2, "logbook.neutral"),

        /**
         * Concerned
         */
        CONCERNED(3, "logbook.concerned"),

        /**
         * Angry
         */
        ANGRY(4, "logbook.angry");

        private final int code;

        private final String info;

        public static String getInfoByCode(Integer code) {
            if (Objects.isNull(code)) {
                return "";
            }
            MoodEnum[] moodEnums = MoodEnum.values();
            for (MoodEnum moodEnum : moodEnums) {
                if (moodEnum.getCode() == code) {
                    return moodEnum.getInfo();
                }
            }
            return "";
        }
    }