作者 郑周

Merge remote-tracking branch 'origin/test' into test

@@ -554,7 +554,7 @@ func (srv StaffAssessServeice) ExportUserAssess2(param *query.ExportUserAssess2C @@ -554,7 +554,7 @@ func (srv StaffAssessServeice) ExportUserAssess2(param *query.ExportUserAssess2C
554 "transactionContext": transactionContext, 554 "transactionContext": transactionContext,
555 }) 555 })
556 // 获取所有的评估项 556 // 获取所有的评估项
557 - categoryNameList, err := assessDao.SearchContentCategoryName(param.CompanyId, param.CycleId, param.OperatorId, hrbp) 557 + categoryNameList, err := assessDao.SearchContentCategoryName(param.CompanyId, param.CycleId, param.OperatorId, hrbp, param.ExportUserId)
558 if err != nil { 558 if err != nil {
559 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 559 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
560 } 560 }
@@ -769,7 +769,6 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ExportAssessContent @@ -769,7 +769,6 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ExportAssessContent
769 xlsxFile.SetCellStr(sheetName, "B2", "姓名") 769 xlsxFile.SetCellStr(sheetName, "B2", "姓名")
770 xlsxFile.MergeCell(sheetName, "B2", "B4") 770 xlsxFile.MergeCell(sheetName, "B2", "B4")
771 xlsxFile.SetCellStr(sheetName, "A5", "评估标准") 771 xlsxFile.SetCellStr(sheetName, "A5", "评估标准")
772 -  
773 //行数量 772 //行数量
774 rowNum := 0 773 rowNum := 0
775 for _, v := range eData.rowSort.Child { 774 for _, v := range eData.rowSort.Child {
@@ -839,6 +838,7 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ExportAssessContent @@ -839,6 +838,7 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ExportAssessContent
839 } 838 }
840 } 839 }
841 } 840 }
842 - xlsxFile.MergeCell(sheetName, "A1", fmt.Sprintf("A%d", colNum)) 841 + colName, _ := excelize.ColumnNumberToName(colNum + 2)
  842 + xlsxFile.MergeCell(sheetName, "A1", colName+"1")
843 return xlsxFile, nil 843 return xlsxFile, nil
844 } 844 }
@@ -1108,7 +1108,7 @@ type ContentCategoryName struct { @@ -1108,7 +1108,7 @@ type ContentCategoryName struct {
1108 1108
1109 // 员工绩效-综合管理-导出绩效指标 1109 // 员工绩效-综合管理-导出绩效指标
1110 // 抽取出评估的指标 1110 // 抽取出评估的指标
1111 -func (d *StaffAssessDao) SearchContentCategoryName(companyId int, cycleId int, userId int, hrbp int) ([]ContentCategoryName, error) { 1111 +func (d *StaffAssessDao) SearchContentCategoryName(companyId int, cycleId int, userId int, hrbp int, exportUserIds []string) ([]ContentCategoryName, error) {
1112 sqlStr := ` 1112 sqlStr := `
1113 select 1113 select
1114 staff_assess_content.category, 1114 staff_assess_content.category,
@@ -1126,19 +1126,25 @@ func (d *StaffAssessDao) SearchContentCategoryName(companyId int, cycleId int, u @@ -1126,19 +1126,25 @@ func (d *StaffAssessDao) SearchContentCategoryName(companyId int, cycleId int, u
1126 END) as cnt 1126 END) as cnt
1127 from staff_assess_content 1127 from staff_assess_content
1128 join t_staff_assess_1 on staff_assess_content.staff_assess_id = t_staff_assess_1.assess_id 1128 join t_staff_assess_1 on staff_assess_content.staff_assess_id = t_staff_assess_1.assess_id
1129 - group by staff_assess_content.category, 1129 + where 1=1
  1130 + `
  1131 + condition := []interface{}{}
  1132 + if len(exportUserIds) > 0 {
  1133 + condition = append(condition, pg.In(exportUserIds))
  1134 + sqlStr += ` and t_staff_assess_1.target_user_id in(?) `
  1135 + }
  1136 + sqlStr += ` group by staff_assess_content.category,
1130 staff_assess_content."name" , 1137 staff_assess_content."name" ,
1131 t_staff_assess_1.cycle_id , 1138 t_staff_assess_1.cycle_id ,
1132 t_staff_assess_1.cycle_name, 1139 t_staff_assess_1.cycle_name,
1133 staff_assess_content.weight , 1140 staff_assess_content.weight ,
1134 target_user_id,target_user_name 1141 target_user_id,target_user_name
1135 - order by cnt desc,target_user_id  
1136 - ` 1142 + order by cnt desc,target_user_id `
1137 sqlStr0 := d.useTStaffAssess(companyId, cycleId, userId, "", hrbp, 5000, 0, string(domain.AssessSelf)) 1143 sqlStr0 := d.useTStaffAssess(companyId, cycleId, userId, "", hrbp, 5000, 0, string(domain.AssessSelf))
1138 sqlStr = sqlStr0 + sqlStr 1144 sqlStr = sqlStr0 + sqlStr
1139 tx := d.transactionContext.PgTx 1145 tx := d.transactionContext.PgTx
1140 result := []ContentCategoryName{} 1146 result := []ContentCategoryName{}
1141 - _, err := tx.Query(&result, sqlStr) 1147 + _, err := tx.Query(&result, sqlStr, condition...)
1142 return result, err 1148 return result, err
1143 } 1149 }
1144 1150