package com.bofeng.entity;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.toolkit.IdWorker;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.joda.time.DateTime;

import java.math.BigDecimal;

@Getter
@Setter
@NoArgsConstructor
@TableName("tb_order_cms")
public class OrderCms {

    public OrderCms(Long orderId, User user, BigDecimal cmsAmount) {
        this.setCmsId(IdWorker.getId());
        this.setOrderId(orderId);
        this.setSaleName(user.getStaffName());
        this.setSaleUserId(user.getUserId());
        this.setCmsAmount(cmsAmount);
        this.setSettle(false);
        this.setSettleAt(null);
    }

    @TableId("cms_id")
    private Long cmsId;

    @TableField("order_id")
    private Long orderId;

    @TableField("sale_name")
    private String saleName;

    @TableField("sale_user_id")
    private Long saleUserId;

    @TableField("cms_amount")
    private BigDecimal cmsAmount;

    @TableField("settle")
    private Boolean settle;

    @TableField("settle_at")
    private DateTime settleAt;
}
