package com.sysu.admin.controller.crop.class_item;

import com.sysu.admin.controller.crop.period.CropPeriod;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.experimental.FieldNameConstants;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import java.util.List;

/**
 * 作物类别条目
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@FieldNameConstants(innerTypeName = "FIELDS")
@Table(name = "p_crop_class_item")
@Entity
@DynamicInsert
@DynamicUpdate
public class CropClassItem {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @Column()
    private String name;

    @Column()
    private Integer classId;

    @Transient
    private List<CropPeriod> periods;

}
