...
|
...
|
@@ -205,3 +205,58 @@ func (d *StaffAssessDao) SearchTargetUserCycleProject(companyId int, targetUserI |
|
|
_, err := tx.Query(&result, sqlStr, condition...)
|
|
|
return result, err
|
|
|
}
|
|
|
|
|
|
type SearchConditin2 struct {
|
|
|
CompanyId int //公司id
|
|
|
CycleId int //周期id
|
|
|
BeginDayList []string //评估的日期
|
|
|
TargetUserName string //被评估人的名称
|
|
|
TargetUserId []string //查询指定的人
|
|
|
OperaterId int //用户的id是谁在搜索数据
|
|
|
Hrbp int //
|
|
|
}
|
|
|
|
|
|
// 项目管理-成员列表 导出数据
|
|
|
func (d *StaffAssessDao) ExportDataUserAssessV2(param SearchConditin2) ([]ExportData1, error) {
|
|
|
withSql := d.catchProjectIdByPermission(param.CompanyId, param.CycleId, param.OperaterId, param.Hrbp)
|
|
|
sqlStr := `select
|
|
|
staff_assess.target_user->>'userId' as target_user_id ,
|
|
|
staff_assess.target_user->>'userName' as target_user_name ,
|
|
|
to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD') as begin_day,
|
|
|
staff_assess.id as assess_id,
|
|
|
staff_assess.cycle_id,
|
|
|
staff_assess.cycle_name,
|
|
|
staff_assess_content.id as content_id,
|
|
|
staff_assess_content.value ,
|
|
|
staff_assess_content.sort_by ,
|
|
|
staff_assess_content.category ,
|
|
|
staff_assess_content."name" as content_name ,
|
|
|
staff_assess_content.weight,
|
|
|
staff_assess_content.prompt_text ,
|
|
|
staff_assess_content.remark
|
|
|
from staff_assess
|
|
|
join t_project_4 on staff_assess.evaluation_project_id =t_project_4.project_id
|
|
|
left join staff_assess_content on staff_assess.id = staff_assess_content.staff_assess_id
|
|
|
where 1=1
|
|
|
and staff_assess."types" ='self'
|
|
|
`
|
|
|
condition := []interface{}{}
|
|
|
if len(param.TargetUserName) > 0 {
|
|
|
condition = append(condition, "%"+param.TargetUserName+"%")
|
|
|
sqlStr += ` and staff_assess.target_user->>'userName' like ? `
|
|
|
}
|
|
|
if len(param.BeginDayList) > 0 {
|
|
|
condition = append(condition, pg.In(param.BeginDayList))
|
|
|
sqlStr += ` and to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD') in(?) `
|
|
|
}
|
|
|
if len(param.TargetUserId) > 0 {
|
|
|
condition = append(condition, pg.In(param.TargetUserId))
|
|
|
sqlStr += ` and staff_assess.target_user->>'userId' in (?) `
|
|
|
}
|
|
|
|
|
|
sqlStr = withSql + sqlStr + ` order by convert_to(staff_assess.target_user->>'userName','GBK'),begin_day,staff_assess_content.sort_by `
|
|
|
tx := d.transactionContext.PgTx
|
|
|
var result []ExportData1
|
|
|
_, err := tx.Query(&result, sqlStr, condition...)
|
|
|
return result, err
|
|
|
} |
...
|
...
|
|