修改
This commit is contained in:
@@ -358,14 +358,14 @@ func (c *BackendErpContactController) Star() {
|
||||
func (c *BackendErpContactController) SyncAllContacts() {
|
||||
tid, _ := c.GetInt64("tid")
|
||||
|
||||
qs := models.Orm.QueryTable(new(models.BackendErpEmployee)).
|
||||
qs := models.Orm.QueryTable(new(models.BackendEmployee)).
|
||||
Filter("delete_time__isnull", true).
|
||||
Exclude("account_status", 2)
|
||||
if tid > 0 {
|
||||
qs = qs.Filter("tid", tid)
|
||||
}
|
||||
|
||||
var employees []models.BackendErpEmployee
|
||||
var employees []models.BackendEmployee
|
||||
_, err := qs.All(&employees)
|
||||
if err != nil {
|
||||
c.contactJsonError(500, "查询员工失败: "+err.Error())
|
||||
@@ -400,14 +400,14 @@ func (c *BackendErpContactController) SyncAllContacts() {
|
||||
func (c *BackendErpContactController) GetContactOrgTree() {
|
||||
tid, _ := c.GetInt64("tid")
|
||||
|
||||
qs := models.Orm.QueryTable(new(models.BackendErpOrganization)).
|
||||
qs := models.Orm.QueryTable(new(models.BackendOrganization)).
|
||||
Filter("delete_time__isnull", true).
|
||||
Exclude("status", 0)
|
||||
if tid > 0 {
|
||||
qs = qs.Filter("tid", tid)
|
||||
}
|
||||
|
||||
var orgs []models.BackendErpOrganization
|
||||
var orgs []models.BackendOrganization
|
||||
_, err := qs.OrderBy("sort", "id").All(&orgs)
|
||||
if err != nil {
|
||||
c.contactJsonError(500, "查询组织架构失败: "+err.Error())
|
||||
@@ -455,7 +455,7 @@ func (c *BackendErpContactController) GetContactOrgTree() {
|
||||
|
||||
// buildContactOrgTree 构建通讯录组织树
|
||||
func (c *BackendErpContactController) buildContactOrgTree(
|
||||
orgs []models.BackendErpOrganization,
|
||||
orgs []models.BackendOrganization,
|
||||
counts map[uint64]int64,
|
||||
totalInternal uint64,
|
||||
) []map[string]interface{} {
|
||||
@@ -495,8 +495,8 @@ func (c *BackendErpContactController) buildContactOrgTree(
|
||||
func (c *BackendErpContactController) contactDTO(row models.BackendErpContact) erpContactDTO {
|
||||
orgName := ""
|
||||
if row.OrgID != nil && *row.OrgID > 0 {
|
||||
var org models.BackendErpOrganization
|
||||
if err := models.Orm.QueryTable(new(models.BackendErpOrganization)).
|
||||
var org models.BackendOrganization
|
||||
if err := models.Orm.QueryTable(new(models.BackendOrganization)).
|
||||
Filter("id", *row.OrgID).
|
||||
One(&org); err == nil {
|
||||
orgName = org.OrgName
|
||||
@@ -533,7 +533,7 @@ func (c *BackendErpContactController) contactDTO(row models.BackendErpContact) e
|
||||
// --- Sync from Employee ---
|
||||
|
||||
// SyncContactOnEmployeeCreate 员工创建后同步到通讯录(由 ERP 控制器调用)
|
||||
func SyncContactOnEmployeeCreate(tid uint64, employeeID uint64, emp *models.BackendErpEmployee) {
|
||||
func SyncContactOnEmployeeCreate(tid uint64, employeeID uint64, emp *models.BackendEmployee) {
|
||||
syncContactFromEmployee(tid, employeeID, emp)
|
||||
}
|
||||
|
||||
@@ -622,7 +622,7 @@ func SyncContactOnEmployeeDelete(employeeID uint64) {
|
||||
}
|
||||
|
||||
// syncContactFromEmployee 内部同步函数
|
||||
func syncContactFromEmployee(tid uint64, employeeID uint64, emp *models.BackendErpEmployee) string {
|
||||
func syncContactFromEmployee(tid uint64, employeeID uint64, emp *models.BackendEmployee) string {
|
||||
var existing models.BackendErpContact
|
||||
err := models.Orm.QueryTable(new(models.BackendErpContact)).
|
||||
Filter("employee_id", employeeID).
|
||||
|
||||
Reference in New Issue
Block a user