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.
45 lines
3.0 KiB
45 lines
3.0 KiB
2 months ago
|
package models
|
||
|
|
||
|
import (
|
||
|
"ims/util/db/dts"
|
||
|
"time"
|
||
|
|
||
|
"github.com/shopspring/decimal"
|
||
|
"gorm.io/gorm"
|
||
|
)
|
||
|
|
||
|
// Supplier 供应商
|
||
|
type Supplier struct {
|
||
|
ID uint `json:"id" gorm:"primarykey"` // 供应商编号
|
||
|
Code string `json:"code" gorm:"uniqueIndex"` // 供应商编码
|
||
|
Name string `json:"name" gorm:"uniqueIndex"` // 供应商名称
|
||
|
TypeID uint `json:"type_id"` // 分类编号
|
||
|
LevelID dts.NullUint `json:"level_id"` // 供应商级别
|
||
|
SignedAt time.Time `json:"signed_at"` // 签约时间(签约开始日期)
|
||
|
ExpiredAt dts.NullTime `json:"expired_at"` // 到期时间(签约结束日期)
|
||
|
SettlementID dts.NullUint `json:"settlement_id"` // 结算方式
|
||
|
CreditLimit decimal.Decimal `json:"credit_limit"` // 信用额度
|
||
|
PrincipalID dts.NullUint `json:"principal_id"` // 销售负责人编号
|
||
|
|
||
|
CreatedBy uint `json:"created_by"` // 创建者(员工编号)
|
||
|
CreatedAt time.Time `json:"created_at"` // 创建时间
|
||
|
UpdatedBy dts.NullUint `json:"updated_by"` // 创建者(员工编号)
|
||
|
UpdatedAt time.Time `json:"updated_at"` // 上次操作时间
|
||
|
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"` // 删除数据的员工
|
||
|
|
||
|
Contracts []File `json:"contracts" gorm:"polymorphic:Owner;polymorphicValue:supplier-contract"` // 合同附件
|
||
|
Address *Address `json:"address,omitempty" gorm:"polymorphic:Owner;polymorphicValue:supplier"` // 客户地址
|
||
|
Remittance *Remittance `json:"remittance" gorm:"polymorphic:Owner;polymorphicValue:supplier"` // 财务信息
|
||
|
Linkmen []Linkman `json:"linkmen,omitempty" gorm:"polymorphic:Owner;polymorphicValue:supplier"` // 联系人列表
|
||
|
Certifications []Certification `json:"certifications" gorm:"polymorphic:Owner;polymorphicValue:supplier"` // 资质列表
|
||
|
Principal *Employee `json:"principal" gorm:"foreignKey:PrincipalID"` // 销售负责人
|
||
|
Settlement *Tag `json:"settlement" gorm:"foreignKey:SettlementID"` // 结算方式
|
||
|
Type *Tag `json:"type,omitempty" gorm:"foreignKey:TypeID"` // 供应商分类 - 比如:成品供应商、零件供应商、集合供应商等
|
||
|
Level *Tag `json:"level,omitempty" gorm:"foreignKey:LevelID"` // 供应商等级
|
||
|
}
|