case-open-api/api/model/ProjectPlatformArea.go
2024-12-30 16:34:26 +08:00

35 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 (
"case-open-api/global"
"gorm.io/gorm"
"time"
)
// ProjectPlatformArea 关联平台-白名单-省份
type ProjectPlatformArea struct {
WhiteAreaId int64 `gorm:"column:white_area_id;type:bigint(19);primary_key;comment:主键id" json:"white_area_id"`
PlatformId int64 `gorm:"column:platform_id;type:bigint(19);comment:关联平台id;NOT NULL" json:"platform_id"`
AreaName string `gorm:"column:area_name;type:varchar(100);comment:地址名称;NOT NULL" json:"area_name"`
Status int `gorm:"column:status;type:tinyint(1);default:1;comment:状态1:正常 2:禁用)" json:"status"`
Model
}
func (m *ProjectPlatformArea) TableName() string {
return "project_platform_area"
}
func (m *ProjectPlatformArea) BeforeCreate(tx *gorm.DB) error {
if m.WhiteAreaId == 0 {
m.WhiteAreaId = 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
}