case-open-api/api/model/ProjectPlatformDynamicItem.go
2024-12-30 16:34:26 +08:00

34 lines
1.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package model
import (
"case-open-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
}