143 lines
7.3 KiB
Go
143 lines
7.3 KiB
Go
package dto
|
||
|
||
import (
|
||
consts "assets/consts/asset"
|
||
"assets/consts/stock"
|
||
"assets/model/config"
|
||
enumDto "assets/model/dto/enum"
|
||
|
||
"gitea.com/red-future/common/beans"
|
||
"github.com/gogf/gf/v2/frame/g"
|
||
"github.com/gogf/gf/v2/os/gtime"
|
||
)
|
||
|
||
// CreateAssetReq 创建资产请求
|
||
type CreateAssetReq struct {
|
||
g.Meta `path:"/createAsset" method:"post" tags:"资产管理" summary:"创建资产" dc:"创建新的资产"`
|
||
// 基础信息
|
||
Name string `json:"name" v:"required" dc:"资产名称"`
|
||
Description string `json:"description" dc:"资产描述"`
|
||
Type consts.AssetType `json:"type" v:"required" dc:"资产类型:physical实物/virtual虚拟/service服务"`
|
||
CategoryId int64 `json:"categoryId" v:"required" dc:"分类ID"`
|
||
CategoryPath string `json:"categoryPath" dc:"分类路径"`
|
||
ImageURL string `json:"imageUrl" dc:"主图URL"`
|
||
Images []string `json:"images" dc:"图片列表"`
|
||
Status consts.AssetStatusType `json:"status" dc:"状态:1/0" d:"1"`
|
||
UnlimitedStock bool `json:"unlimitedStock" dc:"是否无库存限制"`
|
||
StockMode stock.StockMode `json:"stockMode" dc:"库存管理模式:1-明细模式 2-批次模式" d:"2"`
|
||
OnlineTime *gtime.Time `json:"onlineTime,omitempty" dc:"上线时间(格式:2006-01-02 15:04:05)"`
|
||
OfflineTime *gtime.Time `json:"offlineTime,omitempty" dc:"下线时间(格式:2006-01-02 15:04:05)"`
|
||
// 类型专用配置 - 实物资产配置
|
||
PhysicalAssetConfig *config.PhysicalAssetConfig `json:"physicalAssetConfig"`
|
||
// 类型专用配置 - 服务资产配置
|
||
ServiceAssetConfig *config.ServiceAssetConfig `json:"serviceAssetConfig"`
|
||
// 类型专用配置 - 虚拟资产配置
|
||
VirtualAssetConfig *config.VirtualAssetConfig `json:"virtualAssetConfig"`
|
||
// 扩展字段
|
||
Metadata []map[string]interface{} `json:"metadata" dc:"动态元数据"`
|
||
|
||
TenantModuleType beans.TenantModuleType `json:"tenantModuleType" dc:"租户模块类型"`
|
||
}
|
||
|
||
// CreateAssetRes 创建资产响应
|
||
type CreateAssetRes struct {
|
||
Id int64 `json:"id" dc:"资产ID"`
|
||
}
|
||
|
||
// ListAssetReq 获取资产列表请求
|
||
type ListAssetReq struct {
|
||
g.Meta `path:"/listAssets" method:"get" tags:"资产管理" summary:"获取资产列表" dc:"分页查询资产列表,支持多条件筛选"`
|
||
*beans.Page
|
||
Name string `json:"name" dc:"资产名称"`
|
||
Type consts.AssetType `json:"type" dc:"资产类型"`
|
||
CategoryId int64 `json:"categoryId" dc:"分类ID"`
|
||
CategoryPath string `json:"categoryPath" dc:"分类路径"`
|
||
Status consts.AssetStatusType `json:"status" dc:"状态"`
|
||
TenantModuleType beans.TenantModuleType `json:"tenantModuleType" dc:"租户模块类型"`
|
||
Keyword string `json:"keyword" dc:"关键词搜索"`
|
||
}
|
||
|
||
// ListAssetRes 获取资产列表响应
|
||
type ListAssetRes struct {
|
||
List []AssetItem `json:"list" dc:"资产列表"`
|
||
Total int `json:"total" dc:"总数"`
|
||
}
|
||
|
||
type AssetItem struct {
|
||
Id int64 `json:"id"` // 资产ID
|
||
Name string `json:"name"` // 资产名称
|
||
Type consts.AssetType `json:"type"` // 资产类型:physical实物/virtual虚拟/service服务
|
||
TypeName string `json:"typeName"` // 资产类型:physical实物/virtual虚拟/service服务
|
||
CategoryId int64 `json:"categoryId"` // 分类ID
|
||
UnlimitedStock bool `json:"unlimitedStock"` // 是否无库存限制
|
||
Status consts.AssetStatusType `json:"status"` // 资产状态:active启用/inactive停用
|
||
BasePrice int `json:"basePrice"` // 基础价格(分为单位)
|
||
OnlineTime *gtime.Time `json:"onlineTime,omitempty"` // 上线时间
|
||
OfflineTime *gtime.Time `json:"offlineTime,omitempty"` // 下线时间
|
||
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
||
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
|
||
}
|
||
|
||
// GetAssetReq 获取资产详情请求
|
||
type GetAssetReq struct {
|
||
g.Meta `path:"/getAsset" method:"get" tags:"资产管理" summary:"获取资产详情" dc:"获取资产详情"`
|
||
Id int64 `json:"id" v:"required" dc:"资产ID"`
|
||
}
|
||
|
||
// GetAssetRes 获取资产详情响应
|
||
type GetAssetRes struct {
|
||
*AssetItem
|
||
CategoryName string `json:"categoryName" dc:"分类名称"`
|
||
ImgAddressPrefix string `json:"imgAddressPrefix"`
|
||
}
|
||
|
||
// GetAssetAndSkuReq 获取资产和Sku详情请求
|
||
type GetAssetAndSkuReq struct {
|
||
g.Meta `path:"/getAssetAndSku" method:"get" tags:"资产管理" summary:"获取资产和SKU详情" dc:"获取资产和SKU详情"`
|
||
Id int64 `json:"id" v:"required" dc:"资产ID"`
|
||
}
|
||
|
||
// GetAssetAndSkuRes 获取资产详情响应
|
||
type GetAssetAndSkuRes struct {
|
||
*AssetItem
|
||
Skus []AssetSkuItem `json:"skus" dc:"SKU列表"`
|
||
TenantModuleType []enumDto.KeyValue `json:"tenantModuleType" dc:"租户模块类型"`
|
||
ImgAddressPrefix string `json:"imgAddressPrefix"`
|
||
}
|
||
|
||
// UpdateAssetReq 更新资产请求
|
||
type UpdateAssetReq struct {
|
||
g.Meta `path:"/updateAsset" method:"put" tags:"资产管理" summary:"更新资产" dc:"更新资产信息"`
|
||
Id int64 `json:"id" v:"required" dc:"资产ID"`
|
||
Name string `json:"name" dc:"资产名称"`
|
||
Description string `json:"description" dc:"资产描述"`
|
||
Type consts.AssetType `json:"type" dc:"资产类型:physical实物/virtual虚拟/service服务"`
|
||
CategoryId int64 `json:"categoryId" dc:"分类ID"`
|
||
ImageURL string `json:"imageUrl" dc:"主图URL"`
|
||
Images []string `json:"images" dc:"图片列表"`
|
||
Status consts.AssetStatusType `json:"status,omitempty" dc:"状态:1/0"`
|
||
OnlineTime *gtime.Time `json:"onlineTime,omitempty" dc:"上线时间(格式:2006-01-02 15:04:05)"`
|
||
OfflineTime *gtime.Time `json:"offlineTime,omitempty" dc:"下线时间(格式:2006-01-02 15:04:05)"`
|
||
// 类型专用配置 - 实物资产配置
|
||
PhysicalAssetConfig *config.PhysicalAssetConfig `json:"physicalAssetConfig"`
|
||
// 类型专用配置 - 服务资产配置
|
||
ServiceAssetConfig *config.ServiceAssetConfig `json:"serviceAssetConfig"`
|
||
// 类型专用配置 - 虚拟资产配置
|
||
VirtualAssetConfig *config.VirtualAssetConfig `json:"virtualAssetConfig"`
|
||
// 扩展字段
|
||
Metadata []map[string]interface{} `json:"metadata" dc:"动态元数据"`
|
||
}
|
||
|
||
// UpdateAssetStatusReq 更新资产状态请求
|
||
type UpdateAssetStatusReq struct {
|
||
g.Meta `path:"/updateAssetStatus" method:"put" tags:"资产管理" summary:"更新资产状态" dc:"更新资产状态"`
|
||
Id int64 `json:"id" v:"required" dc:"资产ID"`
|
||
Status consts.AssetStatusType `json:"status" v:"required|in:1,0" dc:"状态:1启用/0停用"`
|
||
}
|
||
|
||
// DeleteAssetReq 删除资产请求
|
||
type DeleteAssetReq struct {
|
||
g.Meta `path:"/deleteAsset" method:"delete" tags:"资产管理" summary:"删除资产" dc:"删除资产"`
|
||
Id int64 `json:"id" v:"required" dc:"资产ID"`
|
||
}
|