🎨 新增酒单CRUD & 喜欢的酒单列表CRUD
This commit is contained in:
13
model/entity/like_wine.go
Normal file
13
model/entity/like_wine.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package entity
|
||||
|
||||
import "Lee-WineList/common/types"
|
||||
|
||||
type LikeWine struct {
|
||||
types.BaseDbModel
|
||||
UserId int `gorm:"column:user_id;type:int(11) unsigned;comment:用户ID;NOT NULL" json:"user_id"`
|
||||
WineId int `gorm:"column:wine_id;type:int(11) unsigned;comment:酒ID;NOT NULL" json:"wine_id"`
|
||||
}
|
||||
|
||||
func (LikeWine) TableName() string {
|
||||
return "like_wines"
|
||||
}
|
@@ -4,9 +4,10 @@ import "Lee-WineList/common/types"
|
||||
|
||||
type Material struct {
|
||||
types.BaseDbModel
|
||||
Name string `gorm:"column:name;type:varchar(255);comment:材料名;NOT NULL" json:"name"`
|
||||
ML string `gorm:"column:ml;type:int(11) unsigned;comment:毫升;NOT NULL" json:"ml"`
|
||||
WindId int `gorm:"column:wine_id;type:int(11) unsigned;comment:酒ID;NOT NULL" json:"wine_id"`
|
||||
Name string `gorm:"column:name;type:varchar(255);comment:材料名;NOT NULL" json:"name"`
|
||||
ML string `gorm:"column:ml;type:int(11) unsigned;comment:毫升" json:"ml"`
|
||||
OtherUnit string `gorm:"column:other_unit;type:varchar(255);comment:其他单位" json:"other_unit"`
|
||||
WindId int `gorm:"column:wine_id;type:int(11) unsigned;comment:酒ID;NOT NULL" json:"wine_id"`
|
||||
}
|
||||
|
||||
func (Material) TableName() string {
|
||||
|
@@ -12,7 +12,7 @@ type Wine struct {
|
||||
Category string `gorm:"column:category;type:varchar(255);comment:分类;NOT NULL" json:"category"`
|
||||
Steps string `gorm:"column:steps;type:varchar(255);comment:步骤;NOT NULL" json:"steps"`
|
||||
Context string `gorm:"column:context;type:varchar(255);comment:酒文;NOT NULL" json:"context"`
|
||||
Materials []Material `gorm:"many2many:wine_materials"`
|
||||
Materials []Material `gorm:"many2many:wine_materials" json:"materials"`
|
||||
UserId int `gorm:"column:user_id;type:int(11) unsigned;comment:用户ID;NOT NULL" json:"user_id"`
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user