refactor product domain models
This commit is contained in:
25
backend/api/internal/models/product_repair.go
Normal file
25
backend/api/internal/models/product_repair.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.apinb.com/bsm-sdk/core/database"
|
||||
)
|
||||
|
||||
// ProductRepair 对应 product_repair,保存产品检修过程与结果。
|
||||
type ProductRepair struct {
|
||||
Entity // 公共实体字段
|
||||
ProductInfoID uint64 `gorm:"column:product_info_id;not null;index" json:"product_info_id"` // 产品档案自增主键
|
||||
RepairNo string `gorm:"column:repair_no;type:varchar(64);not null;uniqueIndex" json:"repair_no"` // 检修单号
|
||||
RepairType string `gorm:"column:repair_type;type:varchar(32);not null" json:"repair_type"` // 检修类型
|
||||
StartedAt time.Time `gorm:"column:started_at;type:timestamptz;not null" json:"started_at"` // 开始时间
|
||||
CompletedAt *time.Time `gorm:"column:completed_at;type:timestamptz" json:"completed_at"` // 完成时间
|
||||
Result string `gorm:"column:result;type:varchar(32);not null;default:'pending'" json:"result"` // 检修结果
|
||||
TargetStatus string `gorm:"column:target_status;type:varchar(32);not null;default:''" json:"target_status"` // 完成后的产品状态
|
||||
Content string `gorm:"column:content;type:text;not null;default:''" json:"content"` // 检修内容
|
||||
Operator string `gorm:"column:operator;type:varchar(64);not null;default:''" json:"operator"` // 检修人员
|
||||
Remark string `gorm:"column:remark;type:text;not null;default:''" json:"remark"` // 备注
|
||||
}
|
||||
|
||||
func init() { database.AppendMigrate(&ProductRepair{}) }
|
||||
func (table *ProductRepair) TableName() string { return "product_repair" }
|
||||
Reference in New Issue
Block a user