33 lines
1.7 KiB
Go
33 lines
1.7 KiB
Go
package models
|
||
|
||
import (
|
||
"git.apinb.com/bsm-sdk/core/database"
|
||
"git.apinb.com/bsm-sdk/core/types"
|
||
"gorm.io/gorm"
|
||
)
|
||
|
||
// MallFreight 运费模板/*
|
||
type MallFreight struct {
|
||
gorm.Model
|
||
types.Std_Identity
|
||
types.Std_Status // 1 正常
|
||
OwnerId uint `gorm:"column:owner_id;Index;"` // 所属机构id
|
||
OwnerIdentity string `gorm:"column:owner_identity;type:varchar(255);not null;" json:"owner_identity"` // 所属机构唯一码
|
||
CreatedIdentity string `gorm:"column:created_identity;type:varchar(36);Index;"` // 创建者一标识,24位NanoID,36位为UUID
|
||
Title string `gorm:"column:title;type:varchar(255);not null;" json:"title"` // 名称
|
||
PostType int32 `gorm:"column:post_type;default:1;" json:"post_type"` // 是否包邮:1包邮,2不包邮
|
||
Quota int64 `gorm:"column:quota;default:0;" json:"quota"` // 当types=1时,满额包邮
|
||
CostType int32 `gorm:"column:cost_type;default:1;" json:"cost_type"` // 计费类型:1计件收费,2按重收费
|
||
RegionType int32 `gorm:"column:region_type;default:2;" json:"region_type"` // 区域限售:1限制,2不限制
|
||
Rules []MallFreightAttr `gorm:"foreignKey:FreightIdentity;references:Identity;" json:"rules"` // 计费规则
|
||
}
|
||
|
||
func init() {
|
||
database.AppendMigrate(&MallFreight{})
|
||
}
|
||
|
||
// TableName .
|
||
func (table *MallFreight) TableName() string {
|
||
return "mall_freight" //对应数据库表名
|
||
}
|