0e42f0e417
- 项目目录结构:backend/ deploy/ schema/ migrations/ - 数据库 Schema:所有建表 SQL,含 hotel_id 多租户隔离 - Go 后端:config、model、handler、service、middleware、router - 认证:账号密码登录 + JWT(Access + Refresh Token) - 许可证:HMAC-SHA256 激活码生成 + 设备绑定验证 - 业务模块:商品、仓库、往来单位、入库、出库、库存、盘点 - 库存事务:入库/出库审核时原子更新库存 + 流水记录 - 数据导入:Excel/CSV 批量导入商品、往来单位 - Docker Compose:本地 MySQL + Adminer Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
28 lines
1.1 KiB
Go
28 lines
1.1 KiB
Go
package model
|
|
|
|
type ProductCategory struct {
|
|
TenantBase
|
|
Name string `gorm:"size:100;not null" json:"name"`
|
|
ParentID *uint64 `json:"parent_id"`
|
|
SortOrder int `gorm:"default:0" json:"sort_order"`
|
|
}
|
|
|
|
type Product struct {
|
|
TenantBase
|
|
Code string `gorm:"size:50" json:"code"`
|
|
Barcode string `gorm:"size:100" json:"barcode"`
|
|
Name string `gorm:"size:200;not null" json:"name"`
|
|
Series string `gorm:"size:100" json:"series"`
|
|
Spec string `gorm:"size:100" json:"spec"`
|
|
Unit string `gorm:"size:20" json:"unit"`
|
|
CategoryID *uint64 `json:"category_id"`
|
|
Brand string `gorm:"size:100" json:"brand"`
|
|
PurchasePrice float64 `gorm:"type:decimal(12,2)" json:"purchase_price"`
|
|
SalePrice float64 `gorm:"type:decimal(12,2)" json:"sale_price"`
|
|
MinStock int `gorm:"default:0" json:"min_stock"`
|
|
CustomFields JSON `gorm:"type:json" json:"custom_fields,omitempty"`
|
|
Remark string `gorm:"size:500" json:"remark"`
|
|
|
|
Category *ProductCategory `gorm:"foreignKey:CategoryID" json:"category,omitempty"`
|
|
}
|