Files
yunzerwebsiteallinone/go/models/tenant_crm_project.go
T
2026-09-14 16:15:44 +08:00

69 lines
5.7 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 models
import "time"
// TenantCrmProject 项目表: yz_backend_crm_project
type TenantCrmProject struct {
ID uint64 `orm:"column(id);pk;auto" json:"id"`
TenantID string `orm:"column(tenant_id);size(64)" json:"tenant_id"`
ProjectName string `orm:"column(project_name);size(100)" json:"project_name"` // 项目名称
ProjectNo string `orm:"column(project_no);size(50)" json:"project_no"` // 项目编号
BusinessID *uint64 `orm:"column(business_id);null" json:"business_id"` // 来源商机ID
BusinessName string `orm:"-" json:"business_name"` // 来源商机名称(非表字段,查询时填充)
CustomerID *uint64 `orm:"column(customer_id);null" json:"customer_id"`
CustomerName string `orm:"column(customer_name);size(100)" json:"customer_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"`
Industry string `orm:"column(industry);size(50)" json:"industry"`
// 项目类型:1=单一项目(只有上游客户) 2=上下游项目(上游客户 + 下游供应商)
// 3=上中游项目(上游 A 公司 + 中游 B 公司,下游固定为本公司)
ProjectType int8 `orm:"column(project_type);default(1)" json:"project_type"`
// 对方主体(2=上下游项目的下游 / 3=上中游项目的中游):可从供应商库或客户库选择(supplier_ref_type + supplier_id 标明来源),也允许手工填写名称
SupplierID *uint64 `orm:"column(supplier_id);null" json:"supplier_id"`
SupplierRefType int8 `orm:"column(supplier_ref_type);default(0)" json:"supplier_ref_type"` // 0未关联 1客户 2供应商
SupplierName string `orm:"column(supplier_name);size(100)" json:"supplier_name"`
SupplierIndustry string `orm:"column(supplier_industry);size(50)" json:"supplier_industry"`
// 金额拆分为上下游:上游=对客户的收入,下游=对供应商的成本(上下游项目毛利 = 上游 - 下游);
// 上中游项目:上游=上游 A 公司合同额,下游字段存中游 B 公司(与我方)合同额
UpstreamAmount float64 `orm:"column(upstream_amount);digits(14);decimals(2);default(0)" json:"upstream_amount"`
DownstreamAmount float64 `orm:"column(downstream_amount);digits(14);decimals(2);default(0)" json:"downstream_amount"`
// Amount 为旧「项目金额」列,已由 UpstreamAmount 取代;写入时始终同步为上游金额,仅作历史兼容
Amount float64 `orm:"column(amount);digits(14);decimals(2);default(0)" json:"amount"`
Status int8 `orm:"column(status);default(1)" json:"status"` // 1未开始/2进行中/3已完成/4已暂停/5异常
// StartDate / EndDate 为旧的手工维护列,已改由关联合同自动汇总,保留仅用于兼容历史数据
StartDate *time.Time `orm:"column(start_date);type(date);null" json:"start_date"`
EndDate *time.Time `orm:"column(end_date);type(date);null" json:"end_date"`
// 项目实际起止时间:按其下所有合同汇总(最早生效日期 / 最晚结束日期),只读不落库
ContractStartDate *time.Time `orm:"-" json:"contract_start_date"`
ContractEndDate *time.Time `orm:"-" json:"contract_end_date"`
// 上下游对接人:仅需姓名与电话
UpstreamContact string `orm:"column(upstream_contact);size(50)" json:"upstream_contact"`
UpstreamPhone string `orm:"column(upstream_phone);size(20)" json:"upstream_phone"`
DownstreamContact string `orm:"column(downstream_contact);size(50)" json:"downstream_contact"`
DownstreamPhone string `orm:"column(downstream_phone);size(20)" json:"downstream_phone"`
// 项目联系人:从对应企业通讯录中挑选的联系人ID集合(JSON 数组字符串,如 [1,5,8],空为未选)。
// 上游=客户方(yz_backend_erp_contact.company_type=customer & company_id=customer_id);
// 下游/中游=对方主体方(company_type 按 supplier_ref_type:1=customer 2=supplier,company_id=supplier_id)。
// 单一项目只使用上游集合;联系人详情实时来自企业通讯录,此处仅存 ID 引用。
UpstreamContactIDs string `orm:"column(upstream_contact_ids);type(text);null" json:"upstream_contact_ids"`
DownstreamContactIDs string `orm:"column(downstream_contact_ids);type(text);null" json:"downstream_contact_ids"`
// 以下为旧版单一对接人信息,已被上下游对接人取代,仅保留列以兼容历史数据
ContactPerson string `orm:"column(contact_person);size(50)" json:"contact_person"`
ContactPosition string `orm:"column(contact_position);size(50)" json:"contact_position"` // 对接人职位(已废弃)
ContactPhone string `orm:"column(contact_phone);size(20)" json:"contact_phone"`
Address string `orm:"column(address);size(255)" json:"address"`
Remark string `orm:"column(remark);type(text);null" json:"remark"`
// DocCategoryID 项目在 OA 文档库的文件夹分类ID:
// 指向 yz_backend_oa_doc_category 中「共享文档 / 项目文档 / {项目名称}」这条记录(0 表示尚未建立)。
DocCategoryID uint64 `orm:"column(doc_category_id);default(0)" json:"doc_category_id"`
Products string `orm:"column(products);type(text);null" json:"products"` // 项目产品清单JSON(写入产品管理时使用)
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 *TenantCrmProject) TableName() string {
return "yz_backend_crm_project"
}