34 lines
1.0 KiB
Go
34 lines
1.0 KiB
Go
package model
|
||
|
||
import (
|
||
"gorm.io/gorm"
|
||
"hospital-admin-api/global"
|
||
"time"
|
||
)
|
||
|
||
// SystemConfig 系统配置表
|
||
type SystemConfig struct {
|
||
SystemConfigId int64 `gorm:"column:system_config_id;type:int(10);primary_key;comment:主键id" json:"system_config_id"`
|
||
IsAutoPharVerifyPrescription int `gorm:"column:is_auto_phar_verify_prescription;type:tinyint(1);default:0;comment:药师是否自动审核处方(0:否 1:是)" json:"is_auto_phar_verify_prescription"`
|
||
IsAnnualReview int `gorm:"column:is_annual_review;type:tinyint(1);default:0;comment:是否开启年度审查(0:否 1:是)" json:"is_annual_review"`
|
||
Model
|
||
}
|
||
|
||
func (m *SystemConfig) TableName() string {
|
||
return "gdxz_system_config"
|
||
}
|
||
|
||
func (m *SystemConfig) BeforeCreate(tx *gorm.DB) error {
|
||
if m.SystemConfigId == 0 {
|
||
m.SystemConfigId = 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
|
||
}
|