作者 tangxvhui

更新评估内容导出

1 package query 1 package query
2 2
3 type ListAssessContentCycleDay struct { 3 type ListAssessContentCycleDay struct {
4 - CompanyId int `json:"companyId"`  
5 - OperaterId int `json:"operaterId"`  
6 - CycleId int `json:"cycleId,string"`  
7 - BeginDay string `json:"beginDay"`  
8 - TargetUserName string `json:"targetUserName"`  
9 - PageNumber int `json:"pageNumber"`  
10 - PageSize int `json:"pageSize"` 4 + CompanyId int `json:"companyId"`
  5 + OperaterId int `json:"operaterId"`
  6 + CycleId int `json:"cycleId,string"`
  7 + BeginDay string `json:"beginDay"`
  8 + TargetUserName string `json:"targetUserName"`
  9 + TargetUserId []string `json:"targetUserId"`
  10 + PageNumber int `json:"pageNumber"`
  11 + PageSize int `json:"pageSize"`
11 } 12 }
@@ -426,13 +426,13 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ListAssessContentCy @@ -426,13 +426,13 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ListAssessContentCy
426 xlsxFile.MergeCell(sheetName, "B5", "B5") 426 xlsxFile.MergeCell(sheetName, "B5", "B5")
427 //设置行高 427 //设置行高
428 for i := range tableRowSort { 428 for i := range tableRowSort {
429 - xlsxFile.SetRowHeight(sheetName, i+6, 50) 429 + xlsxFile.SetRowHeight(sheetName, i+5, 50)
430 } 430 }
431 //设置列宽 431 //设置列宽
432 for i := range headerList { 432 for i := range headerList {
433 colName, _ := excelize.ColumnNumberToName(i + 1) 433 colName, _ := excelize.ColumnNumberToName(i + 1)
434 if i == 0 { 434 if i == 0 {
435 - xlsxFile.SetColWidth(sheetName, colName, colName, 70) 435 + xlsxFile.SetColWidth(sheetName, colName, colName, 30)
436 } 436 }
437 } 437 }
438 return xlsxFile, nil 438 return xlsxFile, nil
@@ -169,15 +169,16 @@ type UserAssessContent struct { @@ -169,15 +169,16 @@ type UserAssessContent struct {
169 } 169 }
170 170
171 type SearchConditin1 struct { 171 type SearchConditin1 struct {
172 - CompanyId int //公司id  
173 - AssessId int //评估任务id  
174 - CycleId int //周期id  
175 - BeginDay string //评估的日期  
176 - TargetUserName string //被评估人的名称  
177 - Limit int //分页  
178 - Offset int //分页  
179 - OperaterId int //用户的id是谁在搜索数据  
180 - Hrbp int // 172 + CompanyId int //公司id
  173 + AssessId int //评估任务id
  174 + CycleId int //周期id
  175 + BeginDay string //评估的日期
  176 + TargetUserName string //被评估人的名称
  177 + TargetUserId []string //查询指定的人
  178 + Limit int //分页
  179 + Offset int //分页
  180 + OperaterId int //用户的id是谁在搜索数据
  181 + Hrbp int //
181 } 182 }
182 183
183 //项目管理-成员列表 根据周期的id和日期获取员工填写的评估内容 184 //项目管理-成员列表 根据周期的id和日期获取员工填写的评估内容
@@ -203,11 +204,12 @@ func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserA @@ -203,11 +204,12 @@ func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserA
203 staff_assess_content.weight 204 staff_assess_content.weight
204 from t_staff_assess_1 205 from t_staff_assess_1
205 left join staff_assess_content on t_staff_assess_1.assess_id = staff_assess_content.staff_assess_id 206 left join staff_assess_content on t_staff_assess_1.assess_id = staff_assess_content.staff_assess_id
  207 + where 1=1
