package com.hzya.frame.basedao.entity;

import com.fasterxml.jackson.annotation.JsonCreator;

/**
 * @Author lvleigang
 * @Description  排序对象
 * @Date 11:30 上午 2022/12/9
 * @param null
 * @return
 **/
public enum SortOrderType {
    DESC("DESC", "DESC"),
    ASC("ASC", "ASC");
    //类型
    private String type;
    //值
    private String values;

    SortOrderType() {
    }

    SortOrderType(String type, String values) {
        this.type = type;
        this.values = values;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getValues() {
        return values;
    }

    public void setValues(String values) {
        this.values = values;
    }

    /**
     * 增加映射方法，并为方法添加@JsonCreator
     */
    @JsonCreator
    public static SortOrderType getSortOrderTypeFromCodeName(String value) {
        for (SortOrderType dep : SortOrderType.values()) {
            if (dep.getType().equals(value)) {
                return dep;
            }
        }
        return null;
    }
}
