作者 tangxvhui

调整导出的数据

... ... @@ -554,7 +554,7 @@ func (srv StaffAssessServeice) ExportUserAssess2(param *query.ExportUserAssess2C
"transactionContext": transactionContext,
})
// 获取所有的评估项
categoryNameList, err := assessDao.SearchContentCategoryName(param.CompanyId, param.CycleId, param.OperatorId, hrbp)
categoryNameList, err := assessDao.SearchContentCategoryName(param.CompanyId, param.CycleId, param.OperatorId, hrbp, param.ExportUserId)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
... ... @@ -769,7 +769,6 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ExportAssessContent
xlsxFile.SetCellStr(sheetName, "B2", "姓名")
xlsxFile.MergeCell(sheetName, "B2", "B4")
xlsxFile.SetCellStr(sheetName, "A5", "评估标准")
//行数量
rowNum := 0
for _, v := range eData.rowSort.Child {
... ... @@ -839,6 +838,7 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ExportAssessContent
}
}
}
xlsxFile.MergeCell(sheetName, "A1", fmt.Sprintf("A%d", colNum))
colName, _ := excelize.ColumnNumberToName(colNum + 2)
xlsxFile.MergeCell(sheetName, "A1", colName+"1")
return xlsxFile, nil
}
... ...
... ... @@ -1108,7 +1108,7 @@ type ContentCategoryName struct {
// 员工绩效-综合管理-导出绩效指标
// 抽取出评估的指标
func (d *StaffAssessDao) SearchContentCategoryName(companyId int, cycleId int, userId int, hrbp int) ([]ContentCategoryName, error) {
func (d *StaffAssessDao) SearchContentCategoryName(companyId int, cycleId int, userId int, hrbp int, exportUserIds []string) ([]ContentCategoryName, error) {
sqlStr := `
select
staff_assess_content.category,
... ... @@ -1126,19 +1126,25 @@ func (d *StaffAssessDao) SearchContentCategoryName(companyId int, cycleId int, u
END) as cnt
from staff_assess_content
join t_staff_assess_1 on staff_assess_content.staff_assess_id = t_staff_assess_1.assess_id
group by staff_assess_content.category,
where 1=1
`
condition := []interface{}{}
if len(exportUserIds) > 0 {
condition = append(condition, pg.In(exportUserIds))
sqlStr += ` and t_staff_assess_1.target_user_id in(?) `
}
sqlStr += ` group by staff_assess_content.category,
staff_assess_content."name" ,
t_staff_assess_1.cycle_id ,
t_staff_assess_1.cycle_name,
staff_assess_content.weight ,
target_user_id,target_user_name
order by cnt desc,target_user_id
`
order by cnt desc,target_user_id `
sqlStr0 := d.useTStaffAssess(companyId, cycleId, userId, "", hrbp, 5000, 0, string(domain.AssessSelf))
sqlStr = sqlStr0 + sqlStr
tx := d.transactionContext.PgTx
result := []ContentCategoryName{}
_, err := tx.Query(&result, sqlStr)
_, err := tx.Query(&result, sqlStr, condition...)
return result, err
}
... ...