206 ` 208 `
207 condition := []interface{}{} 209 condition := []interface{}{}
208 if len(param.TargetUserName) > 0 { 210 if len(param.TargetUserName) > 0 {
209 - sqlStr += ` where t_staff_assess_1.target_user_name like ? `  
210 - condition = append(condition, param.TargetUserName) 211 + sqlStr += ` and t_staff_assess_1.target_user_name like ? `
  212 + condition = append(condition, "%"+param.TargetUserName+"%")
211 } 213 }
212 //加入排序 214 //加入排序
213 sqlStr += ` order by convert_to(t_staff_assess_1.target_user_name,'GBK'),staff_assess_content.sort_by ` 215 sqlStr += ` order by convert_to(t_staff_assess_1.target_user_name,'GBK'),staff_assess_content.sort_by `
@@ -229,11 +231,11 @@ func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserA @@ -229,11 +231,11 @@ func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserA
229 //limit int, 分页条数 231 //limit int, 分页条数
230 //offset int 分页偏移 232 //offset int 分页偏移
231 func (d *StaffAssessDao) CountUserAssess(param SearchConditin1) (int, error) { 233 func (d *StaffAssessDao) CountUserAssess(param SearchConditin1) (int, error) {
232 - sqlStr := ` select count(*) from t_staff_assess_1 ` 234 + sqlStr := ` select count(*) from t_staff_assess_1 where 1=1 `
233 condition := []interface{}{} 235 condition := []interface{}{}
234 if len(param.TargetUserName) > 0 { 236 if len(param.TargetUserName) > 0 {
235 - sqlStr += ` where t_staff_assess_1.target_user_name like ? `  
236 - condition = append(condition, param.TargetUserName) 237 + sqlStr += ` and t_staff_assess_1.target_user_name like ? `
  238 + condition = append(condition, "%"+param.TargetUserName+"%")
237 } 239 }
238 //获取前置sql语句 240 //获取前置sql语句
239 sqlStr0 := d.useTStaffAssess(param.CompanyId, param.CycleId, param.OperaterId, param.BeginDay, param.Hrbp, 5000, 0) 241 sqlStr0 := d.useTStaffAssess(param.CompanyId, param.CycleId, param.OperaterId, param.BeginDay, param.Hrbp, 5000, 0)
@@ -357,11 +359,16 @@ func (d *StaffAssessDao) ExportDataUserAssess(param SearchConditin1) ([]ExportDa @@ -357,11 +359,16 @@ func (d *StaffAssessDao) ExportDataUserAssess(param SearchConditin1) ([]ExportDa
357 staff_assess_content.weight,staff_assess_content.prompt_text ,staff_assess_content.remark 359 staff_assess_content.weight,staff_assess_content.prompt_text ,staff_assess_content.remark
358 from t_staff_assess_1 360 from t_staff_assess_1
359 left join staff_assess_content on t_staff_assess_1.assess_id = staff_assess_content.staff_assess_id 361 left join staff_assess_content on t_staff_assess_1.assess_id = staff_assess_content.staff_assess_id
  362 + where 1=1
360 ` 363 `
361 condition := []interface{}{} 364 condition := []interface{}{}
362 if len(param.TargetUserName) > 0 { 365 if len(param.TargetUserName) > 0 {
363 - sqlStr += ` where t_staff_assess_1.target_user_name like ? `  
364 - condition = append(condition, param.TargetUserName) 366 + sqlStr += ` and t_staff_assess_1.target_user_name like ? `
  367 + condition = append(condition, "%"+param.TargetUserName+"%")
  368 + }
  369 + if len(param.TargetUserId) > 0 {
  370 + sqlStr += ` and t_staff_assess_1.target_user_id in (?) `
  371 + condition = append(condition, pg.In(param.TargetUserId))
365 } 372 }
366 //加入排序 373 //加入排序
367 sqlStr += ` order by convert_to(t_staff_assess_1.target_user_name,'GBK'),staff_assess_content.sort_by ` 374 sqlStr += ` order by convert_to(t_staff_assess_1.target_user_name,'GBK'),staff_assess_content.sort_by `