增加ai办公,考勤管理

This commit is contained in:
hero920103 committed 2026-11-14 18:15:55 +08:00
1 parent eb9b7beff5
commit 31ae07175d
46 files changed
+9250 -296

No files matched your search

+3 -5
View File
@@ -44,15 +44,13 @@ func EnsureEmployeeForTenantUser(tu *models.SystemTenantUser) (*models.BackendEm
return nil, false, nil
}
// 员工表按 (tid, account) 唯一:同一账号在不同企业各有一份员工档案,
// 因此这里必须带上 tid,否则会把其他企业的同账号员工误判为本企业已有。
var emp models.BackendEmployee
// 员工表的 uk_account 是全局唯一索引(不是 tid+account 复合索引)。
// 因此先按账号查全表,避免已有的历史/其他租户同账号记录被误判为缺失后再 INSERT。
err := models.Orm.QueryTable(new(models.BackendEmployee)).
Filter("tid", tid).
Filter("account", account).
One(&emp)
if err == nil && emp.Tid != nil && *emp.Tid > 0 && *emp.Tid != tid {
return nil, false, fmt.Errorf("员工账号 %s 已被其他租户使用,不能重复创建", account)
}
name := account
if tu.Name != nil && strings.TrimSpace(*tu.Name) != "" {