package com.yuchen.saas.park.api.vo.park.energy;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

/**
 * @author 颜艺波
 * @date 2021/8/28 10:52
 * @Description
 */
@Data
@ApiModel(value = "排名返回模型")
public class TopTenEnergyVO implements Comparable<TopTenEnergyVO> {

    /**
     * 名称
     */
    @ApiModelProperty(value = "排名显示的名称")
    private String Name;

    /**
     * 用量
     */
    @ApiModelProperty(value = "排名显示的用量")
    private String value;

    @Override
    public int compareTo(TopTenEnergyVO o) {
        BigDecimal a = new BigDecimal(this.value);
        BigDecimal b = new BigDecimal(o.getValue());
        if (a.compareTo(b) == 1) {
            return 1;
        } else if (a.compareTo(b) == -1) {
            return -1;
        } else {
            return 0;
        }
    }




}
