Files
assets/model/entity/asset/asset.go

88 lines
4.0 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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"
)
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",
}
// Asset 资产实体
type Asset struct {
beans.SQLBaseDO `orm:",inherit"`
// 基础信息
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:"下线时间"` // 上线和下线时间配置(由定时任务处理资产状态)
// 类型专用配置 - 实物资产配置(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)
Metadata []gjson.Json `orm:"metadata" json:"metadata" description:"动态元数据(JSONB)"`
TenantModuleType beans.TenantModuleType `orm:"tenant_module_type" json:"tenantModuleType" description:"租户模块类型"`
}