49 lines
3.9 KiB
Go
49 lines
3.9 KiB
Go
package models
|
||
|
||
import "time"
|
||
|
||
// TenantCrmContract 合同表: yz_backend_crm_contract
|
||
//
|
||
// 说明:
|
||
// - project_id 为空即为「无头合同」,否则为「项目合同」;
|
||
// - our_role:我方角色,当前租户扮演的参与方,1=甲方 2=乙方 3=丙方 4=丁方(默认乙方);
|
||
// - party_count:2=双方(甲乙)3=三方(甲乙丙)4=四方(甲乙丙丁);
|
||
// - parties / products 以 JSON 文本存储,返回时由控制器解析后透出;
|
||
// - 各部分金额冗余为表字段,便于列表统计与排序(与 products 重算结果一致)。
|
||
type TenantCrmContract struct {
|
||
ID uint64 `orm:"column(id);pk;auto" json:"id"`
|
||
TenantID string `orm:"column(tenant_id);size(64)" json:"tenant_id"`
|
||
ContractNo string `orm:"column(contract_no);size(50)" json:"contract_no"` // 合同编号
|
||
ContractName string `orm:"column(contract_name);size(100)" json:"contract_name"` // 合同名称
|
||
ContractCategory string `orm:"column(contract_category);size(20)" json:"contract_category"` // 分类:1开发/2服务/3销售/4租赁/5采购/6运维/7咨询/8其他
|
||
OurRole int8 `orm:"column(our_role);default(2)" json:"our_role"` // 我方角色:1甲方/2乙方/3丙方/4丁方
|
||
PartyCount int8 `orm:"column(party_count);default(2)" json:"party_count"` // 合同形式:2/3/4 方
|
||
ProjectID *uint64 `orm:"column(project_id);null" json:"project_id"` // 关联项目ID(空=无头合同)
|
||
ProjectName string `orm:"column(project_name);size(100)" json:"project_name"`
|
||
OwnerUserID string `orm:"column(owner_user_id);size(64)" json:"owner_user_id"`
|
||
OwnerUserName string `orm:"column(owner_user_name);size(128)" json:"owner_user_name"`
|
||
SignDate *time.Time `orm:"column(sign_date);type(date);null" json:"sign_date"`
|
||
EffectiveDate *time.Time `orm:"column(effective_date);type(date);null" json:"effective_date"`
|
||
ExpireDate *time.Time `orm:"column(expire_date);type(date);null" json:"expire_date"`
|
||
TechDate *time.Time `orm:"column(tech_date);type(date);null" json:"tech_date"` // 技术日期(开发/交付完成日期;到期且回款未满则自动转执行异常)
|
||
Parties string `orm:"column(parties);type(text);null" json:"-"` // 各方签约主体 JSON 数组
|
||
Products string `orm:"column(products);type(text);null" json:"-"` // 产品清单 JSON 数组
|
||
HardwareAmount float64 `orm:"column(hardware_amount);digits(14);decimals(2);default(0)" json:"hardware_amount"`
|
||
SoftwareAmount float64 `orm:"column(software_amount);digits(14);decimals(2);default(0)" json:"software_amount"`
|
||
OtherAmount float64 `orm:"column(other_amount);digits(14);decimals(2);default(0)" json:"other_amount"`
|
||
TotalAmount float64 `orm:"column(total_amount);digits(14);decimals(2);default(0)" json:"total_amount"`
|
||
TotalCost float64 `orm:"column(total_cost);digits(14);decimals(2);default(0)" json:"total_cost"`
|
||
TotalProfit float64 `orm:"column(total_profit);digits(14);decimals(2);default(0)" json:"total_profit"`
|
||
Status int8 `orm:"column(status);default(1)" json:"status"` // 1草稿/2已完成/3已作废/4履约中/5执行异常
|
||
Step int8 `orm:"column(step);default(1)" json:"step"` // 进度式创建步骤:1合同信息/2产品清单
|
||
Remark string `orm:"column(remark);type(text);null" json:"remark"`
|
||
CreateUserID string `orm:"column(create_user_id);size(64)" json:"create_user_id"`
|
||
CreateTime time.Time `orm:"column(create_time);auto_now_add;type(datetime)" json:"create_time"`
|
||
UpdateTime time.Time `orm:"column(update_time);auto_now;type(datetime)" json:"update_time"`
|
||
DeleteTime *time.Time `orm:"column(delete_time);type(datetime);null" json:"delete_time"`
|
||
}
|
||
|
||
func (m *TenantCrmContract) TableName() string {
|
||
return "yz_backend_crm_contract"
|
||
}
|