package com.seer.teach.mall.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.seer.teach.common.entity.BaseEntity;
import com.seer.teach.mall.handler.GoodsSpecAttributesTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import org.apache.ibatis.type.JdbcType;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author Captain
 * @since 2025-06-10
 */
@Getter
@Setter
@TableName(value="mall_order_goods", autoResultMap = true)
@Schema(name = "OrderGoodsEntity对象", description = "")
public class OrderGoodsEntity extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 订单id
     */
    @TableField("order_id")
    private Integer orderId;

    /**
     * 子订单Id
     */
    @TableField("child_order_id")
    private Integer childOrderId;

    /**
     * 商品id
     */
    @TableField("goods_id")
    private Integer goodsId;

    /**
     * 商品名称
     */
    @TableField("goods_name")
    private String goodsName;

    @TableField("cart_id")
    private Long cartId;

    /**
     * 商品数量
     */
    @TableField("`number`")
    private Integer number;

    /**
     * 商品sku_id
     */
    @TableField("`sku_id`")
    private Integer skuId;

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

    /**
     * 学豆
     */
    @TableField("coin")
    private BigDecimal coin;

    @TableField("comment_status")
    private Integer commentStatus;

    @Schema(description = "虚拟商品")
    @TableField("is_real")
    private Integer isReal;

    @Schema(description = "图片链接")
    @TableField("pic_url")
    private String picUrl;

    /**
     * 属性数组，JSON 格式，[{"valueId": 6, "valueName": "二代", "attributeId": 3, "attributeName": "版本"}, {"valueId": 5, "valueName": "Y50", "attributeId": 2, "attributeName": "型号"}]
     */
    @TableField(value = "attributes", typeHandler = GoodsSpecAttributesTypeHandler.class,javaType = true, jdbcType = JdbcType.VARCHAR)
    private List<GoodsSpecificationEntity.Attribute> attributes;

}