2026-03-18 10:18:03 +08:00
|
|
|
|
package entity
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
consts "assets/consts/asset"
|
|
|
|
|
|
"assets/consts/stock"
|
|
|
|
|
|
"assets/model/config"
|
|
|
|
|
|
|
|
|
|
|
|
"gitea.com/red-future/common/beans"
|
2026-03-19 17:45:06 +08:00
|
|
|
|
"github.com/gogf/gf/v2/encoding/gjson"
|
2026-03-18 10:18:03 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
2026-03-19 17:45:06 +08:00
|
|
|
|
type assetSkuCol struct {
|
|
|
|
|
|
beans.SQLBaseCol
|
|
|
|
|
|
AssetId string
|
|
|
|
|
|
AssetName string
|
|
|
|
|
|
SkuName string
|
|
|
|
|
|
ImageURL string
|
|
|
|
|
|
SpecValues string
|
|
|
|
|
|
Price string
|
|
|
|
|
|
UnlimitedStock string
|
|
|
|
|
|
Stock string
|
|
|
|
|
|
SpecsCount string
|
|
|
|
|
|
SpecsUnit string
|
|
|
|
|
|
Sort string
|
|
|
|
|
|
Status string
|
|
|
|
|
|
StockMode string
|
|
|
|
|
|
CategoryId string
|
|
|
|
|
|
CategoryPath string
|
|
|
|
|
|
CapacityUnitType string
|
|
|
|
|
|
Capacity string
|
|
|
|
|
|
TenantModuleType string
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var AssetSkuCol = assetSkuCol{
|
|
|
|
|
|
SQLBaseCol: beans.DefSQLBaseCol,
|
|
|
|
|
|
AssetId: "asset_id",
|
|
|
|
|
|
AssetName: "asset_name",
|
|
|
|
|
|
SkuName: "sku_name",
|
|
|
|
|
|
ImageURL: "image_url",
|
|
|
|
|
|
SpecValues: "spec_values",
|
|
|
|
|
|
Price: "price",
|
|
|
|
|
|
UnlimitedStock: "unlimited_stock",
|
|
|
|
|
|
Stock: "stock",
|
|
|
|
|
|
SpecsCount: "specs_count",
|
|
|
|
|
|
SpecsUnit: "specs_unit",
|
|
|
|
|
|
Sort: "sort",
|
|
|
|
|
|
Status: "status",
|
|
|
|
|
|
StockMode: "stock_mode",
|
|
|
|
|
|
CategoryId: "category_id",
|
|
|
|
|
|
CategoryPath: "category_path",
|
|
|
|
|
|
CapacityUnitType: "capacity_unit_type",
|
|
|
|
|
|
Capacity: "capacity",
|
|
|
|
|
|
TenantModuleType: "tenant_module_type",
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-18 10:18:03 +08:00
|
|
|
|
// AssetSku 资产SKU实体
|
|
|
|
|
|
type AssetSku struct {
|
2026-03-19 17:45:06 +08:00
|
|
|
|
beans.SQLBaseDO `orm:",inherit"`
|
|
|
|
|
|
AssetId int64 `orm:"asset_id" json:"assetId"` // 关联资产ID
|
|
|
|
|
|
AssetName string `orm:"asset_name" json:"assetName"` // 资产名称
|
|
|
|
|
|
SkuName string `orm:"sku_name" json:"skuName"` // SKU名称
|
|
|
|
|
|
ImageURL string `orm:"image_url,omitempty" json:"imageUrl"` // SKU主图
|
|
|
|
|
|
SpecValues []gjson.Json `orm:"spec_values" json:"specValues"` // 规格值:{"颜色":"红色","尺寸":"L","时长":"1个月","平台":"抖音"}
|
|
|
|
|
|
Price int `orm:"price" json:"price"` // 价格(分为单位)
|
|
|
|
|
|
UnlimitedStock bool `orm:"unlimited_stock" json:"unlimitedStock"` // 是否无库存限制
|
|
|
|
|
|
Stock int `orm:"stock" json:"stock"` // 库存数量
|
|
|
|
|
|
SpecsCount int `orm:"specs_count" json:"specsCount"` // 规格数量
|
|
|
|
|
|
SpecsUnit *gjson.Json `orm:"specs_unit" json:"specsUnit"` // 规格单位 SpecsUnitKeyValue
|
|
|
|
|
|
Sort int `orm:"sort" json:"sort"` // 排序
|
|
|
|
|
|
Status consts.AssetSkuStatusType `orm:"status" json:"status"` // 状态:active/inactive/disabled
|
|
|
|
|
|
StockMode stock.StockMode `orm:"stock_mode" json:"stockMode"` // 库存管理模式:1-明细模式 2-批次模式
|
|
|
|
|
|
CategoryId int64 `orm:"category_id" json:"categoryId"` // 分类ID
|
|
|
|
|
|
CategoryPath string `orm:"category_path" json:"categoryPath"` // 分类路径
|
|
|
|
|
|
CapacityUnitType stock.CapacityUnitType `orm:"capacity_unit_type" json:"capacityUnitType"` // 容量单位类型
|
|
|
|
|
|
Capacity config.Capacity `orm:"capacity" json:"capacity"` // 容量
|
|
|
|
|
|
TenantModuleType beans.TenantModuleType `orm:"tenant_module_type" json:"tenantModuleType"` // 租户模块类型
|
2026-03-18 10:18:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type SpecsUnitKeyValue struct {
|
|
|
|
|
|
Key string `bson:"key" json:"key"` // 对应原有常量值
|
|
|
|
|
|
Value string `bson:"value" json:"value"` // 对应描述信息
|
|
|
|
|
|
}
|