hospital-admin-api/api/model/systemConfig.go

34 lines
1.0 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 (
"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
}