package com.bohuikeji.delivery.backstage.entity.discount;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.bohuikeji.frame.module.admin.annotation.TableKeyField;
import com.bohuikeji.frame.module.admin.annotation.TableNewField;
import com.bohuikeji.frame.module.admin.annotation.TableQueryField;
import com.bohuikeji.frame.module.admin.annotation.TableShowField;
import com.bohuikeji.frame.module.admin.base.EntityBase;
import com.bohuikeji.frame.module.admin.entity.web.block.TextBlock;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 客户下单使用优惠券记录
 * </p>
 *
 * @author zhouliwu
 * @since 2021-03-29
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="TCourier对象", description="发放代金券")
@TableName("t_discount_order")
public class TDiscountOrder extends EntityBase<TDiscountOrder> {

    private static final long serialVersionUID = 1L;

    /**
     * 订单优惠卷id
     */
    @ApiModelProperty(value="优惠使用id")
    @TableShowField(value = "ID",id = true)
    @TableNewField(show = false)
    @TableId(value = "use_id", type = IdType.AUTO)
    private Integer useId;

    /**
     * 优惠券
     */
    @ApiModelProperty(value = "优惠券")
    @TableQueryField(show = false)
    @TableShowField(value = "优惠券")
    @TableNewField
    @TableField("dis_id")
    @TableKeyField(table = "t_discount_mall",keyShowFields = "dis_name",keyLikeFields = "dis_name")
    private Integer disId;

    /**
     * 优惠券
     */
    @ApiModelProperty(value = "使用的优惠券")
    @TableQueryField(show = true)
    @TableShowField(value = "使用的优惠券",show = false)
    @TableNewField
    @TableField("release_id")
    //@TableKeyField(table = "t_create_voucher",keyShowFields = "coupon_name",keyLikeFields = "coupon_name")
    private Integer releaseId;
    /**
     * 下单客户
     */
    @ApiModelProperty(value = "下单客户")
    @TableQueryField(show = false)
    @TableShowField(value = "下单客户")
    @TableNewField
    @TableField("customer_id")
    @TableKeyField(table = "t_customer",keyShowFields = "customer_name",keyLikeFields = "customer_name")
    private Integer customerId;

    /**
     * 订单号
     */
    @ApiModelProperty(value = "订单号")
    @TableQueryField(show = true)
    @TableShowField(value = "订单号")
    @TableNewField
    @TableField("order_num")
    private String orderNum;

    /**
     * 优惠批次号
     */
    /*@ApiModelProperty(value = "优惠批次号")
    @TableQueryField(show = true)
    @TableShowField(value = "优惠批次号")
    @TableNewField
    @TableField("coupon_stock")
    private String couponStock;*/

    /**
     * 订单总额
     */
    @ApiModelProperty(value = "订单总额")
    @TableQueryField(show = false)
    @TableShowField(value = "订单总额")
    @TableNewField
    @TableField("order_total_amount")
    private BigDecimal orderTotalAmount;

    /**
     * 预估金额
     */
    @ApiModelProperty(value = "预估金额")
    @TableQueryField(show = false)
    @TableShowField(value = "预估金额")
    @TableNewField
    @TableField("estimate_amount")
    private BigDecimal estimateAmount;

    /**
     * 优惠金额
     */
    @ApiModelProperty(value = "优惠金额")
    @TableQueryField(show = false)
    @TableShowField(value = "优惠金额")
    @TableNewField
    @TableField("dis_amount")
    private BigDecimal disAmount;

    /**
     * 所属加盟商
     */
    @ApiModelProperty(value = "所属加盟商")
    @TableQueryField(show = true)
    @TableShowField(value = "所属加盟商")
    @TableNewField(edit = false)
    @TableField("fran_id")
    @TableKeyField(table = "t_franchisee_information",keyShowFields = "fran_name", where = "fran_id in(##FRAN_IDS##)")
    private Integer franId;

    /**
     * 优惠卷类型
     */
    @ApiModelProperty(value = "优惠卷类型")
    @TableQueryField(show = false)
    @TableShowField(value = "优惠卷类型")
    @TableNewField()
    @TableField("dis_type")
    private String disType;

    /**
     * 优惠明细
     */
    /*@ApiModelProperty(value = "优惠明细")
    @TableQueryField(show = false)
    @TableShowField(value = "优惠明细")
    @TableNewField(block = TextBlock.class,required = false)
    @TableField("dis_details")
    private JSONObject disDetails;*/

    /**
     * 备注说明
     */
    @ApiModelProperty(value = "优惠说明")
    @TableQueryField(show = false)
    @TableShowField(value = "优惠说明")
    @TableNewField(block = TextBlock.class,required = false)
    @TableField("dis_remark")
    private String disRemark;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    @TableQueryField(show = true)
    @TableShowField(value = "创建时间")
    @TableNewField(edit = false,show = false,required = false)
    @TableField("create_time")
    private LocalDateTime createTime;

    /**
     * 操作状态
     */
    @ApiModelProperty(value = "操作状态")
    @TableQueryField(show = true)
    @TableShowField(value = "操作状态")
    @TableNewField
    @TableField("dis_state")
    private String disState;



}
