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 : SOD_DET信息
 * @Reference :
 * @Author : jimmy.zeng
 * @CreateDate : 2020-04-22 16:12
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name="SOD_DET")
@Api("SOD_DET信息")
public class SodDet implements Serializable {

    private static final long serialVersionUID = 539607553249262854L;

    @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="COLUMN_GROUP")
    @ApiParam("分组列名")
    public String columnGroup;

    @Column(name="COLUMN_GROUP_VALUE")
    @ApiParam("分组列名值")
    public String columnGroupValue;

    @Column(name="PROPERTIES_NAME")
    @ApiParam("参数名")
    public String propertiesName;

    @Column(name="PROPERTIES_VALUE")
    @ApiParam("参数值")
    public String propertiesValue;

    @Column(name="table_name")
    @ApiParam("表名")
    public String tableName;

    @Transient
    private String dockcode;

    @Transient
    private String storagelocation;

    @Transient
    private String requerimentCode;
}
