You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ims/app/models/address.go

41 lines
1.8 KiB

2 months ago
package models
import (
"ims/util/db/dts"
"time"
"gorm.io/gorm"
)
const (
AddressForCustomer = "customer" // 消费者
AddressForSupplier = "supplier" // 供应商
AddressForOutbound = "outbound" // 出库单
)
// Address 地址信息
type Address struct {
ID uint `json:"id" gorm:"primaryKey"` // 地址编号
OwnerID uint `json:"owner_id"` // 所属者编号
OwnerType string `json:"owner_type"` // 所属者类型
ProvinceID int `json:"province_id"` // 省份编号
CityID int `json:"city_id"` // 城市编号
CountyID int `json:"county_id"` // 区县编号
Detail string `json:"detail"` // 详细地址
Province *District `json:"district,omitempty" gorm:"foreignKey:ProvinceID"` // 省份
City *District `json:"city,omitempty" gorm:"foreignKey:CityID"` // 城市
County *District `json:"county,omitempty" gorm:"foreignKey:CountyID"` // 区县
CreatedBy uint `json:"created_by"` // 创建者(员工编号)
CreatedAt time.Time `json:"created_at"` // 创建时间
UpdatedBy dts.NullUint `json:"updated_by"` // 创建者(员工编号)
UpdatedAt dts.NullTime `json:"updated_at" gorm:"autoUpdateTime:false"` // 上次操作时间
DeletedBy dts.NullUint `json:"deleted_by"` // 删除者(员工编号)
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"` // 删除数据时间
Creator *Employee `json:"creator,omitempty" gorm:"foreignKey:CreatedBy"` // 创建数据的员工
Updater *Employee `json:"updater,omitempty" gorm:"foreignKey:UpdatedBy"` // 上次更新数据的员工
Deleter *Employee `json:"deleter,omitempty" gorm:"foreignKey:DeletedBy"` // 删除数据的员工
}