42 lines
1.7 KiB
Go
42 lines
1.7 KiB
Go
package model
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
"hospital-admin-api/global"
|
|
"time"
|
|
)
|
|
|
|
// DoctorWithdrawalBank 医生提现表-关联银行
|
|
type DoctorWithdrawalBank struct {
|
|
WithdrawalBankId int64 `gorm:"column:withdrawal_bank_id;type:bigint(19);primary_key;comment:主键id" json:"withdrawal_bank_id"`
|
|
WithdrawalId int64 `gorm:"column:withdrawal_id;type:bigint(19)" json:"withdrawal_id"`
|
|
BankId int64 `gorm:"column:bank_id;type:bigint(19);comment:银行id" json:"bank_id"`
|
|
BankCardCode string `gorm:"column:bank_card_code;type:varchar(100);comment:银行卡号" json:"bank_card_code"`
|
|
ProvinceId int `gorm:"column:province_id;type:int(11);comment:省份id" json:"province_id"`
|
|
Province string `gorm:"column:province;type:varchar(40);comment:省份" json:"province"`
|
|
CityId int `gorm:"column:city_id;type:int(11);comment:城市id" json:"city_id"`
|
|
City string `gorm:"column:city;type:varchar(40);comment:城市" json:"city"`
|
|
CountyId int `gorm:"column:county_id;type:int(11);comment:区县id" json:"county_id"`
|
|
County string `gorm:"column:county;type:varchar(255);comment:区县" json:"county"`
|
|
BasicBank *BasicBank `gorm:"foreignKey:BankId;references:bank_id" json:"basic_bank"` // 银行
|
|
Model
|
|
}
|
|
|
|
func (m *DoctorWithdrawalBank) TableName() string {
|
|
return "gdxz_doctor_withdrawal_bank"
|
|
}
|
|
|
|
func (m *DoctorWithdrawalBank) BeforeCreate(tx *gorm.DB) error {
|
|
if m.WithdrawalBankId == 0 {
|
|
m.WithdrawalBankId = 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
|
|
}
|