34 lines
1.0 KiB
Go
34 lines
1.0 KiB
Go
package model
|
||
|
||
import (
|
||
"case-api/global"
|
||
"gorm.io/gorm"
|
||
"time"
|
||
)
|
||
|
||
// ProjectPlatformDynamicItem 关联平台-白名单-动态-明细
|
||
type ProjectPlatformDynamicItem struct {
|
||
ItemId int64 `gorm:"column:item_id;type:bigint(19);primary_key;comment:主键id" json:"item_id"`
|
||
WhiteDynamicId int64 `gorm:"column:white_dynamic_id;type:bigint(19);comment:关联动态白名单id;NOT NULL" json:"white_dynamic_id"`
|
||
ItemValue string `gorm:"column:item_value;type:varchar(255);comment:明细值(area:省份 level:医院等级 title:职称 department:科室 url:地址栏 类型间以-链接)" json:"item_value"`
|
||
Model
|
||
}
|
||
|
||
func (m *ProjectPlatformDynamicItem) TableName() string {
|
||
return "project_platform_dynamic_item"
|
||
}
|
||
|
||
func (m *ProjectPlatformDynamicItem) BeforeCreate(tx *gorm.DB) error {
|
||
if m.ItemId == 0 {
|
||
m.ItemId = global.Snowflake.Generate().Int64()
|
||
}
|
||
|
||
m.CreatedAt = LocalTime(time.Now())
|
||
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||
|
||
m.UpdatedAt = LocalTime(time.Now())
|
||
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||
|
||
return nil
|
||
}
|