package com.nantian.cloud.jljc.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;

import java.io.Serializable;
import java.text.NumberFormat;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;


/**
 * 报表1-1主要产品表
 *
 * @author stz
 * @since 2020-09-16
 */
@Data
@TableName("t_report_product")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "报表1-1主要产品表")
public class TReportProduct extends Model<TReportProduct> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键id
     */
    @TableId(value = "id")
    @ApiModelProperty(value = "id")
    private Long id;

    /**
     * 报表信息表id
     */
    @ApiModelProperty(value = "报表信息表id")
    private Long reportId;

    /**
     * 产品名称
     */
    @ApiModelProperty(value = "产品名称")
    private String productName;

    /**
     * 产品编码
     */
    @ApiModelProperty(value = "产品编码")
    private String productNum;

    /**
     * 年产能数量
     */
    @ApiModelProperty(value = "年产能数量")
    private Double capacityNum;

    /**
     * 年产能单位
     */
    @ApiModelProperty(value = "年产能单位")
    private String capacityUnit;

    /**
     * 年产量数量
     */
    @ApiModelProperty(value = "年产量数量")
    private Double yieldNum;

    /**
     * 年产量单位
     */
    @ApiModelProperty(value = "年产量单位")
    private String yieldUnit;

    /**
     * 产品能耗
     */
    @ApiModelProperty(value = "产品能耗")
    private Double energyConsumption;

    /**
     * 产品能耗单位
     */
    @ApiModelProperty(value = "产品能耗单位")
    private String energyConsumptionUnit;

    /**
     * 单位产品能耗
     */
    @ApiModelProperty(value = "单位产品能耗")
    private Double unitEnergyConsumption;

    @ApiModelProperty(value = "单位产品能耗（历史数据，保留字段）")
    private Double unitEnergyConsumptionOldOld;

    /**
     * 单位产品能耗单位
     */
    @ApiModelProperty(value = "单位产品能耗单位")
    private String unitEnergyConsumptionUnit;

    @TableField(exist = false)
    @ApiModelProperty(value = "单位产品能耗（等价值），目前仅企业能耗精确性分析用到")
    private Double unitEnergyConsumptionEqu;

    @TableField(exist = false)
    @ApiModelProperty(value = "单位产品能耗单位（等价值），目前仅企业能耗精确性分析用到")
    private String unitEnergyConsumptionUnitEqu;

    /**
     * 用户id
     */
    @ApiModelProperty(value = "用户id")
    private Integer userid;

    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    /**
     * 注销状态（1：未删除，4：已删除）
     */
    @ApiModelProperty(value = "注销状态（1：未删除，4：已删除）")
    private String delFlag;

    /**
     * 部门id
     */
    @ApiModelProperty(value = "部门id")
    private Integer deptId;

    @TableField(exist = false)
    @ApiModelProperty(value = "年份")
    private String year;

    /**
     * 主键值
     */
    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "TReportProduct{" +
                "id=" + id +
                ", reportId=" + reportId +
                ", productName='" + productName + '\'' +
                ", capacityNum=" + big(capacityNum) +
                ", capacityUnit='" + capacityUnit + '\'' +
                ", yieldNum=" + big(yieldNum) +
                ", yieldUnit='" + yieldUnit + '\'' +
                ", unitEnergyConsumption=" + big(unitEnergyConsumption) +
                ", unitEnergyConsumptionUnit='" + unitEnergyConsumptionUnit + '\'' +
                ", userid=" + userid +
                ", updateTime=" + updateTime +
                ", delFlag='" + delFlag + '\'' +
                ", deptId=" + deptId +
                '}';
    }

    private static String big(double d) {
        NumberFormat nf = NumberFormat.getInstance();
        nf.setGroupingUsed(false);
        return nf.format(d);
    }
}
