...
|
...
|
@@ -297,3 +297,54 @@ func (d *StaffAssessDao) ListTargetUserNoInvite(companyId int, cycleId int, begi |
|
|
_, err := tx.Query(&result, sqlStr, condition...)
|
|
|
return result, err
|
|
|
}
|
|
|
|
|
|
// 根据周期的id和日期获取员工评估的评估任务。有进行查看权限过滤
|
|
|
// companyId int 公司id
|
|
|
// cycleId int, 评估周期id
|
|
|
// userId int, 用户id,谁要查看数据
|
|
|
// beginDay string, 周期中执行项目的时间
|
|
|
// hrbp 是否搜索HRBP角色的用户可以查看,1:是;-1:否
|
|
|
// limit int, 分页条数
|
|
|
// offset int 分页偏移
|
|
|
func (d *StaffAssessDao) SearchUserStaffAssess(param SearchConditin1) ([]UserAssessContent, error) {
|
|
|
withSql := d.catchProjectIdByPermission(param.CompanyId, param.CycleId, param.OperaterId, param.Hrbp)
|
|
|
sqlStr := `select
|
|
|
staff_assess.cycle_id ,
|
|
|
staff_assess.id as assess_id,
|
|
|
staff_assess.target_user ->>'userId' as target_user_id,
|
|
|
staff_assess.target_user ->>'userName' as target_user_name,
|
|
|
staff_assess.evaluation_project_id ,
|
|
|
staff_assess.evaluation_project_name ,
|
|
|
staff_assess.company_id ,
|
|
|
staff_assess.begin_time
|
|
|
from staff_assess
|
|
|
join evaluation_project on staff_assess.evaluation_project_id =evaluation_project.id
|
|
|
where 1=1
|
|
|
and staff_assess.cycle_id =?
|
|
|
and staff_assess.deleted_at isnull
|
|
|
`
|
|
|
condition := []interface{}{param.CycleId}
|
|
|
if len(param.BeginDay) > 0 {
|
|
|
condition = append(condition, param.BeginDay)
|
|
|
sqlStr += ` and to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD')=? `
|
|
|
}
|
|
|
if len(param.TargetUserName) > 0 {
|
|
|
condition = append(condition, "%"+param.TargetUserName+"%")
|
|
|
sqlStr += ` and staff_assess.target_user ->>'userName' like ? `
|
|
|
}
|
|
|
if len(param.TargetUserId) > 0 {
|
|
|
condition = append(condition, pg.In(param.TargetUserId))
|
|
|
sqlStr += ` and staff_assess.target_user ->>'userId' in (?) `
|
|
|
}
|
|
|
condition = append(condition, param.Limit, param.Offset)
|
|
|
sqlStr += ` order by convert_to(staff_assess.target_user ->>'userName','GBK') limit ? offset ? `
|
|
|
|
|
|
sqlStr2 := withSql + withSql
|
|
|
// and to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD')='2023-03-29'
|
|
|
_ = sqlStr2
|
|
|
// and staff_assess.cycle_id =1639084510698016768
|
|
|
// -- and staff_assess.target_user ->>'userName' like '%陈%'
|
|
|
// -- and staff_assess.target_user ->>'userId' in ('')
|
|
|
// order by convert_to(staff_assess.target_user ->>'userName','GBK')
|
|
|
return nil, nil
|
|
|
} |
...
|
...
|
|