package com.yida.data.common.core.entity.apply;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;

import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 商品表 Entity
 *
 * @author zhanghaijun
 * @date 2021-06-30 15:42:21
 */
@Data
@TableName("edu_product")
public class EduProduct {

    /**
     *
     */
    @TableId(value = "product_id", type = IdType.AUTO)
    private Long productId;

    /**
     * 商品名称
     */
    @TableField("product_name")
    private String productName;

    @ApiModelProperty("商品编码")
    private String productCode;

    /**
     * 商品价格
     */
    @TableField("price")
    private Double price;

    /**
     * 上架时间
     */
    @TableField("putaway_date")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime putawayDate;

    /**
     * 支持的字符方式	1.微信，2.支付宝，3.银联，同时支持多种以逗号分隔
     */
    @TableField("pay_way")
    private String payWay;

    /**
     * 商品描述
     */
    @TableField("product_description")
    private String productDescription;

    /**
     * 商品须知模板
     */
    @TableField("product_model")
    private String productModel;

    /**
     * 关联字典表t_dict的value值，多个则以逗号分割，空则为无
     */
    @TableField("discount_family_type")
    private String discountFamilyType;

    /**
     * 减免后价格，如果是0元需要自动识别家庭类型的学生自动具有该功能
     */
    @TableField("discount_price")
    private Double discountPrice;

    @ApiModelProperty("库存数量")
    private Integer stock;

    /**
     * 区域ID
     */
    @TableField("area_id")
    private Long areaId;


    /**
     * 学校ID
     */
    @TableField("school_id")
    private Long schoolId;

    /**
     * 校名字
     */
    @TableField("school_name")
    private String schoolName;

    /**
     * 默认未上架
     */
    @ApiModelProperty("默认未上架，0是未上架，1是已上架，2是已失效，3是已经下架")
    @TableField("status")
    private Integer status;

    /**
     * 是否删除，	1删除0未删除默认0
     */
    @TableField("del_flag")
    @TableLogic(value = "0", delval = "1")
    private Integer delFlag;

    /**
     * 创建时间
     */
    @TableField(value = "create_date", fill = FieldFill.INSERT)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createDate;

    /**
     * 创建人id
     */
    @TableField(value = "create_id", fill = FieldFill.INSERT)
    private Long createId;

    /**
     * 修改时间
     */
    @TableField(value = "update_date", fill = FieldFill.UPDATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateDate;

    /**
     * 修改人id
     */
    @TableField(value = "update_id", fill = FieldFill.UPDATE)
    private Long updateId;

    /**
     * 省id
     */
    @TableField("province_id")
    private Long provinceId;

    /**
     * 市id
     */
    @TableField("city_id")
    private Long cityId;

    /**
     * 县id
     */
    @TableField("county_id")
    private Long countyId;

    /**
     * 乡id
     */
    @TableField("village_id")
    private Long villageId;


    /**
     * 应用名字
     */
    @TableField(exist = false)
    private String applyName;

    /**
     * 应用id
     */
    @ApiModelProperty("商品包含应用")
    private transient List<EduProductApply> applyList;

    @ApiModelProperty("商品包 包含的商品")
    private transient List<EduRealProduct> realProductList;
    /**
     * 学校id
     */
    @TableField(exist = false)
    private List<Long> schoolIds;

    @TableField(exist = false)
    private Long studentId;

    @TableField(exist = false)
    private String studentName;

    @TableField(exist = false)
    private List<EduApplyProductOrderStudent> student;

    @TableField(exist = false)
    private String phone;

    @ApiModelProperty("到期时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(exist = false)
    private LocalDateTime endValidDate;

    @ApiModelProperty("到期时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(exist = false)
    private LocalDateTime beginValidDate;

    @ApiModelProperty("创建人")
    private transient String createName;
}