package cn.estsh.i3plus.pojo.mes.pcn.bean;


import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.List;

/**
 * @Description :生产区域
 * @Reference :
 * @Author : jack.jia
 * @CreateDate : 2019-04-02
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_AREA")
@Api("生产区域")
public class MesArea extends BaseBean implements Serializable {
    private static final long serialVersionUID = 1047604067591557689L;
    @Column(name = "AREA_CODE")
    @ApiParam("区域代码")
    private String areaCode;

    @Column(name = "AREA_NAME")
    @ApiParam("区域名称")
    private String areaName;

    @Transient
    @ApiParam(value = "子集列表")
    private List<MesWorkCenter> childTreeList;

    @Transient
    @ApiParam(value = "名称")
    private String name;

    // 默认值 -1
    @Transient
    @ApiParam(value = "父节点", access = "父节点", example = "-1")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long parentId;

}
