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

import cn.estsh.i3plus.pojo.base.annotation.DynamicField;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
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;

/**
 * @Description :
 * @Reference :
 * @Author : amy
 * @CreateDate : 2019-06-11 13:54
 * @Modify:
 **/
@Data
@Entity
@Table(name="WMS_UNIT")
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Api(value="单位定义",description = "单位定义")
public class WmsUnit extends BaseBean {

    private static final long serialVersionUID = 7332606009041273554L;
    @Column(name = "UNIT_CODE")
    @ApiParam(value = "单位代码")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String unitCode;

    @Column(name = "UNIT_NAME")
    @ApiParam(value = "单位名称")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String unitName;

    @Column(name = "UNIT_PRECISION")
    @ApiParam(value = "单位精度")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
    private Integer unitPrecision;

    public Integer getUnitPrecisionValue(){
        return this.unitPrecision == null?0:this.unitPrecision.intValue();
    }

}
