35 lines
1.0 KiB
Go
35 lines
1.0 KiB
Go
package model
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
"hospital-admin-api/global"
|
|
"time"
|
|
)
|
|
|
|
type BasicBank struct {
|
|
BankId int64 `gorm:"column:bank_id;type:bigint(19);primary_key;comment:主键id" json:"bank_id"`
|
|
BankCode string `gorm:"column:bank_code;type:varchar(255);comment:银行编码" json:"bank_code"`
|
|
BankName string `gorm:"column:bank_name;type:varchar(50);comment:银行名称" json:"bank_name"`
|
|
BankIconPath string `gorm:"column:bank_icon_path;type:varchar(255);comment:银行图标地址" json:"bank_icon_path"`
|
|
BankImgPath string `gorm:"column:bank_img_path;type:varchar(255);comment:银行图片地址" json:"bank_img_path"`
|
|
Model
|
|
}
|
|
|
|
func (m *BasicBank) TableName() string {
|
|
return "gdxz_basic_bank"
|
|
}
|
|
|
|
func (m *BasicBank) BeforeCreate(tx *gorm.DB) error {
|
|
if m.BankId == 0 {
|
|
m.BankId = 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
|
|
}
|