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

35 lines
1.1 KiB
Go
Raw Permalink 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"
)
// ProjectPlatformGrade 关联平台-白名单-医院等级
type ProjectPlatformGrade struct {
WhiteGradeId int64 `gorm:"column:white_grade_id;type:bigint(19);primary_key;comment:主键id" json:"white_grade_id"`
PlatformId int64 `gorm:"column:platform_id;type:bigint(19);comment:关联平台id;NOT NULL" json:"platform_id"`
Grade string `gorm:"column:grade;type:varchar(100);comment:等级(次字段存疑,等确定医院等级后修改);NOT NULL" json:"grade"`
Status int `gorm:"column:status;type:tinyint(1);default:1;comment:状态1:正常 2:禁用)" json:"status"`
Model
}
func (m *ProjectPlatformGrade) TableName() string {
return "project_platform_grade"
}
func (m *ProjectPlatformGrade) BeforeCreate(tx *gorm.DB) error {
if m.WhiteGradeId == 0 {
m.WhiteGradeId = 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
}