package cn.ysk.cashier.pojo;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @author GYJ
 */
@Entity
@Data
@Table(name="tb_device_stock")
public class TbDeviceStock {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "自增id")
    private Integer id;

    /**
     * code
     */
    @TableField(value = "code", whereStrategy = FieldStrategy.NOT_EMPTY)
    @Column(name = "`code`")
    private String code;


    /**
     * 设备唯一编码，码牌即为二维码编号
     */
    @TableField(value = "sn_no",whereStrategy = FieldStrategy.NOT_EMPTY)
    @Column(name = "`sn_no`")
    private String snNo;

    /**
     * 设备购买单号
     */
    @TableField(value = "order_no",whereStrategy = FieldStrategy.NOT_EMPTY)
    @Column(name = "`order_no`")
    private String orderNo;

    /**
     * 设备购买价格
     */
    @TableField("price")
    @Column(name = "`price`")
    private BigDecimal price;

    /**
     * 设备版本
     */
    @TableField(value = "type",whereStrategy = FieldStrategy.NOT_EMPTY)
    @Column(name = "`type`")
    private String type;

    /**
     * 库存分组
     */
    @TableField(value = "group_no",whereStrategy = FieldStrategy.NOT_EMPTY)
    @Column(name = "`group_no`")
    private String groupNo;

    /**
     * 购买商家名称
     */
    @TableField(value = "buy_merc_name",whereStrategy = FieldStrategy.NOT_EMPTY,condition = SqlCondition.LIKE)
    @Column(name = "`buy_merc_name`")
    private String buyMercName;


    /**
     * 购买商家ID
     */
    @TableField(value = "buy_merc_id",whereStrategy = FieldStrategy.NOT_EMPTY)
    @Column(name = "`buy_merc_id`")
    private String buyMercId;



    /**
     * 激活商家名称
     */
    @TableField(value = "act_merc_ame",whereStrategy = FieldStrategy.NOT_EMPTY,condition = SqlCondition.LIKE)
    @Column(name = "`act_merc_ame`")
    private String actMercName;


    /**
     * 激活商家ID
     */
    @TableField(value = "act_merc_d",whereStrategy = FieldStrategy.NOT_EMPTY)
    @Column(name = "act_merc_d")
    private String actMercId;

    /**
     * 二维码状态1：未出售，2：已出售 3:已激活
     */
    @TableField(value = "status",whereStrategy = FieldStrategy.NOT_EMPTY)
    @Column(name = "`status`")
    private String status;

    /**
     * 创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    @Column(name = "`create_time`")
    private Date createTime;

    /**
     * 创建人
     */
    @TableField("create_by")
    @Column(name = "`create_by`")
    private String createBy;

    /**
     * 删除标记1：正常2：删除
     */
    @TableField("del_flag")
    @Column(name = "`del_flag`")
    private String delFlag;

    /**
     * 备注
     */
    @TableField("remarks")
    @Column(name = "`remarks`")
    private String remarks;

    /**
     * 更新时间
     */
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    @Column(name = "`update_time`")
    private Date updateTime;

    /**
     * 厂家设备编号，音箱播报需要
     */
    @TableField(value = "device_no")
    @Column(name = "`device_no`")
    private String deviceNo;

    /**
     * 归属用户ID 如果是商户直接从设备商城购买的问题
     * 就显示当前使用用户ID
     * 如果是直营团队那边的 就归属于上级ID
     */
    @TableField("belong_user_id")
    @Column(name = "`belong_user_id`")
    private Long belongUserId;

    /**
     * 提货人用户ID
     */
    @TableField("extract_user_id")
    @Column(name = "`extract_user_id`")
    private Long extractUserId;

    /**
     * 所属角色
     */
    @TableField("role_code")
    @Column(name = "`role_code`")
    private String roleCode;

    /**
     * 入库时间
     */
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @TableField("in_stock_time")
    @Column(name = "`in_stock_time`")
    private Date inStockTime;


    /**
     * 划拨状态 划拨状态 01：待接收 其他表示已接收
     */
    @TableField("transfer_status")
    @Column(name = "`transfer_status`")
    private String transferStatus;

    /**
     * 绑定时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @TableField("bind_time")
    @Column(name = "`bind_time`")
    private Date bindTime;


}
