package cn.ysk.cashier.pojo;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import java.io.Serializable;

@Entity
@Data
@Table(name="tb_version")
public class TbVersion implements Serializable {

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

    @Column(name = "`source`")
    @ApiModelProperty(value = "PC；APP;")
    private String source;

    @Column(name = "`type`")
    @ApiModelProperty(value = "ios;android;")
    private String type;

    @Column(name = "`version`")
    @ApiModelProperty(value = "版本号")
    private String version;

    @Column(name = "`url`")
    @ApiModelProperty(value = "下载地址")
    private String url;

    @Column(name = "`is_up`")
    @ApiModelProperty(value = "是否强制更新 0：否 1：是")
    private Integer isUp;

    @ApiModelProperty(value = "选中 0：否 1：是")
    private Integer sel;

    @Column(name = "`message`")
    @ApiModelProperty(value = "更新提示内容")
    private String message;

    @Column(name = "`created_at`")
    @ApiModelProperty(value = "创建时间")
    private Long createdAt;

    @Column(name = "`updated_at`")
    @ApiModelProperty(value = "更新时间")
    private Long updatedAt;

    public void copy(TbVersion source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
