All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m21s
主要变更: - 新增 AssetIdentifier 模型及 Store,统一管理资产标识符(ICCID/IMEI/SN 等) - 新增迁移:asset_identifier 表、order 表新增 asset_identifier 字段、iot_card.virtual_no NOT NULL 约束 - 资产 Handler/Service/Route 全面重构,支持标识符路由查询与解析 - 新增资产历史订单查询接口,支持跨设备/卡/钱包维度的订单聚合 - 设备与物联卡导入任务强制校验虚拟号,缺失时直接拒绝 - Excel 工具函数优化,前端导入指引文档同步更新 - 归档三个 OpenSpec 提案:asset-identifier-standardization、asset-historical-orders、import-mandatory-virtual-no - 更新 OpenAPI 文档及相关 DTO Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
25 lines
1.1 KiB
Go
25 lines
1.1 KiB
Go
package model
|
||
|
||
import "time"
|
||
|
||
// AssetIdentifier 全局资产标识符注册表模型
|
||
// 在数据库层保证 IoT 卡的 ICCID/VirtualNo 与设备的 VirtualNo 跨两张表全局唯一
|
||
// 不使用 gorm.Model(无需软删除),仅包含核心字段
|
||
type AssetIdentifier struct {
|
||
ID uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
||
Identifier string `gorm:"column:identifier;type:varchar(100);uniqueIndex:uq_asset_identifier;not null;comment:标识符值(ICCID 或 VirtualNo,全局唯一)" json:"identifier"`
|
||
AssetType string `gorm:"column:asset_type;type:varchar(20);not null;comment:资产类型:iot_card 或 device" json:"asset_type"`
|
||
AssetID uint `gorm:"column:asset_id;index:idx_asset_identifier_asset;not null;comment:对应资产的主键 ID" json:"asset_id"`
|
||
CreatedAt time.Time `gorm:"column:created_at;not null;default:now();comment:写入时间" json:"created_at"`
|
||
}
|
||
|
||
// TableName 指定表名
|
||
func (AssetIdentifier) TableName() string {
|
||
return "tb_asset_identifier"
|
||
}
|
||
|
||
const (
|
||
AssetTypeIotCard = "iot_card"
|
||
AssetTypeDevice = "device"
|
||
)
|