This commit is contained in:
2026-05-01 11:03:19 +08:00
parent b6a199887e
commit aa8a1190f0
24 changed files with 2552 additions and 0 deletions

28
schema/blocks_index.go Normal file
View File

@@ -0,0 +1,28 @@
package schema
import "gorm.io/gorm"
// BlocksIndex 板块索引(采用 dataset/stock 的 code 唯一约束)。
type BlocksIndex struct {
gorm.Model
Code string `gorm:"type:varchar(50);not null;default:'';comment:板块代码;uniqueIndex:uq_blocks_index_code" json:"code"`
Name string `gorm:"type:varchar(50);not null;default:'';comment:板块名称" json:"name"`
IsRecommend bool `gorm:"type:bool;not null;default:false;comment:是否推荐" json:"is_recommend"`
}
func (BlocksIndex) TableName() string {
return "blocks_index"
}
// Key 板块业务主键code。
func (b *BlocksIndex) Key() string {
return b.Code
}
// DisplayName 展示名称:非空 name否则回退 code。
func (b *BlocksIndex) DisplayName() string {
if b.Name != "" {
return b.Name
}
return b.Code
}