2026-03-18 10:18:03 +08:00
|
|
|
|
package entity
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
consts "assets/consts/asset"
|
|
|
|
|
|
"assets/consts/stock"
|
|
|
|
|
|
|
|
|
|
|
|
"gitea.com/red-future/common/beans"
|
|
|
|
|
|
"github.com/gogf/gf/v2/encoding/gjson"
|
|
|
|
|
|
"github.com/gogf/gf/v2/os/gtime"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2026-03-19 17:45:06 +08:00
|
|
|
|
type assetCol struct {
|
|
|
|
|
|
beans.SQLBaseCol
|
|
|
|
|
|
Name string
|
|
|
|
|
|
Description string
|
|
|
|
|
|
Type string
|
|
|
|
|
|
CategoryId string
|
|
|
|
|
|
CategoryPath string
|
|
|
|
|
|
ImageURL string
|
|
|
|
|
|
Images string
|
|
|
|
|
|
Status string
|
|
|
|
|
|
BasePrice string
|
|
|
|
|
|
Currency string
|
|
|
|
|
|
UnlimitedStock string
|
|
|
|
|
|
StockMode string
|
|
|
|
|
|
OnlineTime string
|
|
|
|
|
|
OfflineTime string
|
|
|
|
|
|
PhysicalAssetConfig string
|
|
|
|
|
|
ServiceAssetConfig string
|
|
|
|
|
|
VirtualAssetConfig string
|
|
|
|
|
|
Metadata string
|
|
|
|
|
|
TenantModuleType string
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var AssetCol = assetCol{
|
|
|
|
|
|
SQLBaseCol: beans.DefSQLBaseCol,
|
|
|
|
|
|
Name: "name",
|
|
|
|
|
|
Description: "description",
|
|
|
|
|
|
Type: "type",
|
|
|
|
|
|
CategoryId: "category_id",
|
|
|
|
|
|
CategoryPath: "category_path",
|
|
|
|
|
|
ImageURL: "image_url",
|
|
|
|
|
|
Images: "images",
|
|
|
|
|
|
Status: "status",
|
|
|
|
|
|
BasePrice: "base_price",
|
|
|
|
|
|
Currency: "currency",
|
|
|
|
|
|
UnlimitedStock: "unlimited_stock",
|
|
|
|
|
|
StockMode: "stock_mode",
|
|
|
|
|
|
OnlineTime: "online_time",
|
|
|
|
|
|
OfflineTime: "offline_time",
|
|
|
|
|
|
PhysicalAssetConfig: "physical_asset_config",
|
|
|
|
|
|
ServiceAssetConfig: "service_asset_config",
|
|
|
|
|
|
VirtualAssetConfig: "virtual_asset_config",
|
|
|
|
|
|
Metadata: "metadata",
|
|
|
|
|
|
TenantModuleType: "tenant_module_type",
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-18 10:18:03 +08:00
|
|
|
|
// Asset 资产实体
|
|
|
|
|
|
type Asset struct {
|
2026-03-19 17:45:06 +08:00
|
|
|
|
beans.SQLBaseDO `orm:",inherit"`
|
2026-03-18 10:18:03 +08:00
|
|
|
|
// 基础信息
|
2026-03-19 17:45:06 +08:00
|
|
|
|
Name string `orm:"name" json:"name" description:"资产名称"`
|
|
|
|
|
|
Description string `orm:"description" json:"description" description:"资产描述"`
|
|
|
|
|
|
Type consts.AssetType `orm:"type" json:"type" description:"资产类型:physical实物/virtual虚拟/service服务"`
|
|
|
|
|
|
CategoryId int64 `orm:"category_id" json:"categoryId" description:"分类ID"`
|
|
|
|
|
|
CategoryPath string `orm:"category_path" json:"categoryPath" description:"分类路径"`
|
|
|
|
|
|
ImageURL string `orm:"image_url" json:"imageUrl" description:"主图URL"`
|
|
|
|
|
|
Images []string `orm:"images" json:"images" description:"图片列表(JSONB)"`
|
|
|
|
|
|
Status consts.AssetStatusType `orm:"status" json:"status" description:"资产状态:1启用/0停用"`
|
|
|
|
|
|
BasePrice int `orm:"base_price" json:"basePrice" description:"基础价格(分为单位)"`
|
|
|
|
|
|
Currency string `orm:"currency" json:"currency" description:"货币单位,默认CNY"`
|
|
|
|
|
|
UnlimitedStock bool `orm:"unlimited_stock" json:"unlimitedStock" description:"是否无库存限制"`
|
|
|
|
|
|
StockMode stock.StockMode `orm:"stock_mode" json:"stockMode" description:"库存管理模式:1-明细模式 2-批次模式"`
|
|
|
|
|
|
OnlineTime *gtime.Time `orm:"online_time" json:"onlineTime,omitempty" description:"上线时间"` // 上线和下线时间配置(由定时任务处理资产状态)
|
|
|
|
|
|
OfflineTime *gtime.Time `orm:"offline_time" json:"offlineTime,omitempty" description:"下线时间"` // 上线和下线时间配置(由定时任务处理资产状态)
|
2026-03-18 10:18:03 +08:00
|
|
|
|
|
|
|
|
|
|
// 类型专用配置 - 实物资产配置(JSONB)
|
|
|
|
|
|
PhysicalAssetConfig *gjson.Json `orm:"physical_asset_config" json:"physicalAssetConfig" description:"实物资产配置(JSONB)"`
|
|
|
|
|
|
// 类型专用配置 - 服务资产配置(JSONB)
|
|
|
|
|
|
ServiceAssetConfig *gjson.Json `orm:"service_asset_config" json:"serviceAssetConfig" description:"服务资产配置(JSONB)"`
|
|
|
|
|
|
// 类型专用配置 - 虚拟资产配置(JSONB)
|
|
|
|
|
|
VirtualAssetConfig *gjson.Json `orm:"virtual_asset_config" json:"virtualAssetConfig" description:"虚拟资产配置(JSONB)"`
|
|
|
|
|
|
// 扩展字段(JSONB)
|
2026-03-19 17:45:06 +08:00
|
|
|
|
Metadata []gjson.Json `orm:"metadata" json:"metadata" description:"动态元数据(JSONB)"`
|
2026-03-18 10:18:03 +08:00
|
|
|
|
|
2026-03-19 17:45:06 +08:00
|
|
|
|
TenantModuleType beans.TenantModuleType `orm:"tenant_module_type" json:"tenantModuleType" description:"租户模块类型"`
|
2026-03-18 10:18:03 +08:00
|
|
|
|
}
|