45 lines
2.7 KiB
Go
45 lines
2.7 KiB
Go
package entity
|
||
|
||
import (
|
||
consts "assets/consts/asset"
|
||
"assets/consts/public"
|
||
"assets/consts/stock"
|
||
"assets/model/config"
|
||
|
||
"gitea.com/red-future/common/beans"
|
||
"go.mongodb.org/mongo-driver/v2/bson"
|
||
)
|
||
|
||
// AssetSku 资产SKU实体
|
||
type AssetSku struct {
|
||
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段:Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
|
||
AssetId *bson.ObjectID `bson:"assetId" json:"assetId"` // 关联资产ID
|
||
AssetName string `bson:"assetName" json:"assetName"` // 资产名称
|
||
SkuName string `bson:"skuName" json:"skuName"` // SKU名称
|
||
ImageURL string `bson:"imageUrl,omitempty" json:"imageUrl"` // SKU主图
|
||
SpecValues []map[string]interface{} `bson:"specValues" json:"specValues"` // 规格值:{"颜色":"红色","尺寸":"L","时长":"1个月","平台":"抖音"}
|
||
Price int `bson:"price" json:"price"` // 价格(分为单位)
|
||
UnlimitedStock bool `bson:"unlimitedStock" json:"unlimitedStock"` // 是否无库存限制
|
||
Stock int `bson:"stock" json:"stock"` // 库存数量
|
||
SpecsCount int `bson:"specsCount" json:"specsCount"` // 规格数量
|
||
SpecsUnit *SpecsUnitKeyValue `bson:"specsUnit" json:"specsUnit"` // 规格单位
|
||
Sort int `bson:"sort" json:"sort"` // 排序
|
||
Status *consts.AssetSkuStatus `bson:"status" json:"status"` // 状态:active/inactive/disabled
|
||
StockMode stock.StockMode `bson:"stockMode" json:"stockMode"` // 库存管理模式:1-明细模式 2-批次模式
|
||
CategoryId *bson.ObjectID `bson:"categoryId" json:"categoryId"` // 分类ID
|
||
CategoryPath string `bson:"categoryPath" json:"categoryPath"` // 分类路径
|
||
CapacityUnitType stock.CapacityUnitType `bson:"capacityUnitType" json:"capacityUnitType"` // 容量单位类型
|
||
Capacity config.Capacity `bson:"capacity" json:"capacity"` //容量
|
||
TenantModuleType beans.TenantModuleType `bson:"tenantModuleType" json:"tenantModuleType"`
|
||
}
|
||
|
||
type SpecsUnitKeyValue struct {
|
||
Key string `bson:"key" json:"key"` // 对应原有常量值
|
||
Value string `bson:"value" json:"value"` // 对应描述信息
|
||
}
|
||
|
||
// CollectionName 获取集合名称
|
||
func (AssetSku) CollectionName() string {
|
||
return public.AssetSkuCollection
|
||
}
|