...
|
...
|
@@ -299,21 +299,37 @@ func (d *StaffAssessDao) ListTargetUserNoInvite(companyId int, cycleId int, begi |
|
|
}
|
|
|
|
|
|
type UserSelfStaffAssess struct {
|
|
|
CycleId string ``
|
|
|
AssessId string ``
|
|
|
TargetUserId string ``
|
|
|
TargetUserName string ``
|
|
|
CycleId string `pg:"cycle_id"`
|
|
|
AssessId string `pg:"assess_id"`
|
|
|
TargetUserId string `pg:"target_user_id"`
|
|
|
TargetUserName string `pg:"target_user_name"`
|
|
|
EvaluationProjectId string `pg:"evaluation_project_id"`
|
|
|
EvaluationProjectName string `pg:"evaluation_project_name"`
|
|
|
CompanyId string `pg:"company_id"`
|
|
|
BeginDay string `pg:"begin_day"`
|
|
|
}
|
|
|
|
|
|
type SearchConditin3 struct {
|
|
|
CompanyId int //公司id
|
|
|
CycleId int //周期id
|
|
|
BeginDay string //评估的日期
|
|
|
TargetUserName string //被评估人的名称
|
|
|
Limit int //分页
|
|
|
Offset int //分页
|
|
|
OperaterId int //用户的id是谁在搜索数据
|
|
|
Hrbp int //
|
|
|
Status string // 评估完成状态
|
|
|
}
|
|
|
|
|
|
// 根据周期的id和日期获取员工评估的评估任务。有进行查看权限过滤
|
|
|
// companyId int 公司id
|
|
|
// cycleId int, 评估周期id
|
|
|
// companyId int 公司id ,必填
|
|
|
// cycleId int, 评估周期id, 必填
|
|
|
// userId int, 用户id,谁要查看数据
|
|
|
// beginDay string, 周期中执行项目的时间
|
|
|
// hrbp 是否搜索HRBP角色的用户可以查看,1:是;-1:否
|
|
|
// limit int, 分页条数
|
|
|
// offset int 分页偏移
|
|
|
func (d *StaffAssessDao) SearchUserSelfStaffAssess(param SearchConditin1) ([]UserAssessContent, error) {
|
|
|
func (d *StaffAssessDao) SearchUserSelfStaffAssess(param SearchConditin3) ([]UserSelfStaffAssess, error) {
|
|
|
withSql := d.catchProjectIdByPermission(param.CompanyId, param.CycleId, param.OperaterId, param.Hrbp)
|
|
|
sqlStr := `select
|
|
|
staff_assess.cycle_id ,
|
...
|
...
|
@@ -323,9 +339,9 @@ func (d *StaffAssessDao) SearchUserSelfStaffAssess(param SearchConditin1) ([]Use |
|
|
staff_assess.evaluation_project_id ,
|
|
|
staff_assess.evaluation_project_name ,
|
|
|
staff_assess.company_id ,
|
|
|
staff_assess.begin_time
|
|
|
to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD') as begin_day
|
|
|
from staff_assess
|
|
|
join evaluation_project on staff_assess.evaluation_project_id =evaluation_project.id
|
|
|
join t_project_4 on staff_assess.evaluation_project_id =t_project_4.project_id
|
|
|
where 1=1
|
|
|
and staff_assess.cycle_id =?
|
|
|
and staff_assess.deleted_at isnull
|
...
|
...
|
@@ -339,19 +355,53 @@ func (d *StaffAssessDao) SearchUserSelfStaffAssess(param SearchConditin1) ([]Use |
|
|
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 (?) `
|
|
|
if len(param.Status) > 0 {
|
|
|
condition = append(condition, param.Status)
|
|
|
sqlStr += ` and staff_assess.status=? `
|
|
|
}
|
|
|
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
|
|
|
tx := d.transactionContext.PgTx
|
|
|
var result []UserSelfStaffAssess
|
|
|
_, err := tx.Query(&result, sqlStr2, condition...)
|
|
|
return result, err
|
|
|
}
|
|
|
|
|
|
// 根据周期的id和日期获取员工评估的评估任务数量。有进行查看权限过滤
|
|
|
// companyId int 公司id
|
|
|
// cycleId int, 评估周期id
|
|
|
// userId int, 用户id,谁要查看数据
|
|
|
// beginDay string, 周期中执行项目的时间
|
|
|
// hrbp 是否搜索HRBP角色的用户可以查看,1:是;-1:否
|
|
|
func (d *StaffAssessDao) CountUserSelfStaffAssess(param SearchConditin3) (int, error) {
|
|
|
withSql := d.catchProjectIdByPermission(param.CompanyId, param.CycleId, param.OperaterId, param.Hrbp)
|
|
|
sqlStr := `select
|
|
|
count(*)
|
|
|
from staff_assess
|
|
|
join t_project_4 on staff_assess.evaluation_project_id =t_project_4.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.Status) > 0 {
|
|
|
condition = append(condition, param.Status)
|
|
|
sqlStr += ` and staff_assess.status=? `
|
|
|
}
|
|
|
|
|
|
sqlStr2 := withSql + withSql
|
|
|
tx := d.transactionContext.PgTx
|
|
|
var result int
|
|
|
_, err := tx.Query(pg.Scan(&result), sqlStr2, condition...)
|
|
|
return result, err
|
|
|
} |
...
|
...
|
|