package com.gyee.wisdom.dao.sql.alarm.Entity;

import com.gyee.wisdom.common.data.ToData;
import com.gyee.wisdom.common.data.alarm.Warning;
import com.gyee.wisdom.common.data.alarm.WarningClassify;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;

@Data
@Entity
@NoArgsConstructor
@Table(name="warningclassify")
public class WarningClassifyEntity implements ToData<WarningClassify>,Serializable{


    @Id
    private String id;
    @Column(name = "name")
    private String name;



    @Override
    public WarningClassify toData() {
        WarningClassify warning = new WarningClassify();
        BeanUtils.copyProperties(this,warning);
        return warning;
    }


    public WarningClassifyEntity(WarningClassify warning){
        this.id = warning.getId();
        this.name = warning.getName();
    }


}
