package cn.estsh.i3plus.pojo.wms.bean;

import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn;
import cn.estsh.i3plus.pojo.base.annotation.DynamicField;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import com.alibaba.fastjson.annotation.JSONField;
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 org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;

/**
 * @Description : 零件包装主数据信息
 * @Reference :
 * @Author : jimmy.zeng
 * @CreateDate : 2020-01-09 14:04
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name="QAD_ITEM_PACKING")
@Api("零件包装主数据信息")
public class QadItemPacking implements Serializable {

    private static final long serialVersionUID = -9204074690166851001L;

    @Id
    @GeneratedValue(generator = "IDGenerator")
    @GenericGenerator(name = "IDGenerator", strategy = "assigned")
    @Column(name="ID")
    @ApiParam(value = "主键",example = "0")
    @JsonSerialize(using = ToStringSerializer.class)
    @AnnoOutputColumn(hidden = true)
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
    public Long id;

    //get单独处理
    public Long getId() {
        if(id != null) {
            return id.longValue();
        }else{
            return id;
        }
    }

    /**
     * MonogoDB _id映射
     * @param id
     */
    @JSONField(name="_id")
    public void setId(Long id) {
        this.id = id;
    }

    @Column(name="IN_ADDR")
    @ApiParam("收货时是供应商编号，发运时是客户发往地")
    public String inAddr;

    @Column(name="IN_BOP_CODE")
    @ApiParam("BOP编号")
    public String inBopCode;

    @Column(name="IN_DOMAIN")
    @ApiParam("所属Domain")
    public String inDomain;

    @Column(name="IN_PART")
    @ApiParam("物料代码")
    public String inPart;

    @Column(name="IN_SITE")
    @ApiParam("工厂代码")
    public String inSite;

    @Column(name="IN_TRANS_TYPE")
    @ApiParam("交易类型")
    public String inTransType;

    @Column(name="CREATE_DATE_TIME")
    @ApiParam("创建时间")
    public String createDateTime;
}
