优化线索、商机、项目相关开发
This commit is contained in:
@@ -141,6 +141,15 @@ func Init(_ string) {
|
||||
EnsureTenantUserOrgColumn()
|
||||
EnsureCrmCustomerPoolColumns()
|
||||
EnsureCrmCreateUserColumn()
|
||||
EnsureCrmProjectDocColumn()
|
||||
}
|
||||
|
||||
// EnsureCrmProjectDocColumn 补齐项目表的文档库文件夹分类字段(项目文档绑定 OA 文档库)。
|
||||
// 表不存在或列已存在时忽略错误。
|
||||
func EnsureCrmProjectDocColumn() {
|
||||
sql := "ALTER TABLE " + new(TenantCrmProject).TableName() +
|
||||
" ADD COLUMN doc_category_id bigint unsigned NOT NULL DEFAULT 0 COMMENT '关联OA文档库项目文件夹分类ID'"
|
||||
_, _ = Orm.Raw(sql).Exec()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package models
|
||||
|
||||
import "time"
|
||||
|
||||
// TenantCrmAttach 附件表: yz_tenant_crm_attach
|
||||
// TenantCrmAttach 附件表: yz_backend_crm_attach
|
||||
// related_type: 1线索 / 2商机 / 3项目
|
||||
type TenantCrmAttach struct {
|
||||
ID uint64 `orm:"column(id);pk;auto" json:"id"`
|
||||
@@ -21,5 +21,5 @@ type TenantCrmAttach struct {
|
||||
}
|
||||
|
||||
func (m *TenantCrmAttach) TableName() string {
|
||||
return "yz_tenant_crm_attach"
|
||||
return "yz_backend_crm_attach"
|
||||
}
|
||||
|
||||
@@ -2,12 +2,13 @@ package models
|
||||
|
||||
import "time"
|
||||
|
||||
// TenantCrmBusiness 商机表: yz_tenant_crm_business
|
||||
// TenantCrmBusiness 商机表: yz_backend_crm_business
|
||||
type TenantCrmBusiness struct {
|
||||
ID uint64 `orm:"column(id);pk;auto" json:"id"`
|
||||
TenantID string `orm:"column(tenant_id);size(64)" json:"tenant_id"`
|
||||
BusinessName string `orm:"column(business_name);size(100)" json:"business_name"` // 商机名称
|
||||
ClueID *uint64 `orm:"column(clue_id);null" json:"clue_id"` // 来源线索ID
|
||||
ClueName string `orm:"-" json:"clue_name"` // 来源线索名称(非表字段,查询时填充)
|
||||
CustomerID *uint64 `orm:"column(customer_id);null" json:"customer_id"` // 正式客户ID
|
||||
CustomerName string `orm:"column(customer_name);size(100)" json:"customer_name"`
|
||||
Source string `orm:"column(source);size(50)" json:"source"`
|
||||
@@ -37,5 +38,5 @@ type TenantCrmBusiness struct {
|
||||
}
|
||||
|
||||
func (m *TenantCrmBusiness) TableName() string {
|
||||
return "yz_tenant_crm_business"
|
||||
return "yz_backend_crm_business"
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package models
|
||||
|
||||
import "time"
|
||||
|
||||
// TenantCrmClue 线索表: yz_tenant_crm_clue
|
||||
// TenantCrmClue 线索表: yz_backend_crm_clue
|
||||
// 线索阶段的「客户名称」不关联客户管理,转化商机时才落地为正式客户。
|
||||
type TenantCrmClue struct {
|
||||
ID uint64 `orm:"column(id);pk;auto" json:"id"`
|
||||
@@ -33,5 +33,5 @@ type TenantCrmClue struct {
|
||||
}
|
||||
|
||||
func (m *TenantCrmClue) TableName() string {
|
||||
return "yz_tenant_crm_clue"
|
||||
return "yz_backend_crm_clue"
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package models
|
||||
|
||||
import "time"
|
||||
|
||||
// TenantCrmEntityContact 联系人表: yz_tenant_crm_entity_contact
|
||||
// TenantCrmEntityContact 联系人表: yz_backend_crm_entity_contact
|
||||
// related_type: 1线索 / 2商机 / 3项目
|
||||
type TenantCrmEntityContact struct {
|
||||
ID uint64 `orm:"column(id);pk;auto" json:"id"`
|
||||
@@ -23,5 +23,5 @@ type TenantCrmEntityContact struct {
|
||||
}
|
||||
|
||||
func (m *TenantCrmEntityContact) TableName() string {
|
||||
return "yz_tenant_crm_entity_contact"
|
||||
return "yz_backend_crm_entity_contact"
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package models
|
||||
|
||||
import "time"
|
||||
|
||||
// TenantCrmFollow 回访/跟进记录表: yz_tenant_crm_follow
|
||||
// TenantCrmFollow 回访/跟进记录表: yz_backend_crm_follow
|
||||
// related_type: 1线索 / 2商机 / 3项目
|
||||
type TenantCrmFollow struct {
|
||||
ID uint64 `orm:"column(id);pk;auto" json:"id"`
|
||||
@@ -10,6 +10,7 @@ type TenantCrmFollow struct {
|
||||
RelatedType int8 `orm:"column(related_type)" json:"related_type"`
|
||||
RelatedID uint64 `orm:"column(related_id)" json:"related_id"`
|
||||
RelatedName string `orm:"column(related_name);size(100)" json:"related_name"`
|
||||
Stage int8 `orm:"column(stage);default(1)" json:"stage"` // 创建阶段:1线索/2商机/3项目
|
||||
FollowType string `orm:"column(follow_type);size(20);default(1)" json:"follow_type"` // 回访方式
|
||||
FollowTime *time.Time `orm:"column(follow_time);type(datetime);null" json:"follow_time"`
|
||||
Content string `orm:"column(content);type(text);null" json:"content"`
|
||||
@@ -22,5 +23,5 @@ type TenantCrmFollow struct {
|
||||
}
|
||||
|
||||
func (m *TenantCrmFollow) TableName() string {
|
||||
return "yz_tenant_crm_follow"
|
||||
return "yz_backend_crm_follow"
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package models
|
||||
|
||||
import "time"
|
||||
|
||||
// TenantCrmOperateLog 操作日志表: yz_tenant_crm_operate_log
|
||||
// TenantCrmOperateLog 操作日志表: yz_backend_crm_operate_log
|
||||
// related_type: 1线索 / 2商机 / 3项目
|
||||
type TenantCrmOperateLog struct {
|
||||
ID uint64 `orm:"column(id);pk;auto" json:"id"`
|
||||
@@ -17,5 +17,5 @@ type TenantCrmOperateLog struct {
|
||||
}
|
||||
|
||||
func (m *TenantCrmOperateLog) TableName() string {
|
||||
return "yz_tenant_crm_operate_log"
|
||||
return "yz_backend_crm_operate_log"
|
||||
}
|
||||
|
||||
@@ -2,13 +2,14 @@ package models
|
||||
|
||||
import "time"
|
||||
|
||||
// TenantCrmProject 项目表: yz_tenant_crm_project
|
||||
// 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"`
|
||||
@@ -23,6 +24,9 @@ type TenantCrmProject struct {
|
||||
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"`
|
||||
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"`
|
||||
@@ -30,5 +34,5 @@ type TenantCrmProject struct {
|
||||
}
|
||||
|
||||
func (m *TenantCrmProject) TableName() string {
|
||||
return "yz_tenant_crm_project"
|
||||
return "yz_backend_crm_project"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user