fix(权限完善):1.权限优化以下模块按钮查看权限全部归属超级管理员,只有职称角色未超级管理员用户才可以查看进入操作
deploy-hxtesting / build-and-deploy (push) Successful in 1m17s
deploy-hxtesting / build-and-deploy (push) Successful in 1m17s
1)如图一所示点击左下角个人信息弹出框中的“空间设置”、“成员管理“、”模型管理“、”全部设置“、”系统管理“ 2)点击进入”设置“页面中”空间“、”模型“、”发布集成“、”数据与扩展“、”系统管理“这几个大模块相关内容入口 2.成员管理页面增加一个字段”状态“:1-5 在职状态(试用/试用延期/正式/临时/实习)、6离职/7退休(顺便对数据进行清洗,工号首位带字母的都标记为离职其他都标记为正式) 3.检查各业务需求里所有选择员工相关都只能拉取选择正式员工!
This commit is contained in:
1 parent
b762deaf15
commit
7034d93256
49 files changed
+809
-130
No files matched your search
@@ -111,32 +111,36 @@ func (r *tenantMemberRepository) ListByTenant(ctx context.Context, tenantID uint
|
||||
}
|
||||
|
||||
// CountFilteredByTenant counts active tenant membership rows, optionally
|
||||
// restricted to users whose email or username matches search.
|
||||
// restricted to users whose email or username matches search. employmentStatus
|
||||
// 非 0 时仅统计该在职状态(users.employment_status,000167)的成员。
|
||||
func (r *tenantMemberRepository) CountFilteredByTenant(
|
||||
ctx context.Context, tenantID uint64, search string,
|
||||
ctx context.Context, tenantID uint64, search string, employmentStatus int,
|
||||
) (int64, error) {
|
||||
search = strings.TrimSpace(search)
|
||||
q := r.db.WithContext(ctx).Model(&types.TenantMember{}).
|
||||
Where("tenant_members.tenant_id = ?", tenantID)
|
||||
var total int64
|
||||
var err error
|
||||
if search == "" {
|
||||
err = q.Count(&total).Error
|
||||
} else {
|
||||
like := "%" + escapeLikePattern(search) + "%"
|
||||
err = q.
|
||||
Joins(`INNER JOIN users ON users.id = tenant_members.user_id AND users.deleted_at IS NULL`).
|
||||
Where(
|
||||
`(LOWER(users.email) LIKE LOWER(?) ESCAPE ? OR LOWER(users.username) LIKE LOWER(?) ESCAPE ?)`,
|
||||
like, likeEscapeChar, like, likeEscapeChar).
|
||||
Count(&total).Error
|
||||
// 搜索与在职状态过滤都依赖 users 表,按需挂一次 JOIN(重复 Joins 会
|
||||
// 生成重复 JOIN 子句)。
|
||||
if search != "" || employmentStatus > 0 {
|
||||
q = q.Joins(`INNER JOIN users ON users.id = tenant_members.user_id AND users.deleted_at IS NULL`)
|
||||
}
|
||||
if search != "" {
|
||||
like := "%" + escapeLikePattern(search) + "%"
|
||||
q = q.Where(
|
||||
`(LOWER(users.email) LIKE LOWER(?) ESCAPE ? OR LOWER(users.username) LIKE LOWER(?) ESCAPE ?)`,
|
||||
like, likeEscapeChar, like, likeEscapeChar)
|
||||
}
|
||||
if employmentStatus > 0 {
|
||||
q = q.Where("users.employment_status = ?", employmentStatus)
|
||||
}
|
||||
var total int64
|
||||
err := q.Count(&total).Error
|
||||
return total, err
|
||||
}
|
||||
|
||||
// ListPagedByTenant lists active memberships with stable sort.
|
||||
func (r *tenantMemberRepository) ListPagedByTenant(
|
||||
ctx context.Context, tenantID uint64, search string, offset, limit int,
|
||||
ctx context.Context, tenantID uint64, search string, employmentStatus int, offset, limit int,
|
||||
) ([]*types.TenantMember, error) {
|
||||
search = strings.TrimSpace(search)
|
||||
var members []*types.TenantMember
|
||||
@@ -146,18 +150,19 @@ func (r *tenantMemberRepository) ListPagedByTenant(
|
||||
Offset(offset).
|
||||
Limit(limit)
|
||||
|
||||
var err error
|
||||
if search == "" {
|
||||
err = q.Find(&members).Error
|
||||
} else {
|
||||
like := "%" + escapeLikePattern(search) + "%"
|
||||
err = q.
|
||||
Joins(`INNER JOIN users ON users.id = tenant_members.user_id AND users.deleted_at IS NULL`).
|
||||
Where(
|
||||
`(LOWER(users.email) LIKE LOWER(?) ESCAPE ? OR LOWER(users.username) LIKE LOWER(?) ESCAPE ?)`,
|
||||
like, likeEscapeChar, like, likeEscapeChar).
|
||||
Find(&members).Error
|
||||
if search != "" || employmentStatus > 0 {
|
||||
q = q.Joins(`INNER JOIN users ON users.id = tenant_members.user_id AND users.deleted_at IS NULL`)
|
||||
}
|
||||
if search != "" {
|
||||
like := "%" + escapeLikePattern(search) + "%"
|
||||
q = q.Where(
|
||||
`(LOWER(users.email) LIKE LOWER(?) ESCAPE ? OR LOWER(users.username) LIKE LOWER(?) ESCAPE ?)`,
|
||||
like, likeEscapeChar, like, likeEscapeChar)
|
||||
}
|
||||
if employmentStatus > 0 {
|
||||
q = q.Where("users.employment_status = ?", employmentStatus)
|
||||
}
|
||||
err := q.Find(&members).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user