package com.fzm.mall.server.front.asset.model;

import java.math.BigDecimal;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 用户资产-转让-操作日志
 * </p>
 *
 * @author fzm
 * @since 2021-08-17
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("user_asset_transfer_log")
@ApiModel(value="UserAssetTransferLog对象", description="用户资产-转让-操作日志")
public class UserAssetTransferLog implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 操作（1->撤销，2->修改价格）
     */
    public static final Integer TRANSFER_LOG_TYPE_CANCLE = 1;

    public static final Integer TRANSFER_LOG_TYPE_UPDATE_PRICE = 2;

    @ApiModelProperty(value = "用户资产表自增id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "转让编号")
    private String transferId;

    @ApiModelProperty(value = "旧的转让价格")
    private BigDecimal oldPrice;

    @ApiModelProperty(value = "新的转让价格")
    private BigDecimal newPrice;

    @ApiModelProperty(value = "操作（1->撤销，2->修改价格）")
    private Integer type;

    @ApiModelProperty(value = "信息入库时间")
    @TableField(fill = FieldFill.INSERT)
    private Long createTime;

    @ApiModelProperty(value = "信息更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updateTime;

    public void init(String transferId, BigDecimal oldPrice, BigDecimal newPrice, Integer type) {
        setTransferId(transferId);
        setOldPrice(oldPrice);
        setNewPrice(newPrice);
        setType(type);
    }
}
