修改了手机号登陆1

This commit is contained in:
2024-08-15 15:47:28 +08:00
parent adb565257d
commit 9a3a6bbb2e
5 changed files with 344 additions and 7 deletions
+38
View File
@@ -0,0 +1,38 @@
package model
import (
"gorm.io/gorm"
"hepa-calc-api/global"
"time"
)
type BaseArea struct {
Id int64 `gorm:"column:id;type:bigint(20);primary_key;AUTO_INCREMENT" json:"id"`
CreateDate time.Time `gorm:"column:create_date;type:datetime;NOT NULL" json:"create_date"`
ModifyDate time.Time `gorm:"column:modify_date;type:datetime;NOT NULL" json:"modify_date"`
Orders int `gorm:"column:orders;type:int(11)" json:"orders"`
FullName string `gorm:"column:full_name;type:longtext;NOT NULL" json:"full_name"`
Name string `gorm:"column:name;type:varchar(100);NOT NULL" json:"name"`
TreePath string `gorm:"column:tree_path;type:varchar(255);NOT NULL" json:"tree_path"`
Parent int64 `gorm:"column:parent;type:bigint(20)" json:"parent"`
CanClinic int `gorm:"column:can_clinic;type:int(11);default:1" json:"can_clinic"`
Model
}
func (m *BaseArea) TableName() string {
return "base_area"
}
func (m *BaseArea) BeforeCreate(tx *gorm.DB) error {
if m.Id == 0 {
m.Id = 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
}
+33
View File
@@ -0,0 +1,33 @@
package model
import (
"gorm.io/gorm"
"hepa-calc-api/global"
"time"
)
// BaseNation 基础-民族表
type BaseNation struct {
NationId int64 `gorm:"column:nation_id;type:bigint(19);primary_key;comment:主键id" json:"nation_id"`
AppIden string `gorm:"column:app_iden;type:varchar(255);comment:app唯一标识" json:"app_iden"`
NationName string `gorm:"column:nation_name;type:varchar(255);comment:民族名称" json:"nation_name"`
Model
}
func (m *BaseNation) TableName() string {
return "base_nation"
}
func (m *BaseNation) BeforeCreate(tx *gorm.DB) error {
if m.NationId == 0 {
m.NationId = 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
}