package com.bohuikeji.delivery.backstage.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
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.constant.RegEx;
import com.bohuikeji.frame.module.admin.entity.web.block.SelectBlock;
import com.bohuikeji.frame.module.admin.serializer.Decimal2Serializer;
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 10552
 * @since 2019-12-27
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="TCustomerWallet对象", description="客户钱包")
public class TCustomerWallet extends EntityBase<TCustomerWallet> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "自增id")
    @TableId(value = "wallet_id", type = IdType.AUTO)
    @TableShowField(value = "ID",id = true)
    @TableNewField(show = false)
    private Integer walletId;

    @ApiModelProperty(value = "客户名称")
    @TableField("customer_id")
    @TableShowField(value = "客户名称",show = true)
    @TableKeyField(table = "t_customer",keyShowFields = "customer_name",keyLikeFields = "customer_name",key = TCustomer.class)
    @TableQueryField(like = false)
    @TableNewField(block = SelectBlock.class)
    private Integer customerId;

    @ApiModelProperty(value = "客户手机号")
    @TableField("customer_phone")
    @TableShowField(value = "客户手机号")
    @TableNewField(limit = RegEx.INTEGER)
    @TableQueryField(show = false)
    private String customerPhone;

    @ApiModelProperty(value = "加盟商id")
    @TableField("fran_id")
    @TableShowField(value = "所属区域",show = false)
    @TableKeyField(table = "t_franchisee_information",keyShowFields = "fran_name",where = "fran_id in(##FRAN_IDS##)")
    @TableQueryField(like = false)
    @TableNewField(block = SelectBlock.class,edit = false,add = false,show = false)
    private Integer franId;

    @ApiModelProperty(value = "钱包金额")
    @TableField("wallet_price")
    @TableShowField(value = "钱包金额(￥)",show = true)
    @TableNewField(edit = false)
    @JSONField(serializeUsing = Decimal2Serializer.class)
    private BigDecimal walletPrice=new BigDecimal("0.00").setScale(2, BigDecimal.ROUND_DOWN);

    @ApiModelProperty(value = "退款金额")
    @TableField("refunt_price")
    @TableShowField(value = "退款金额(￥)",show = true)
    @TableNewField(edit = false)
    @JSONField(serializeUsing = Decimal2Serializer.class)
    private BigDecimal refuntPrice=new BigDecimal("0.00").setScale(2, BigDecimal.ROUND_DOWN);


    @ApiModelProperty(value = "钱包状态(正常,冻结，退款)")
    @TableField("wallet_state")
    @TableShowField("钱包状态")
    @TableNewField(edit = false)
    @TableQueryField(like = false)
    private String walletState;


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

    @ApiModelProperty(value = "更改时间")
    @TableField("update_time")
    @TableShowField("更改时间")
    @TableNewField(edit = false)
    @TableQueryField(sort = 0,like = false)
    private LocalDateTime updateTime;

    @ApiModelProperty(value = "优惠金额")
    @TableField("prefer_price")
    @TableShowField(value = "优惠金额(￥)",show = true)
    @TableNewField(edit = false)
    @JSONField(serializeUsing = Decimal2Serializer.class)
    private BigDecimal preferPrice=new BigDecimal("0.00").setScale(2, BigDecimal.ROUND_DOWN);

}
