package models // Location 库位表 type Location struct { ID int64 `json:"id" gorm:"primarykey;comment:库位ID"` WarehouseID int64 `json:"warehouse_id" gorm:"not null;default:0;index;uniqueIndex:uk_warehouse_code,priority:1;comment:所属仓库ID"` Code string `json:"code" gorm:"size:50;not null;default:'';uniqueIndex:uk_warehouse_code,priority:2;comment:库位编码(如 A-01-02)"` Type int8 `json:"type" gorm:"not null;default:1;comment:库位类型(1:存储库位,2:拣货库位,3:收货库位,4:发货库位,5:退货库位)"` Capacity int64 `json:"capacity" gorm:"not null;default:0;comment:容量(按体积立方厘米或重量克)"` Sort int `json:"sort" gorm:"not null;default:0;comment:排序值(值越小越靠前)"` Status int8 `json:"status" gorm:"type:tinyint(1);not null;default:1;comment:状态(0:禁用,1:启用)"` CreatedAt int64 `json:"created_at" gorm:"type:bigint;not null;default:0;comment:创建时间戳(秒)"` UpdatedAt int64 `json:"updated_at" gorm:"type:bigint;not null;default:0;comment:更新时间戳(秒)"` IsDel int8 `json:"is_del" gorm:"type:tinyint(1);not null;default:0;index:idx_is_del;priority:3;comment:逻辑删除标记(0:未删除,1:已删除)"` } func (Location) TableName() string { return "location" } func (Location) TableOptions() string { return "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='库位表'" }