package models import ( "time" "git.apinb.com/bsm-sdk/core/database" "gorm.io/gorm" ) // OrderRecord 订单数据库模型 type CollectorOrder struct { ID uint `json:"id" gorm:"primaryKey;comment:主键ID"` OrderID int64 `json:"order_id" gorm:"not null;index;comment:订单ID"` AccountID string `json:"account_id" gorm:"type:varchar(50);not null;index;comment:账户ID"` StockCode string `json:"stock_code" gorm:"type:varchar(20);not null;index;comment:股票代码"` Ymd int `json:"ymd" gorm:"not null;index;comment:采集日期(年月日数字格式,如20260407)"` Price float64 `json:"price" gorm:"type:decimal(10,4);not null;default:0;comment:委托价格"` Volume int `json:"volume" gorm:"not null;default:0;comment:委托数量"` OpenPrice float64 `json:"open_price" gorm:"type:decimal(10,4);not null;default:0;column:open_price;comment:开仓价格"` TradedPrice float64 `json:"traded_price" gorm:"type:decimal(10,4);not null;default:0;column:traded_price;comment:成交均价"` TradedVolume int `json:"traded_volume" gorm:"not null;default:0;column:traded_volume;comment:成交数量"` OrderStatus int `json:"order_status" gorm:"not null;default:0;column:order_status;comment:订单状态"` OffsetFlag int `json:"offset_flag" gorm:"not null;default:0;column:offset_flag;comment:开平标志"` OrderTime int64 `json:"order_time" gorm:"not null;column:order_time;comment:下单时间戳"` OrderRemark string `json:"order_remark" gorm:"type:text;column:order_remark;comment:订单备注"` CollectedAt time.Time `json:"collected_at" gorm:"not null;index;comment:数据采集时间"` CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime;comment:记录创建时间"` DeletedAt gorm.DeletedAt `json:"-" gorm:"index;comment:软删除时间"` } func init() { database.AppendMigrate(&CollectorOrder{}) } func (CollectorOrder) TableName() string { return "collector_orders" }