作者 tangxvhui

修复数据查询

@@ -365,25 +365,25 @@ func (d *StaffAssessDao) SearchUserAssessContentV2(param SearchConditin3) ([]Use @@ -365,25 +365,25 @@ func (d *StaffAssessDao) SearchUserAssessContentV2(param SearchConditin3) ([]Use
365 sqlStr += ` order by convert_to(staff_assess.target_user ->>'userName','GBK') limit ? offset ? ` 365 sqlStr += ` order by convert_to(staff_assess.target_user ->>'userName','GBK') limit ? offset ? `
366 366
367 withSql2 := withSql + `,t_staff_assess_1 as( ` + sqlStr + ` )` 367 withSql2 := withSql + `,t_staff_assess_1 as( ` + sqlStr + ` )`
368 - sqlStr2 := `select  
369 - t_staff_assess_1.target_user_id,  
370 - t_staff_assess_1.target_user_name,  
371 - t_staff_assess_1.begin_day,  
372 - t_staff_assess_1.assess_id,  
373 - t_staff_assess_1.cycle_id,  
374 - staff_assess_content.id as content_id,  
375 - staff_assess_content.value ,  
376 - evaluation_item_used.sort_by ,  
377 - evaluation_item_used.category ,  
378 - evaluation_item_used."name" as content_name ,  
379 - evaluation_item_used.weight,  
380 - staff_assess_content.level_value,  
381 - evaluation_item_used."rule"  
382 - from t_staff_assess_1  
383 - join evaluation_item_used on t_staff_assess_1.evaluation_project_id =evaluation_item_used.evaluation_project_id  
384 - left join staff_assess_content on t_staff_assess_1.assess_id = staff_assess_content.staff_assess_id  
385 - and evaluation_item_used.category =staff_assess_content.category and evaluation_item_used."name" = evaluation_item_used."name"  
386 - where 1=1` 368 + sqlStr2 := ` ,t_item_used as (select
  369 + t_staff_assess_1.target_user_id,
  370 + t_staff_assess_1.target_user_name,
  371 + t_staff_assess_1.begin_day,
  372 + t_staff_assess_1.assess_id,
  373 + t_staff_assess_1.cycle_id,
  374 + evaluation_item_used.sort_by ,
  375 + evaluation_item_used.category ,
  376 + evaluation_item_used."name" as content_name ,
  377 + evaluation_item_used.weight,
  378 + evaluation_item_used."rule"
  379 + from t_staff_assess_1
  380 + join evaluation_item_used on t_staff_assess_1.evaluation_project_id =evaluation_item_used.evaluation_project_id
  381 + )
  382 + select t_item_used.* ,staff_assess_content.value,staff_assess_content.level_value
  383 + from t_item_used
  384 + left join staff_assess_content on staff_assess_content.staff_assess_id=t_item_used.assess_id
  385 + and t_item_used.category =staff_assess_content.category and t_item_used.content_name = staff_assess_content."name"
  386 + where 1=1`
387 sqlStr2 = withSql2 + sqlStr2 387 sqlStr2 = withSql2 + sqlStr2
388 tx := d.transactionContext.PgTx 388 tx := d.transactionContext.PgTx
389 var result []UserAssessContent 389 var result []UserAssessContent