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>
31 lines
1.3 KiB
Go
31 lines
1.3 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
type FinanceRecord struct {
|
|
Base
|
|
HotelID uint64 `gorm:"not null;index" json:"hotel_id"`
|
|
PartnerID *uint64 `json:"partner_id"`
|
|
Type string `gorm:"type:enum('receivable','payable','receipt','payment')" json:"type"`
|
|
Amount float64 `gorm:"type:decimal(14,2)" json:"amount"`
|
|
Balance float64 `gorm:"type:decimal(14,2)" json:"balance"`
|
|
RefType string `gorm:"size:30" json:"ref_type"`
|
|
RefID *uint64 `json:"ref_id"`
|
|
OperatorID uint64 `gorm:"not null" json:"operator_id"`
|
|
RecordDate time.Time `gorm:"type:date" json:"record_date"`
|
|
CustomFields JSON `gorm:"type:json" json:"custom_fields,omitempty"`
|
|
Remark string `gorm:"size:500" json:"remark"`
|
|
|
|
Partner *Partner `gorm:"foreignKey:PartnerID" json:"partner,omitempty"`
|
|
}
|
|
|
|
type NumberRule struct {
|
|
ID uint64 `gorm:"primaryKey;autoIncrement" json:"id"`
|
|
HotelID uint64 `gorm:"not null;uniqueIndex:uk_hotel_type" json:"hotel_id"`
|
|
Type string `gorm:"size:30;uniqueIndex:uk_hotel_type" json:"type"`
|
|
Prefix string `gorm:"size:20;default:''" json:"prefix"`
|
|
CurrentNo int `gorm:"default:0" json:"current_no"`
|
|
DateFormat string `gorm:"size:20;default:'YYYYMMDD'" json:"date_format"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|