fix(过滤离职):完善优化过滤离职人员
deploy-hxtesting / build-and-deploy (push) Successful in 1m35s

This commit is contained in:
runny committed 2026-12-01 18:21:46 +08:00
1 parent 381dd60bea
commit f55447a8f8
5 files changed
+17

No files matched your search

@@ -81,6 +81,12 @@ func (r *orgCenterRepository) employeeFilter(ctx context.Context, tenantID uint6
if q.EmploymentStatus > 0 {
tx = tx.Where("u.employment_status = ?", q.EmploymentStatus)
}
// 在职口径过滤:员工档案列表只保留成员管理在职人员(状态 1-5),
// 离职(6)/退休(7)不再展示;users 联查不上的档案行同样视作不在职隐藏。
if q.OnDutyOnly {
tx = tx.Where("u.employment_status BETWEEN ? AND ?",
types.EmploymentStatusProbation, types.EmploymentStatusIntern)
}
if q.Keyword != "" {
// 按姓名/工号/部门名/岗位模糊查找;姓名取真实姓名(display_name)
// 回退平台账号(username),与列表展示口径一致。
+4
View File
@@ -40,6 +40,10 @@ func orgListQueryFromRequest(c *gin.Context) *types.OrgListQuery {
if v, err := strconv.Atoi(c.Query("employment_status")); err == nil && types.IsValidEmploymentStatus(v) {
q.EmploymentStatus = v
}
// 在职口径(on_duty=true):员工档案列表仅保留在职人员(1-5),过滤离职/退休。
if v, err := strconv.ParseBool(c.Query("on_duty")); err == nil {
q.OnDutyOnly = v
}
if v, err := strconv.Atoi(c.Query("page")); err == nil {
q.Page = v
}
+3
View File
@@ -93,10 +93,13 @@ func (OrgModuleMember) TableName() string { return "org_module_members" }
// OrgListQuery 组织中心通用列表查询(分页 + 关键词 + 部门过滤)。
// EmploymentStatus 在职状态过滤(000167):0 = 不过滤;选人场景传
// EmploymentStatusFormal(3) 仅拉取正式员工。
// OnDutyOnly 在职口径过滤:员工档案列表只保留成员管理在职人员(状态 1-5),
// 离职(6)/退休(7)不再展示。
type OrgListQuery struct {
DeptID string
Keyword string
EmploymentStatus int
OnDutyOnly bool
Page int
PageSize int
}