package com.oying.modules.pc.product.domain; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.copier.CopyOptions; 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.oying.base.BaseEntity; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.io.Serializable; import java.math.BigDecimal; import java.util.List; /** * @author lzp * @date 2025-04-30 **/ @Getter @Setter @TableName("pc_product") public class Product extends BaseEntity implements Serializable { @TableId(value = "product_id", type = IdType.AUTO) @ApiModelProperty(value = "ID") private Long productId; @NotBlank @ApiModelProperty(value = "店铺ID") private Long storeId; @NotBlank @ApiModelProperty(value = "条形码") private String barcode; @NotBlank @ApiModelProperty(value = "商品名称") private String name; @NotBlank @ApiModelProperty(value = "商品标题") private String title; @NotNull @ApiModelProperty(value = "一级分类ID") private Long categoryId; @NotNull @ApiModelProperty(value = "二级分类ID") private Long secondCategoryId; @NotNull @ApiModelProperty(value = "状态") private Integer status; @NotBlank @ApiModelProperty(value = "主图片") private String mainImageId; @NotBlank @ApiModelProperty(value = "主图地址") private String mainImageUrl; @ApiModelProperty(value = "商品描述") private String description; @NotNull @ApiModelProperty(value = "销售价格") private BigDecimal price; @NotNull @ApiModelProperty(value = "库存数量") private Integer stockQuantity; @NotNull @ApiModelProperty(value = "起售数量") private Integer minPurchaseQuantity; @ApiModelProperty(value = "预警库存") private Integer warnStock; @ApiModelProperty(value = "重量(单位:g)") private Integer weight; @ApiModelProperty(value = "宽度(单位:厘米)") private Integer width; @ApiModelProperty(value = "长度(单位:厘米)") private Integer length; @ApiModelProperty(value = "高度(单位:厘米)") private Integer height; @ApiModelProperty(value = "是否支持退货") private Integer returns; @ApiModelProperty(value = "是否支持自提") private Integer selfPickup; @TableField(exist = false) @ApiModelProperty(value = "销量") private Integer totalUnitsSold = 0; @TableField(exist = false) @ApiModelProperty(value = "月销售量") private Integer monthlyUnitsSold = 0; @NotNull @ApiModelProperty(value = "是否删除") private Integer deletedFlag; @NotNull @ApiModelProperty(value = "版本号") private Long version; @TableField(exist = false) @ApiModelProperty(value = "图片") private List images; @TableField(exist = false) @ApiModelProperty(value = "标签") private List labels; public void copy(Product source){ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); } }