fix(推送管理):按部门/职位推送报列不存在,显式限定查询列修复42703
deploy-hxtesting / build-and-deploy (push) Successful in 1m15s
deploy-hxtesting / build-and-deploy (push) Successful in 1m15s
This commit is contained in:
1 parent
aa85aab2b9
commit
ab50e17810
3 files changed
+19
-8
No files matched your search
@@ -111,8 +111,8 @@ 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. employmentStatus
|
||||
// 非 0 时仅统计该在职状态(users.employment_status,000167)的成员。
|
||||
// restricted to users whose email, username or display name matches search.
|
||||
// employmentStatus 非 0 时仅统计该在职状态(users.employment_status,000167)的成员。
|
||||
func (r *tenantMemberRepository) CountFilteredByTenant(
|
||||
ctx context.Context, tenantID uint64, search string, employmentStatus int,
|
||||
) (int64, error) {
|
||||
@@ -126,9 +126,12 @@ func (r *tenantMemberRepository) CountFilteredByTenant(
|
||||
}
|
||||
if search != "" {
|
||||
like := "%" + escapeLikePattern(search) + "%"
|
||||
// 姓名一并纳入(000168):前端搜索框文案为「按姓名或邮箱搜索」,姓名在
|
||||
// users.display_name,而 username 存的是工号,只搜中文名此前恒为空。
|
||||
q = q.Where(
|
||||
`(LOWER(users.email) LIKE LOWER(?) ESCAPE ? OR LOWER(users.username) LIKE LOWER(?) ESCAPE ?)`,
|
||||
like, likeEscapeChar, like, likeEscapeChar)
|
||||
`(LOWER(users.email) LIKE LOWER(?) ESCAPE ? OR LOWER(users.username) LIKE LOWER(?) ESCAPE ?`+
|
||||
` OR LOWER(users.display_name) LIKE LOWER(?) ESCAPE ?)`,
|
||||
like, likeEscapeChar, like, likeEscapeChar, like, likeEscapeChar)
|
||||
}
|
||||
if employmentStatus > 0 {
|
||||
q = q.Where("users.employment_status = ?", employmentStatus)
|
||||
@@ -155,9 +158,12 @@ func (r *tenantMemberRepository) ListPagedByTenant(
|
||||
}
|
||||
if search != "" {
|
||||
like := "%" + escapeLikePattern(search) + "%"
|
||||
// 姓名一并纳入(000168):前端搜索框文案为「按姓名或邮箱搜索」,姓名在
|
||||
// users.display_name,而 username 存的是工号,只搜中文名此前恒为空。
|
||||
q = q.Where(
|
||||
`(LOWER(users.email) LIKE LOWER(?) ESCAPE ? OR LOWER(users.username) LIKE LOWER(?) ESCAPE ?)`,
|
||||
like, likeEscapeChar, like, likeEscapeChar)
|
||||
`(LOWER(users.email) LIKE LOWER(?) ESCAPE ? OR LOWER(users.username) LIKE LOWER(?) ESCAPE ?`+
|
||||
` OR LOWER(users.display_name) LIKE LOWER(?) ESCAPE ?)`,
|
||||
like, likeEscapeChar, like, likeEscapeChar, like, likeEscapeChar)
|
||||
}
|
||||
if employmentStatus > 0 {
|
||||
q = q.Where("users.employment_status = ?", employmentStatus)
|
||||
|
||||
Reference in new issue
Block a user