34 lines
2.1 KiB
Go
34 lines
2.1 KiB
Go
package models
|
|
|
|
import "gorm.io/datatypes"
|
|
|
|
// BookInfo 书籍信息表
|
|
type BookInfo struct {
|
|
ID int64 `json:"id" gorm:"primarykey;comment:自增ID"`
|
|
Fid int64 `json:"fid" gorm:"not null;default:0;comment:父级ID"`
|
|
Type int8 `json:"type" gorm:"not null;comment:类型 1正常 2套装书 3 一号多书 4无书号"`
|
|
ISBN string `json:"isbn" gorm:"size:20;not null;default:'';comment:ISBN;index:idx_isbn"`
|
|
FISBN string `json:"f_isbn" gorm:"size:20;not null;default:'';comment:FISBN;"`
|
|
BookName string `json:"book_name" gorm:"size:100;not null;default:'';comment:书名"`
|
|
FBookName string `json:"f_book_name" gorm:"size:100;not null;default:'';comment:副书名"`
|
|
Author string `json:"author" gorm:"size:100;not null;default:'';comment:作者"`
|
|
Publishing string `json:"publishing" gorm:"size:50;not null;default:'';comment:出版社"`
|
|
PublicationTime int64 `json:"publication_time" gorm:"type:bigint;not null;default:0;comment:出版日期时间戳"`
|
|
PublicationDate string `json:"publication_date" gorm:"size:10;not null;default:'';comment:出版日期年-月"`
|
|
Binding string `json:"binding" gorm:"size:10;not null;default:'';comment:装帧"`
|
|
PagesCount int64 `json:"pages_count" gorm:"not null;default:0;comment:页数"`
|
|
WordsCount int64 `json:"words_count" gorm:"not null;default:0;comment:字数"`
|
|
Format int64 `json:"format" gorm:"not null;default:0;comment:开本"`
|
|
Price int64 `json:"price" gorm:"not null;default:0;comment:价格"`
|
|
CatID datatypes.JSON `json:"cat_id" gorm:"type:json;not null;comment:类目json"`
|
|
LiveImage datatypes.JSON `json:"live_image" gorm:"column:live_image;type:json;not null;comment:实拍图json"`
|
|
}
|
|
|
|
func (BookInfo) TableName() string {
|
|
return "book_info"
|
|
}
|
|
|
|
func (BookInfo) TableOptions() string {
|
|
return "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='书籍信息表'"
|
|
}
|