Files
junhong_cmp_fiber/migrations/000105_create_asset_identifier.up.sql
huang 80c6f6c756
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m21s
feat: 资产标识符标准化、资产历史订单查询及导入虚拟号强制验证
主要变更:
- 新增 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>
2026-04-07 17:39:36 +08:00

15 lines
874 B
SQL
Raw 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.
-- 创建全局资产标识符注册表,保证 ICCID/VirtualNo 跨 tb_iot_card 和 tb_device 全局唯一
CREATE TABLE IF NOT EXISTS tb_asset_identifier (
id BIGSERIAL PRIMARY KEY,
identifier VARCHAR(100) NOT NULL,
asset_type VARCHAR(20) NOT NULL,
asset_id BIGINT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
CONSTRAINT uq_asset_identifier UNIQUE (identifier)
);
CREATE INDEX IF NOT EXISTS idx_asset_identifier_asset ON tb_asset_identifier(asset_type, asset_id);
COMMENT ON TABLE tb_asset_identifier IS '全局资产标识符注册表';
COMMENT ON COLUMN tb_asset_identifier.identifier IS '标识符值ICCID 或 VirtualNo全局唯一';
COMMENT ON COLUMN tb_asset_identifier.asset_type IS '资产类型iot_card 或 device';
COMMENT ON COLUMN tb_asset_identifier.asset_id IS '对应资产的主键 ID';