增加CRM模块
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
)
|
||||
|
||||
// Contact 联系人模型(对应表 yz_tenant_crm_contact)
|
||||
type Contact struct {
|
||||
Id int64 `orm:"pk;auto" json:"id"`
|
||||
TenantId string `orm:"column(tenant_id);size(64)" json:"tenant_id"`
|
||||
RelatedType int `orm:"column(related_type)" json:"related_type"` // 1=客户 2=供应商
|
||||
RelatedId string `orm:"column(related_id);size(64)" json:"related_id"`
|
||||
ContactName string `orm:"column(contact_name);size(50)" json:"contact_name"`
|
||||
Gender int8 `orm:"column(gender);null" json:"gender"`
|
||||
Mobile string `orm:"column(mobile);size(20);null" json:"mobile"`
|
||||
Phone string `orm:"column(phone);size(20);null" json:"phone"`
|
||||
Email string `orm:"column(email);size(100);null" json:"email"`
|
||||
Position string `orm:"column(position);size(50);null" json:"position"`
|
||||
Department string `orm:"column(department);size(50);null" json:"department"`
|
||||
IsPrimary int8 `orm:"column(is_primary);null" json:"is_primary"`
|
||||
Remark string `orm:"column(remark);size(500);null" json:"remark"`
|
||||
CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
|
||||
UpdateTime time.Time `orm:"column(update_time);type(datetime);auto_now" json:"update_time"`
|
||||
CreateBy int64 `orm:"column(create_by);null" json:"create_by"`
|
||||
UpdateBy int64 `orm:"column(update_by);null" json:"update_by"`
|
||||
IsDeleted int8 `orm:"column(is_deleted);null" json:"is_deleted"`
|
||||
}
|
||||
|
||||
func (t *Contact) TableName() string {
|
||||
return "yz_tenant_crm_contact"
|
||||
}
|
||||
|
||||
func init() {
|
||||
orm.RegisterModel(new(Contact))
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
)
|
||||
|
||||
// Customer 客户模型(对应表 yz_tenant_crm_customer)
|
||||
type Customer struct {
|
||||
Id string `orm:"pk;size(36)" json:"id"`
|
||||
TenantId string `orm:"column(tenant_id);size(64)" json:"tenant_id"`
|
||||
CustomerName string `orm:"column(customer_name);size(100)" json:"customer_name"`
|
||||
CustomerType string `orm:"column(customer_type);size(20)" json:"customer_type"`
|
||||
ContactPerson string `orm:"column(contact_person);size(50)" json:"contact_person"`
|
||||
ContactPhone string `orm:"column(contact_phone);size(20)" json:"contact_phone"`
|
||||
ContactEmail string `orm:"column(contact_email);size(100);null" json:"contact_email"`
|
||||
CustomerLevel string `orm:"column(customer_level);size(20);null" json:"customer_level"`
|
||||
Industry string `orm:"column(industry);size(50);null" json:"industry"`
|
||||
Address string `orm:"column(address);size(255);null" json:"address"`
|
||||
RegisterTime *time.Time `orm:"column(register_time);null;type(date)" json:"register_time"`
|
||||
ExpireTime *time.Time `orm:"column(expire_time);null;type(date)" json:"expire_time"`
|
||||
Status string `orm:"column(status);size(20)" json:"status"`
|
||||
Remark string `orm:"column(remark);type(text);null" json:"remark"`
|
||||
CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
|
||||
UpdateTime time.Time `orm:"column(update_time);type(datetime);auto_now" json:"update_time"`
|
||||
DeleteTime *time.Time `orm:"column(delete_time);null;type(datetime)" json:"delete_time"`
|
||||
}
|
||||
|
||||
func (t *Customer) TableName() string {
|
||||
return "yz_tenant_crm_customer"
|
||||
}
|
||||
|
||||
func init() {
|
||||
orm.RegisterModel(new(Customer))
|
||||
}
|
||||
@@ -21,6 +21,7 @@ type Menu struct {
|
||||
ExternalUrl string `orm:"size(1000);null"`
|
||||
MenuType int8 `orm:"default(1)"`
|
||||
Permission string `orm:"size(200);null"`
|
||||
IsShow int8 `orm:"default(1)"`
|
||||
CreateTime time.Time `orm:"auto_now_add;type(datetime)"`
|
||||
UpdateTime time.Time `orm:"auto_now;type(datetime)"`
|
||||
DeleteTime *time.Time `orm:"null;type(datetime)"`
|
||||
@@ -53,6 +54,8 @@ func GetAllMenus() ([]map[string]interface{}, error) {
|
||||
"isExternal": m.IsExternal,
|
||||
"externalUrl": m.ExternalUrl,
|
||||
"menuType": m.MenuType,
|
||||
"permission": m.Permission,
|
||||
"isShow": m.IsShow,
|
||||
}
|
||||
result = append(result, item)
|
||||
}
|
||||
@@ -129,11 +132,12 @@ func GetTenantMenus(roleId int) ([]map[string]interface{}, error) {
|
||||
args[len(menuIds)] = 1 // menu_type=1 表示页面菜单
|
||||
|
||||
// 3. 查询菜单(只返回menu_type=1的页面菜单,且未删除的)
|
||||
query := "SELECT id, name, path, parent_id, icon, `order`, status, component_path, is_external, external_url, menu_type, permission " +
|
||||
query := "SELECT id, name, path, parent_id, icon, `order`, status, component_path, is_external, external_url, menu_type, permission, is_show " +
|
||||
"FROM yz_menus " +
|
||||
"WHERE id IN (" + strings.Join(placeholders, ",") + ") " +
|
||||
"AND delete_time IS NULL " +
|
||||
"AND menu_type = ? " +
|
||||
"AND is_show = 1 " +
|
||||
"ORDER BY `order`, id"
|
||||
|
||||
var menus []*Menu
|
||||
@@ -184,11 +188,12 @@ func GetTenantMenus(roleId int) ([]map[string]interface{}, error) {
|
||||
}
|
||||
parentArgs[len(parentIdList)] = 1 // menu_type=1
|
||||
|
||||
parentQuery := "SELECT id, name, path, parent_id, icon, `order`, status, component_path, is_external, external_url, menu_type, permission " +
|
||||
parentQuery := "SELECT id, name, path, parent_id, icon, `order`, status, component_path, is_external, external_url, menu_type, permission, is_show " +
|
||||
"FROM yz_menus " +
|
||||
"WHERE id IN (" + strings.Join(parentPlaceholders, ",") + ") " +
|
||||
"AND delete_time IS NULL " +
|
||||
"AND menu_type = ? " +
|
||||
"AND is_show = 1 " +
|
||||
"ORDER BY `order`, id"
|
||||
|
||||
var parentMenus []*Menu
|
||||
@@ -224,6 +229,7 @@ func GetTenantMenus(roleId int) ([]map[string]interface{}, error) {
|
||||
"externalUrl": m.ExternalUrl,
|
||||
"menuType": m.MenuType,
|
||||
"permission": m.Permission,
|
||||
"isShow": m.IsShow,
|
||||
}
|
||||
result = append(result, item)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
)
|
||||
|
||||
// Supplier 供应商模型(对应表 yz_tenant_crm_supplier)
|
||||
type Supplier struct {
|
||||
Id string `orm:"pk;size(36)" json:"id"`
|
||||
TenantId string `orm:"column(tenant_id);size(64)" json:"tenant_id"`
|
||||
SupplierName string `orm:"column(supplier_name);size(100)" json:"supplier_name"`
|
||||
SupplierType string `orm:"column(supplier_type);size(20)" json:"supplier_type"`
|
||||
ContactPerson string `orm:"column(contact_person);size(50)" json:"contact_person"`
|
||||
ContactPhone string `orm:"column(contact_phone);size(20)" json:"contact_phone"`
|
||||
ContactEmail string `orm:"column(contact_email);size(100);null" json:"contact_email"`
|
||||
SupplierLevel string `orm:"column(supplier_level);size(20);null" json:"supplier_level"`
|
||||
Industry string `orm:"column(industry);size(50);null" json:"industry"`
|
||||
Address string `orm:"column(address);size(255);null" json:"address"`
|
||||
RegisterTime *time.Time `orm:"column(register_time);null;type(date)" json:"register_time"`
|
||||
ExpireTime *time.Time `orm:"column(expire_time);null;type(date)" json:"expire_time"`
|
||||
Status string `orm:"column(status);size(20)" json:"status"`
|
||||
Remark string `orm:"column(remark);type(text);null" json:"remark"`
|
||||
CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
|
||||
UpdateTime time.Time `orm:"column(update_time);type(datetime);auto_now" json:"update_time"`
|
||||
DeleteTime *time.Time `orm:"column(delete_time);null;type(datetime)" json:"delete_time"`
|
||||
}
|
||||
|
||||
func (t *Supplier) TableName() string {
|
||||
return "yz_tenant_crm_supplier"
|
||||
}
|
||||
|
||||
func init() {
|
||||
orm.RegisterModel(new(Supplier))
|
||||
}
|
||||
Reference in New Issue
Block a user